看板 Programming 關於我們 聯絡資訊
以下是一所國外研究所的考試題目,是否能用程式跟圖解來解答這個問題? I have a computer file containing 1,000,000 non-negative integers, in no particular order. Imagine that they are the membership numbers of people who are enrolled in my internet club. A new person wants to join the club, and we need to find an unused number to allocate to them. How would you find, in a reasonable time, a number that was not already in the file? -- ※ 發信站: 批踢踢實業坊(ptt.cc) ◆ From: 220.140.56.26
march20:全部加起來一定沒問題 XD 71.136.235.216 01/13 11:58
march20:如果只需要一次的話. 71.136.235.216 01/13 11:59
march20:不然長遠來看, 用些資料結構來放會比較賺 71.136.235.216 01/13 11:59
march20:喔, 為了避免 0 的問題, sum 完後再加1 71.136.235.216 01/13 12:07
yaote:轉錄至看板 C_and_CPP 01/13 18:59