Depth first search (DFS) vs Breadth first search (BFS)

In this post, we will see the difference between Depth first search (DFS) and Breadth first search (BFS) algorithm which are used to traverse/search tree or graph data structure.

Quick sort algorithm using Hoare’s Partitioning scheme

Implement Quick sort algorithm using Hoare’s Partitioning scheme.

Implementation of Counting Sort Algorithm in C

Given a collection of n items, each of which has a non-negative integer key whose maximum value is at most k, effectively sort it using counting sort algorithm.

Implementation of KMP Algorithm in C, C++ and Java

In this post, we will implement KMP Algorithm in C, C++ and Java programming language.

Given an array of integers, find contiguous subarray within it which has the largest sum.

Inorder Tree Traversal | Iterative & Recursive

Given a binary tree, write iterative and recursive solution to traverse the tree using in-order traversal in C++ and Java.   Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (pre-order, in-order, and post-order) or breadth-first order (level …

Preorder Tree Traversal | Iterative & Recursive

Given a binary tree, write iterative and recursive solution to traverse the tree using pre-order traversal in C++ and Java.     Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (pre-order, in-order, and post-order) or breadth-first order …

Postorder Tree Traversal | Iterative & Recursive

Given a binary tree, write iterative and recursive solution to traverse the tree using post-order traversal in C++ and Java.     Unlike linked lists, one-dimensional arrays and other linear data structures, which are traversed in linear order, trees may be traversed in multiple ways in depth-first order (pre-order, in-order, and post-order) or breadth-first order …

Level Order Traversal of Binary Tree

Given a binary tree, print its nodes level by level. i.e. all nodes present at level 1 should be printed first followed by nodes of level 2 and so on.. All nodes for any level should be printed from left to right.

Detect Cycle in a linked list (Floyd’s Cycle Detection Algorithm)

In this post, we will see how to detect cycle in a a linked list using Hashing and Floyd’s Cycle Detection Algorithm.

Reverse a Linked List in C/C++ using Recursion

In this post, we will see how to reverse linked list using recursion in C and C++.

Reverse a linked List in C and Java (Iterative Solution)

In this post, we will see how to reverse linked list iteratively without using recursion.