|
|
back to boardO(n) is possible But I think, it is cheating... Edited by author 08.04.2007 03:01 Re: O(n) is possible My solution is O(n). Bool array, no cheating! O(n*log n)-My solution in input we have first array sorted an second unsorted my solution needs to sort second array so it has O(n*log n) quick sort. where n is M(number of Student's dates) then i solve problem in O(n): -------------------------------- While (j<=M) and (i<=N) do begin While S[j]<T[i] do inc(j); if S[j]=T[i] then begin inc(j); inc(Am); end else inc(i); end; ----------------------------------- S-Array of teacher records T-Array of student records Am-number of complying dates so, this algo is O(N*log n); |
|
|