Category: Algorithm


  • Linear Search in Java with Example

    It is an algorithm that searches for an element one by one in an array, until the target element is found. Consider if X is an element to be searched in an array, then linear search performs the following: Compare X with each element of array one by one If X matches with an element,…

  • Binary Search in Java with Example

    It is an algorithm that searches for an element in a sorted array, and it follows a Divide and Conquer algorithmic model. Dictionary is the best example for Binary Search, since the words are in alphabetical order we don’t need to search each page by page for a word. Just, we will compare the word…

  • Maps Space-time complexity

    Learn more about Code Complexity

  • Custom LinkedList Implementation in Java

    What is Linked List ? A linked list is a linear data structure containing interconnected nodes through pointers. Since there is no concept of pointers in Java, each node holds the reference of another node, but the last element of the linked list refers to NULL, meaning the end of the list. A linked list…

  • Algorithm Code Complexity

    Code Complexity compute it by using the control flow graph of the program. Cyclomatic complexity measures the number of nested conditions within the code, such as those created by for, if/else, switch, while, and until. The greater the number of conditions (as in example b from above), the greater the complexity.   Time complexity:  Worst…