Posted by Paikuhan on August 01, 1999 at 15:16:38:
In Reply to: Counting... posted by Sleepless Snowman on July 31, 1999 at 21:56:34:
Looks like you are implementing the Bubble sort instead of the insertion sort, you sure you used the insertion sort instead of the bubble sort...
On this note, we don't have to have the exact result as Hussein's do we. I noticed in his results for n = 100 in the insertion sort, the different between swaps and sorts is 94, for me it is 99... does that matter? is that wrong?
Also, I am misinterpreting the specs, it says
"You must write functions to make comparisons and swap elements"
I am assuming he just means both must be in the functions and measured inside each function...
: So far, my results for the insertion sorts do :not resemble closely to that of Hussein's :results...rather the are more closely to that of :the BubbleSort and Selection Sort... anyone :getting the same results??
: n= 100 | Compares: 4950 | Swaps: 2272
: n= 200 | Compares: 19900 | Swaps: 9915
: n= 300 | Compares: 44850 | Swaps: 22367
: n= 400 | Compares: 79800 | Swaps: 39580
: n= 500 | Compares: 124750 | Swaps: 62450
: n= 600 | Compares: 179700 | Swaps: 94200
: n= 700 | Compares: 244650 | Swaps: 123687
: n= 800 | Compares: 319600 | Swaps: 160507
: n= 900 | Compares: 404550 | Swaps: 190855
: n= 1000 | Compares: 499500 | Swaps: 256719