Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
7 votes
3 answers
2k views

Finding the majority element in an array

A list is said to have a “majority element” if more than half of its entries are identical. In this classical problem the goal consists of determining whether a list a of length n has a majority ...
Soner from The Ottoman Empire's user avatar
3 votes
2 answers
157 views

Max Contiguous Subarray: Divide and Conquer

I am conversant with Kadane's Algorithm. This is just an exercise in understanding divide and conquer as a technique. Find the maximum sum over all subarrays of a ...
Brayoni's user avatar
  • 183
2 votes
1 answer
785 views

Finding peak point in an array by using divide and conquer approach

It is to find the maximum element in an array which is first increasing and then decreasing. I've tried to write my idea by using divide and conquer approach. Is there any improvable or missing point? ...
Soner from The Ottoman Empire's user avatar
2 votes
2 answers
396 views

Finding the closest pair of points divide-and-conquer speed improvement

This is a follow up to a previously asked Finding the closest pair of points divide-and-conquer question . The original code changed significantly based on answers from @AJNeufeld therefore I created ...
mghah's user avatar
  • 113
4 votes
2 answers
7k views

Finding the closest pair of points divide-and-conquer

Here is my code for the famous "finding the closest pair of points" problem from CLRS book section 33.4 using a divide-and-conquer approach (this code returns the minimum distance between pair of ...
mghah's user avatar
  • 113