Guidance Needed With Bubble Sort

Pages: 12
Don't know if this is your problem or not since you have modified your code, but in your first post, line 58 of main.cpp: myBubbleSort(intList, 5); You have deleted an item from the list at that point.

Try this instead: myBubbleSort(intList, intList.listSize());
Well my bubble sort is no longer in my main, it's being defined in the header now. I also noticed that the remove function calls removeAt, where my problems seems to be. Not sure if any changes need to be made here or not but I still can't seem to figure it out.
My point was that you, as did Gkneeus since he used your main, were passing 5 to the bubblesort function when there are only 4 elements in the array. Hence bubbleSort indexes out of bounds.
And you, sir win a cigar. Staring at code for days wondering why things aren't working when it seems like they should be drives me crazy, having more sets of eyes look at the code is a great thing. Thank you norm b, everything IS defined correctly, I was just passing an invalid number of values into my sort.



This is what I'm currently using in my main and everything is working flawlessly. Thank you again everybody for the help, it has been greatly appreciated!
Topic archived. No new replies allowed.
Pages: 12