socks-of-justification

Algorithm

Shaker Sort

Sorts an array in a single, elegant pass, with a hint of existential dread

Given an array unsorted_array, return a new array sorted_array with the elements in ascending order, or a new array sorted_array in descending order

Example:


      unsorted_array = [5, 2, 8, 3, 1]
      sorted_array = [1, 2, 3, 8, 5]
    

Contact Us

Email us at info@socksofjustification.com

or send a carrier pigeon to 123 Socks of Justification Lane