ohhh sory.. uhmm, here it is..
ascending order:
for example: 5 4 6 8 2 1
-- this is the original array increment composed of 6 elements, 1st we need to determine the mid point. so total numbers / 2 = mid point. when the mid point is determined already we will now proceed with the 1st pass. to...
oops.. i'm sorry that i wasn't able to explain it clearly, here is an example of it. .
ascending order:
for example: 5 4 6 8 2 1 -- 1st last to be compared, then increment left and decrement right.
1st pass: 1 4 6 8 2 5 -- then compare the underline again and swap
2nd pass: 1 2 6 8 4 5 --...
no of course i won't ^_^ its just i need to follow the logic and at times i get dizzy becaus of it, i only have months of exposure in c and i don't even have that many background on sorting algorithms. and sometimes have a tendency on sticking to what i have been doing instead of finding new...
ahh.. ok.. i'm sorry i didn't quite understand well, if i do that i would be increasing the passes made with the sorting algo, the sorting algo's goal is to reduce the amount of passes if it is done using insert sort.
for example:
to sort this: 5 4 6 8 2 1
in insertion it'll take 5 passes...
i didn't quite get what you mean? what does %% mean?? hmm.. this is a case study of sorts and shoud i omit the inner loop ctr2? and add the one you included?
I tried what you told me and so far it really lessened the problems,
unfortunately, the looping statement which increments and decrements both sides are having problems. once the side increments or decrements once it passes the 1st and last side, it wont be able to check them again.
Example...
I am creating a new sorting algorithm as a machine problem and i encounter difficulties.
The logic of my said the said algorithm is to create an array by inputing the total numbers to be accepted followed by the array variables and sorting it ascending or descending. The array would be sorted...
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.