English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

3 answers

The flag is used to determine when all the items have been sorted. As you go through each pass of the list, if a swap is made, the flag is set to true. It is saying "Yes there was a swap made this pass"

If there was a swap, you have to go back through the list. Once all the items have been sorted correctly, the flag will never be set to true and it tells your loop "yes, this list is now sorted" and then the function can leave the loop.

That is the only purpose it has, just to stop your loop once all items have been sorted. It will know that all items have been sorted when the flag is false (there were no swaps made).

Hope this helps you out. Good luck with your programming.

2006-10-22 11:58:12 · answer #1 · answered by Martyr2 7 · 0 0

The sort in incomplete. An element has been found that is greater than (ascending list, for example) or less than (descending list) the particular record.

2006-10-22 16:22:45 · answer #2 · answered by ideogenetic 7 · 1 0

a what in a who

2006-10-22 16:21:52 · answer #3 · answered by dumbdumb 4 · 0 1

fedest.com, questions and answers