Skip to content

Instantly share code, notes, and snippets.

@aa-ahmed-aa
Last active December 28, 2015 17:43
Show Gist options
  • Save aa-ahmed-aa/e18e24af13a89eb1fbe2 to your computer and use it in GitHub Desktop.
Save aa-ahmed-aa/e18e24af13a89eb1fbe2 to your computer and use it in GitHub Desktop.
//loop from the (begining) to the (size-1) index = c
{
//save the current index in position
//search for the greater element loop from (begining+1) to (size) index = d
{
//look for smaller element
//if the current element[d] is less than the element[position]
//change the saved index with the smaller element index (d)
}
//if the position has been changed
//swap the element of index position with the element of index c smaller with greater
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment