Re: 演算法?

看板Programming作者時間18年前 (2007/01/21 02:01), 編輯推噓0(000)
留言0則, 0人參與, 最新討論串1/1
> ==> donggun (【U.K.】) 的文章中提到: > 幫我解答一下這提吧 = = > 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? > 這題看來是沒有好的解 時間複雜度(2n),big O while(!EOF){ ansArray[lineData]←1; } for(i←0;i<1,000,000;i++){ if(!ansArray[i]){ return i; } } -- * Origin: 中山大學-美麗之島BBS * From: 59.120.191.181
文章代碼(AID): #15ibZc00 (Programming)
文章代碼(AID): #15ibZc00 (Programming)