Commit fda54af5 authored by Owen Ilagan's avatar Owen Ilagan

Revision minor

parent 61b66fa9
...@@ -9,6 +9,7 @@ def sort_ascending(array) ...@@ -9,6 +9,7 @@ def sort_ascending(array)
sub_array = result[index+1..-1] sub_array = result[index+1..-1]
sub_index = 0 sub_index = 0
sub_array.each do sub_array.each do
# Swap elements when lower value found
if sub_array[sub_index] < result[index] if sub_array[sub_index] < result[index]
temp = result[index] temp = result[index]
result[index] = sub_array[sub_index] result[index] = sub_array[sub_index]
...@@ -35,6 +36,7 @@ def sort_descending(array) ...@@ -35,6 +36,7 @@ def sort_descending(array)
sub_array = result[index+1..-1] sub_array = result[index+1..-1]
sub_index = 0 sub_index = 0
sub_array.each do sub_array.each do
# Swap elements when higher value found
if sub_array[sub_index] > result[index] if sub_array[sub_index] > result[index]
temp = result[index] temp = result[index]
result[index] = sub_array[sub_index] result[index] = sub_array[sub_index]
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment