WDI-SEA / insertion-sort

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GA Logo Insertion Sort


Your task for this deliverable is to research and implement the Insertion Sort Algorithm.

Getting Started

  • fork and clone this repo
  • use sort.py for your Insertion sort implementation
  • run python3 sort.py to check your work

A little Background

Insertion sort is a in place comparison sort, of the same breed as bubble sort and selection sort. Insertion sort has a high time complexity compared to some sorts, but a low space complexity and tends to be faster on large sets. It is suitable for situations where memery is a restricted resource.

This algorithm iterates over a set, assuming the first item in the set is sorted. It then checks each member of the set, and moves them to their proper sorted posisition.

Research time!

When learning a new algorithm, it is a good idea to do your best to understand it without immediately looking at source code. Why? It helps the learning process by working through the problem yourself.

Always try the following when learning a new algorithm to understand it most effectively:

  1. research and understand how the algorithm works
    • Searching for visualizations of the algorithm can be a BIG HELP
  2. break the algorithm down into steps, 'rubber ducking' or talking through the algorithm aloud can be a great help
  3. recreate the algorithmic steps in your physical space, for example use a deck of cards to execute each step of the alhgorithm
  4. write the alogorithm out using pseudocode, try rubber ducking as you do this
  5. implement the pseudocode code you wrote and test your code, try to think of edge cases that you need to test and account for
  6. if something isn't working, loop back to step 1.
  7. this is hard...take breaks for your mental and physical health!

Licensing

  1. All content is licensed under a CC-BY-NC-SA 4.0 license.
  2. All software code is licensed under GNU GPLv3. For commercial use or alternative licensing, please contact legal@ga.co.

About

License:Other


Languages

Language:Python 100.0%