Hello, I am writing a program that measures the time that it takes to sort a large array. The sort algorithms that I have came directly from my programming book, but I seem to be getting an infinite loop. Can anyone tell me why and what I need to do to fix it? Please note, I have only listed the part of my program that I think is causing the problem.
If you decrease size (and the while loop condition as well of course), then it finishes in reasonable time. It's not an infinite loop, Bubble sort is really that slow ;)
yes it is. try the sort function in the algorithms library. that usually works within a decent time. also removing/replacing the system ("pause"); is a good idea.
Wow! I considered that maybe it was just sorting really slowly, but I thought that this was a little ridiculous. The size was assigned by my prof, so I will run it again and wait longer! :-P
Thanks for your responses!