Hacker News new | past | comments | ask | show | jobs | submit login

accidentally quadratic.

you just want two non-nested loops.






It's not accidental. It's optimized to minimize the number of writes necessary to determine whether the reported storage capacity is genuine.

If it is genuine your quadratic version will perform the same number of writes as the linear time solution.

If it is non-genuine what do you care how many writes it will perform? In that case the media is trash anyways.

The quadratic test will take an eternity due to the n^2 hashing operations and reads unless it terminates extremely early.

If you really have a need to terminate writing early, you could at least perform only a few reads randomly after each write (which will terminate early with high probably not long after you reached the maximum).




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: