google-moderator

How would you sort 1 million 32-bit integers in 2MB of RAM?

为君一笑 提交于 2019-11-27 17:32:48
Please, provide code examples in a language of your choice. Update : No constraints set on external storage. Example: Integers are received/sent via network. There is a sufficient space on local disk for intermediate results. Split the problem into pieces small enough to fit into available memory, then use merge sort to combine them. Sorting a million 32-bit integers in 2MB of RAM using Python by Guido van Rossum 1 million 32-bit integers = 4 MB of memory. You should sort them using some algorithm that uses external storage. Mergesort, for example. You need to provide more information. What

How would you sort 1 million 32-bit integers in 2MB of RAM?

北慕城南 提交于 2019-11-26 22:34:52
问题 Please, provide code examples in a language of your choice. Update : No constraints set on external storage. Example: Integers are received/sent via network. There is a sufficient space on local disk for intermediate results. 回答1: Split the problem into pieces small enough to fit into available memory, then use merge sort to combine them. 回答2: Sorting a million 32-bit integers in 2MB of RAM using Python by Guido van Rossum 回答3: 1 million 32-bit integers = 4 MB of memory. You should sort them