C RUBY-ON-RAILS MYSQL ASP.NET DEVELOPMENT RUBY .NET LINUX SQL-SERVER REGEX WINDOWS ALGORITHM ECLIPSE VISUAL-STUDIO STRING SVN PERFORMANCE APACHE-FLEX UNIT-TESTING SECURITY LINQ UNIX MATH EMAIL OOP LANGUAGE-AGNOSTIC VB6 MSBUILD

# Calculate the median of a billion numbers

By : user49624
Date : November 21 2020, 07:01 PM
I wish did fix the issue. Ah, my brain has just kicked into gear, I have a sensible suggestion now. Probably too late if this had been an interview, but never mind:
Machine 1 shall be called the "control machine", and for the sake of argument either it starts with all the data, and sends it in equal parcels to the other 99 machines, or else the data starts evenly distributed between the machines, and it sends 1/99 of its data to each of the others. The partitions do not have to be equal, just close.
code :

Share :

## Is it possible to calculate median of a list of numbers better than O(n log n)?

By : Ajit K Kumar
Date : March 29 2020, 07:55 AM

## calculate catalan numbers up to a billion

By : dotpot
Date : March 29 2020, 07:55 AM
wish of those help I'm new to python (and programming in general), I was asked in my class to calculate Catalan numbers up to a billion but the program I wrote for it is not working as intended.
code :
``````        C=(4*n+2)/(n+2)*C
``````
``````        C=C*(4*n+2)/(n+2)
``````

## Can i calculate the median of numbers in less than Big O(n)

By : user1066270
Date : March 29 2020, 07:55 AM
To fix the issue you can do If you want to find real median, there is no way to do it faster than in O(n) (in unstructured array) - because you have to go through all numbers. You never know if the last number you find will be median or not.
For some alghoritms there is heuristic used for finding median, which means you dont get exact median, but you have some approach how to get (with some probability) close to the real one.

## Given 4 billion numbers, how to find a number which is not in these 4 billion numbers? We have only 1GB of memory

By : Richard Nash
Date : March 29 2020, 07:55 AM
I wish this helpful for you Assuming that this is a routine you are just going to run once, use the amount of memory available as a limiting factor. Load the numbers into an array, up to the amount of memory you have available. Sort the array using your favorite sorting algorithm. Do a binary search to see if the value is present. If it's there, you're done, if not, then clear the array and start loading numbers from the file in the last place you left off. Repeat the process until you find a match or you reach the end of the file.
For example, if you have 1 GB to work with and the numbers are 4 bytes large (say, C# int), set the upper array bound at something like 1024 ^ 3 / 4 = 268435456 * i (where i is some value < 1 to make sure we leave a little memory left over for other processes). Fill the array, sort, check, repeat.

## How do I calculate the k nearest numbers to the median?

By : Rene Torres
Date : March 29 2020, 07:55 AM
hop of those help? You can solve your problem like that:
You can find the median in O(n), w.g. using the O(n) nth_element algorithm.