psuedocoded some stuff while multitasking

This commit is contained in:
booboy 2019-05-11 01:04:35 -05:00
parent 3943d0c8f2
commit 30a10892eb

View file

@ -1,7 +1,6 @@
module Algorithms
class Sorting
def selection(a)
# a is an Array
def selection(array)
# from: https://www.tutorialspoint.com/data_structures_algorithms/selection_sort_algorithm.htm
# Step 1 Set MIN to location
# Step 2 Search the minimum element in the list
@ -9,15 +8,15 @@ module Algorithms
# Step 4 Increment MIN to point to next element
# Step 5 Repeat until list is sorted
counter = 0
max = a.length
# set a max
max = array.max
a.map do |item|
#binding.pry
counter += 1
end
end
# set the index of the min and use it with pop to make new array
index_of_min = array.index(array.min)
almost_sorted_array = array.pop(index_of_min)
incremented_index = array[index_of_min + 1]
end
def insertion
end