Open main menu
Home
Random
Log in
Settings
About Conservapedia
Disclaimers
Conservapedia
Search
Changes
← Older edit
Newer edit →
Insertion sort
(view source)
Revision as of 16:16, July 3, 2007
No change in size
,
16:16, July 3, 2007
m
→Pseudocode
Line 10:
Line 10:
'''while''' y > -1 '''and''' Vals(x) > nextval //go through all the values to left and compare, the inequality sign will
'''while''' y > -1 '''and''' Vals(x) > nextval //go through all the values to left and compare, the inequality sign will
//vary based upon the sorting type (nondecreasing or nonincreasing)
//vary based upon the sorting type (nondecreasing or nonincreasing)
−
Vals(y + 1) = Vals(
i
) //compare the value to the left because the conditions haven't been met yet
+
Vals(y + 1) = Vals(
x
) //compare the value to the left because the conditions haven't been met yet
y-- //decrease the counter
y-- //decrease the counter
Vals(y + 1) = nextval //store the value in the right position
Vals(y + 1) = nextval //store the value in the right position
Mutant
3
edits