3 ms·
How is it that your data was too big to fit in memory, but small enough that bubble sort ran in a reasonable amount of time? Did you have really tight memory co
by MichaelDickens 8y ago
How is it that your data was too big to fit in memory, but small enough that bubble sort ran in a reasonable amount of time? Did you have really tight memory constraints (not sure I'm guessing you'd have to have <100KB of memory)?
- samatman 8y agoBecause the sort is done, not when all memory is sorted, but when there's a memory region large enough to malloc. The comparator here is "used" or "empty", where "used" is either > or < "empty".
- AlotOfReading 8y agoThe data wasn't too big to fit in memory, but rather defragmentation meant that the amount of free memory available was less than the amount of contiguous space, which will be an issue in any dynamically allocating system that doesn't translate pointers. That said, bubble sort is only n^2 and computers are fast. The real solution was that defrag was an alternative to crashing, so it didn't matter how long it took. Calling it meant a bug report needed to be filed.