Maximum Subarray Sum using Divide and Conquer algorithm
You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which has… Read More »
You are given a one dimensional array that may contain both positive and negative integers, find the sum of contiguous subarray of numbers which has… Read More »
Like QuickSort, Merge Sort is a Divide and Conquer algorithm. It divides input array in two halves, calls itself for the two halves and then… Read More »
Company : Qualcomm Position: Summer Intern(Software) Written Test It was an online MCQ test. Time limit was one hour. There were around 55 question. It… Read More »
We are given an array of n points in the plane, and the problem is to find out the closest pair of points in the… Read More »
In this article, we are going to discuss how Divide and Conquer technique is helpful and how we can solve the problem with the DAC… Read More »
Given two sorted arrays, a[] and b[], the task is to find the median of these sorted arrays, in O(log n + log m) time… Read More »
Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array. Examples : Input: arr[] = {8,… Read More »
Given an array of n distinct integers sorted in ascending order, write a function that returns a Fixed Point in the array, if there is… Read More »
Given a sorted array arr[] and a number x, write a function that counts the occurrences of x in arr[]. Expected time complexity is O(Logn)… Read More »
Given an integer array of length N (an arbitrarily large number). How to count number of set bits in the array? The simple approach would be, create… Read More »
Method 1 (Using Nested Loops) We can calculate power by using repeated addition. For example to calculate 5^6. 1) First 5 times add 5, we… Read More »
Write a C function to return minimum and maximum in an array. You program should make minimum number of comparisons. Recommended: Please solve it on… Read More »
Question: Write a C function to find if a given integer x appears more than n/2 times in a sorted array of n integers. Basically,… Read More »
Inversion Count for an array indicates – how far (or close) the array is from being sorted. If array is already sorted then inversion count… Read More »
There are 2 sorted arrays A and B of size n each. Write an algorithm to find the median of the array obtained after merging… Read More »