Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 13557
1 vote

What is wrong with my sorting algorithm?

Aren't you using smallell here without initializing it first? if (values [j] < values [smallell]) I only saw you declaring smallel here, but you never assigned a value to it: int smallell;
Yuri Laguardia's user avatar
0 votes
Accepted

What is wrong with my sorting algorithm?

Other than that, there are two other problems. First, you're stopping your loops one element shorter than what you should be doing. You're using i < n - 1 and j < n -1 when you should be using eithe …
Yuri Laguardia's user avatar