• 27 December

    Depth First Search in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In previous post, we have seen breadth-first search(bfs). In this post, we will see how to implement depth-first search(DFS) in java. Graph traversal Algorithms Breadth first search in java Depth first search in java In DFS,  You […]

  • 27 December

    Breadth first search in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. We have already seen about breadth first search in level order traversal of binary tree. Graph traversal Algorithms: Breadth first search in java Depth first search in java Breadth first search is graph traversal algorithm. In this […]

  • 15 December

    How to find GCD and LCM of two numbers in java

    In this post, we will see how to find Greatest common divisor(GCD) and Least Common Multiple(LCM) in java. GCD is calculated using Euclidean algorithm and LCM is calculated using reduction by GCD Eucid algo for calculating GCD is: Lets say , there are two numbers , a and b so GCD of two numbers = […]

  • 09 December

    insertion sort in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview programs. In this post, we will see how to implement insertion sort in java. Insertion sort is very much similar to bubble sort. Insertion sort Algorithm Insertion sort works by comparing values at index with all its […]

  • 08 December

    Bubble sort in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. In this post, we will see how to implement Bubble sort in java. Bubble sort is also known as sinking sort.Bubble sort is a comparison based sorting algorithm and is very easy to implement. Bubble sort […]

  • 07 December

    Merge sort in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview questions. Merge sort is divide and conquer sorting algorithm. It is efficient, comparison based sorting algorithm. Merge sort Algorithm It works on below principle: Divide list into sublist of about half size in each iteration until each […]

  • BlockingQueue in java
    05 December

    BlockingQueue in java

    BlockingQueue is introduced in java with concurrent package with ConcurrentHashMap. It is thread safe queue to put and take elements from it. BlockingQueue is special type of queue which is used when one thread produces object and another thread consumes it. Producer thread will keep inserting objects to queue until it reaches upper limit. Once […]