## Dynamically Allocate Memory for 3D Array

In this post, we will discuss various methods to dynamically allocate memory for 3D array in C using Single Pointer and Triple Pointer.

## Find Equilibrium Index of an Array

Given an array of integers, find equilibrium index in it.

## Sort an array containing 0’s, 1’s and 2’s (Dutch national flag problem)

Given an array containing only 0’s, 1’s and 2’s, sort the array in linear time and using constant space.

## Determine if given Binary Tree is a BST or not

Given a Binary Tree, determine if it is a BST or not.   This problem has a simple recursive solution. The BST property “every node on the right subtree has to be larger than the current node and every node on the left subtree has to be smaller than the current node” is the key …

## Find maximum sum root to leaf path in a binary tree

Given a binary tree, write an efficient algorithm to find maximum sum root to leaf path i.e. maximum sum path from root node to any leaf node in it.

## 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 …

## Convert binary tree to its mirror

Given a binary tree, write an efficient algorithm to convert binary tree to its mirror.

## In-place convert given binary tree to its sum tree

Given a binary tree, in-place convert it to its sum tree. In a sum tree, value at each node is equal to the sum of all elements present in its left and right subtree. The value of an empty node is considered as 0.

## Reverse Level Order Traversal of Binary Tree

Given a binary tree, print its nodes level by level in reverse order. i.e. all nodes present at last level should be printed first followed by nodes of second-last level 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.

## Find K’th node from the end in a linked list

Given a linked list and a positive integer K, find K’th node from the end in a linked list.

## Reverse every group of k nodes in given linked list

Given a linked list, reverse every adjacent group of k nodes in it where k is given positive integer.