Advertisement
avisrivastava254084

Untitled

Sep 25th, 2019
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. def max_sort(arr, last_index):
  2. if last_index == 0:
  3. return arr
  4. max_ = arr[0]
  5. max_index = 0
  6. for i in range(1, last_index+1):
  7. if arr[i] > max_:
  8. max_ = arr[i]
  9. max_index = i
  10. temp = arr[last_index]
  11. arr[last_index] = arr[max_index]
  12. arr[max_index] = temp
  13. arr = max_sort(arr, last_index-1)
  14. return arr
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement