in reply to Re: Re: finding top 10 largest files
in thread finding top 10 largest files
If you want to factor in the amount of files (let's say k) to be reported, the solution you present takes O (N log N + k), while my solution takes O (k N). If you replace the array with a heap, you can reduce that to O (k + N log k). The used memory in your solution is O (N), and O (k) in my solution.
All mentioned upperbounds are tight.
Abigail
|
|---|