This is an interview question: considering that India is 1.14 billion people, what is the most efficient / efficient sorting algorithm that can be used to sort by their heights? (Heights data is available to you).
About (p):
If the height can be rounded to the nearest mm, you can calculate the height histogram and print the counts in each bucket of the histogram in order. Expected RAM requires only a few KB for 32-bit ints 2000.
Since the range of possible heights is quite small, I recommend:
, bin. ().
, , , , , Θ(n+k), n - , k - .
Θ(n+k)
n
k
, Ω(n×log n) , , , .
Ω(n×log n)
radix sort, bin.
Source: https://habr.com/ru/post/1776030/More articles:Undefined link for libpq functions - linkerWhat are the events on the canvas object that I can handle? - javascripthttps://translate.googleusercontent.com/translate_c?depth=1&pto=aue&rurl=translate.google.com&sl=ru&sp=nmt4&tl=en&u=https://fooobar.com/questions/1776027/is-there-a-function-in-emacs-to-search-the-filesystem-for-a-file-by-its-name&usg=ALkJrhi3a2AJYjWuzWXkpsKs-W_BV3K6nwGetting java.lang.ClassNotFoundException: org.jsoup.Jsoup - javaИспользование PHP Simple HTML DOM Parser для статуса приложения Google - phpDynamically create Tkinter buttons - pythonConsequences of a policy of the same origin of JavaScript when dynamically loading images - javascriptmembership.deleteuser () returns false - asp.netЗаказ Django QuerySet на месяц/день? - djangoКак сообщить jQuery о добавленной строке строки - jqueryAll Articles