• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

My God, Bubble Sorts Suck!

BDawg

Lifer
We're coving basic sorting in my visual basic course. Since I've covered this stuff before, I finished my project pretty quickly and decided to run a little test. I thought it would be kinda fun to compare a shell sort (not covered in this course) to a bubble sort (reccomended in our course) on a file of 30,000 records.

The shell sort finished in about 6 seconds. The bubble sort (which I know works, I tested it on a file of 5 records) is still chugging along after 20 minutes (I started at 4:47). How long should I wait before I just give up on the bubble sort?
 
Somethign must be wrong. There is no way buble sort can be going on after 20 minutes on any decently fast machine. Were all the records read into memory first?
 
Yeah, I covered the two when I took C in college too. But, I never did any real world experiments to see how much faster the extra pair comparisons take.

BTW, the bubble sort just finished a few minutes ago. It took a little over 21 minutes. 😀 I can only imagine what the results would be on a 486DX.
 


<< Somethign must be wrong. There is no way buble sort can be going on after 20 minutes on any decently fast machine. We all the records read into memory first? >>



Ida know...that's how long it took on my P3 1Ghz laptop. It has 256 MB Ram, so I would think they all (~314k) would be read into memory. I didn't really check for disk access though.
 
Back
Top