#
Algorithm Interview Archive

In this post, we will see Dijkstra algorithm for find shortest path from source to all other vertices. Problem You will be given graph with weight for each edge,source vertex and you need to find …

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 …

In this tutorial, we will see how to check if number is power of two. There are many approaches to check if number is power of two or not. Approach 1: It is very easy and …

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 …

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 …

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 will be {5, …

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 …

In this post, we will see how to find smallest and largest element in an array. Problem: You are given an array of numbers. You need to find smallest and largest numbers in the array. …