• 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-6623491d00f2c879734107/] 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

    Queue implementation 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 implement Queue using Array in java. Queue is abstract data type which demonstrates First in first out (FIFO) behavior. We will implement same behavior using Array. Although java provides implementation for […]

  • 12 October

    Implement Queue using Linked List 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 implement Queue using Linked List in java. Queue is abstract data type which demonstrates First in first out (FIFO) behaviour. We will implement same behaviour using Array. Although java provides implementation […]

  • 10 October

    Convert sorted Linked List to balanced BST

    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 convert sorted LinkedList to balanced binary search tree. There are two ways to do it. Solution 1: It is very much similar to convert sorted array to BST. […]

  • 10 October

    Convert sorted array to balanced binary search tree

    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 convert sorted array to balanced binary search tree. Algorithm: You might know that inorder traversal of binary search tree results in sorted array. We will use this property […]

  • 06 October

    Maximum difference between two elements such that larger element appears after the smaller number

    If you want to practice data structure and algorithm programs, you can go through 100+ java coding interview questions. Given array of integers, find Maximum difference between two elements such that larger element appears after the smaller number For example: [crayon-6623491d04fed411190915/] Algorithm: Lets say we have array arr[] of stock prices. We will track two variable :minElementTillNow and maxDifference. minElementTillNow will be […]