## Sorting using trivial hash function

The problem “Sorting using trivial hash function” states that you are given an integer array. An array can be containing both negative and positive numbers. The problem statement asks to sort the array using Trivial Hash Function. Example   arr[] = {5,2,1,3,6} {1, 2, 3, 5, 6} arr[] = {-3, -1, …

## Find duplicates in a given array when elements are not limited to a range

The problem “Find duplicates in a given array when elements are not limited to a range” states that you have an array consisting of n integers. The problem statement it to find out the duplicate elements if present in the array. If no such element exists return -1. Example   [ …

## Print the Fibonacci numbers in reverse order

Problem Statement   Given a number n, print the fibonacci numbers in reverse order. Example   n = 5 3 2 1 1 0 Explanation: The Fibonacci numbers are 0, 1, 1, 2, 3 as per their ordering. But since we needed to print in reverse order. n = 7 8 5 …

## Implementation of Deque using Doubly Linked List

Problem Statement   The problem “Implementation of Deque using Doubly Linked List” states that you need to implement the following functions of Deque or Doubly Ended Queue using a doubly linked list, insertFront(x) : Add element x at the starting of Deque insertEnd(x) : Add element x at the end of …

## K’th Largest Element in BST when modification to BST is not allowed

Problem Statement   “K’th Largest Element in BST when modification to BST is not allowed” states that you are given a binary search tree and you need to find the kth largest element. This means that when all the elements of the binary search tree are arranged in descending order. Then …

## Binary Search Tree Search and Insertion

Problem Statement   Write an algorithm to perform searching and insertion in Binary Search Tree. So what we are going to do is insert some of the elements from input into a binary search tree. Whenever asked to search a particular element, we’ll be searching it among the elements in BST(short …

## Find the smallest positive integer value that cannot be represented as sum of any subset of a given array

Problem Statement   You are given a sorted array of integers. We need to find the smallest positive integer value that cannot be represented as sum of any subset of a given array. Example   arr[] = {1,4,7,8,10} 2 Explanation: Because there is not any sub-array that can represent 2 as a …

## Largest area rectangular sub-matrix with equal number of 1’s and 0’s

Problem Statement   Given a binary matrix of size n x m. The problem is to find the largest area rectangular sub-matrix with equal number of 1’s and 0’s. Example   Dimensions = 4 x 4 Matrix: 1 1 1 1 0 1 0 1 1 0 1 0 1 0 0 …

## Size of The Subarray With Maximum Sum

Problem Statement   You are given an array of integers. The given array can contain both positive and negative numbers. Find out the size of the subarray with maximum sum. Example   arr[] = {1,4,-2,-5,2-1,4,3} 4 Explanation: 2 -1 + 4 + 3 = 8 is maximum sum of length 4 arr[] …

## Construct BST from its given Level Order Traversal

Given the level order traversal of a Binary Search Tree, write an algorithm to construct the Binary Search Tree or BST from ITS given level order traversal. Example   Input levelOrder[] = {18, 12, 20, 8, 15, 25, 5, 9, 22, 31} Output In-order : 5 8 9 12 15 18 …