• 04 November

    Topological Sort in java

    In this post, we will see about Topological Sorting in the graph. Topological Sorting is ordering of vertices or nodes such if there is an edge between (u,v) then u should come before v in topological sorting. Topological sort is possible only for Directed Acyclic Graph(DAG). If there is a cycle in graph, then there […]

  • 16 September

    Doubly Linked List in java

    If you want to practice data structure and algorithm programs, you can go through Java coding interview questions. In this post, we will see about Doubly LinkedList implementation in java. We have already seen the implementation of singly linked list. You can consider this as an extension of Singly linked list.It is quite complex to implement […]

  • 22 August

    Sorting algorithms in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see about Sorting algorithms in java. A Sorting algorithm is an algorithm which puts collection of elements in specific order. For example: You want to sort list of numbers into ascending order […]

  • 02 February

    Rotate an array by K positions

    In this tutorial, we will see how to rotate an array be K positions. Problem: N=6 and k=2 If Arr[] = {1, 2, 3, 4, 5, 6} and k=2 then [rotated array](https://java2blog.com/search-element-in-sorted-and-rotated-array-java/ “rotated array”) will be  {5, 6, 1, 2,  3,  4} Solution: There are multiple ways to solve this problem. Approach 1: Move each […]

  • 25 October

    Find Smallest and Largest Element in an Array in Java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see how to find smallest and largest element in an array. 1. Introduction to Problem Let’s say we have an array of numbers. [crayon-6729f49dd8a9a050974537/] Our goal is to find out smallest and […]

  • 22 October

    Trie data structure in java

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. In this post, we will see about trie data structure in java. What is Trie : Trie is data structure which stores data in such a way that it can be retrieved faster and improve the performance. […]

  • 15 October

    Largest sum contiguous subarray

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. Problem: From Wikipedia : In computer science, the Largest sum contiguous subarray is the task of finding the contiguous subarray within a one-dimensional array of numbers which has the largest sum. For example, for the sequence of […]

  • 15 October

    Kadane ‘s Algorithm in java

    If you want to practice data structure and algorithm programs, you can go through Java coding interview questions. Kadane algorithm is a famous algorithm to solve maximum subarray problem. Maximum subArray problem: From Wikipedia : In computer science, the maximum subarray problem is the task of finding the contiguous subarray within a one-dimensional array of numbers […]

  • 12 October

    Selection sort in java

    If you want to practice data structure and algorithm programs, you can go through data structure and algorithm interview programs. Selection sort is an in place comparison sorting algorithm. It is very simple to implement but it does not go well with large number of inputs. Selection sort algorithm Find the minimum element in the list. […]