Tag: Must Know

Quick sort algorithm using Hoare’s Partitioning scheme

Implement Quick sort algorithm using Hoare’s Partitioning scheme. Get great deals at Amazon

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 linked list | Recursive Solution

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

Reverse linked list | Iterative Solution

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

Implement Linked List | Insertion at the tail

In the previous two posts (here and here), we have introduced linked list data structure and discussed about various types of linked lists.. We also covered in great detail the various methods to construct a linked list which inserts every new node onto the front of the list. In this post, we will discuss various …