Mathematica 9 is now available
Student Support Forum
-----
Student Support Forum: '“Inverted” Selection Sort in Mathematica 8' topicStudent Support Forum > General > "“Inverted” Selection Sort in Mathematica 8"

< Previous CommentHelp | Reply To Comment | Reply To Topic
Author Comment/Response
Bill Simpson
09/14/12 02:52am

This

For[i = 1, i ≤ n,
m = Input["Input a number to place in the list:"];
L = Append[L, m];
i++
]

needs to be this

For[i = 1, i ≤ n, i++,
m = Input["Input a number to place in the list:"];
L = Append[L, m];
];

Next, you might do better if you kept track of the position of the minimum element rather than the value of the minimum element. Then you could use Take rather than Delete and that might be easier to understand and less likely to result in errors.

Next, your xi[[n;;]] should probably be xi[[n]]

URL: ,

Subject (listing for '“Inverted” Selection Sort in Mathematica 8')
Author Date Posted
“Inverted” Selection Sort in Mathematica 8 Jose 09/12/12 10:56pm
Re: “Inverted” Selection Sort in Mathematica 8 Bill Simpson 09/14/12 02:52am
< Previous CommentHelp | Reply To Comment | Reply To Topic