Given a binary matrix, find the largest square sub-matrix which is surrounded by all 1’s.
Given a binary tree, print its nodes in vertical order. Assume that the left and right child of a node makes 45 degree angle with the parent.
Given a binary tree, write an efficient algorithm to link nodes at the same level in the form of a linked list like structure.
In this post, we will implement Treap Data Structure and perform basic operations like insert, search and delete on it.
In this post, we will see how to implement a queue using stack data structure in C++ and Java. In other words, design a queue that supports enqueue and dequeue operations using standard push and pop operations of the stack.
Write an efficient algorithm to find preorder traversal of a binary tree from its inorder and postorder sequence without constructing the tree.
Find all N-digit numbers with equal sum of digits at even and odd index. N varies from [1 to 9].
Design a stack to support an additional operation which returns the minimum element from the stack in constant time. The stack should continue supporting all other operations like push, pop, top, size, empty, etc, with no degrade in performance for these operations.
Given a multilevel linked list, convert it into a singly linked list in such a way that all nodes of first level appears first, followed by all nodes of second level, and so on. The multilevel linked list is similar to the simple linked list except that it has one extra field which points to …
Given an array of integers, rearrange the array such that it contains positive and negative numbers at alternate positions. If array contains more positive or negative elements, they should be moved to end of the array.
Calculate total number of ways to achieve given sum with n throws of dice having k faces.
Given a binary search tree, modify it such that every key is updated to contain sum of all greater keys present in BST.