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

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

