#
Algorithm Archive

I have been posting data structure and algorithms programs on various topics such as Array,Queue, Stack ,Binary tree, LinkedList , String, Number, ArrayList, etc. So I am consolidating list of programs to create an index …

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 …

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 …

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 check for balanced parentheses in an expression. Lets …

Fibonacci series is numerical series in which next number is sum of previous two numbers. For example : 0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55 etc. There are two ways to …

In this post, we will see how to find prime factors of a number in java. A prime number is a natural number greater than 1 that has no positive divisors other than 1 and …

A palindrome is a word, phrase, number, or other sequence of symbols or elements that reads the same forward or reversed. For example: 12121 is palindrome as it reads same forward or reversed. madam is …

This is easy question. It may not be asked you directly, but you can use this program to create many other complex program. A prime number is a natural number greater than 1 that has …

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 …