GeeksforGeeks

A computer science portal for geeks

Browsing the tag Divide and Conquer

Given an array of integers which is initially increasing and then decreasing, find the maximum value in the array.

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 any Fixed Point present in array, else returns -1.

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?

Read More »

Write a C function to return minimum and maximum in an array. You program should make minimum number of comparisons.

Read More »

Question: Write a C function to find if a given integer appears more than n/2 times in a sorted array of n integers.

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 is 0. If array is sorted in reverse order that inversion count is the maximum.

Read More »

Question: 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 the above 2 arrays(i.e. array of length 2n). The complexity should be O(log(n))

Read More »

Below solution divides the problem into subproblems of size y/2 and call the subproblems recursively.

Read More »