Write an efficient program to find the sum of contiguous subarray within a one-dimensional array of numbers that has the largest sum....
Given two sorted lists, merge them so as to produce a combined sorted list (without using extra space).Examples:...
Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number. Examples :...
Given a positive integer n, write a function to find if it is a power of 2 or not...
Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’....
An element in a sorted array can be found in O(log n) time via binary search. But suppose we rotate an ascending order sorted array at some pivot unknown to you beforehand. So for instance, 1 2 3 4 5 might become 3 4 5 1 2. Devise a way to find an element in the rotated array in O(log n) time....
Given an unsorted array of integers, sort the array into a wave like array. An array ‘arr[0..n-1]’ is sorted in wave form if arr[0] >= arr[1] <= arr[2] >= arr[3] <= arr[4] >= ….....
Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’....
Given an unsorted array of nonnegative integers, find a continuous subarray which adds to a given number. Examples :...
A Binary Search Tree (BST) is a node-based binary tree data structure that has the following properties....
Given a sorted and rotated array arr[] of size N and a key, the task is to find the key in the array....
Given two positive integers L and R, the task is to count the total number of set bits in the binary representation of all the numbers from L to R....