GithubHelp home page GithubHelp logo

m4-dq5-observing-selection-and-insertion-sort-nyc-web-051418's Introduction

Sort!

All you need to focus on is writing two sorting algorithms. One in sorts/insertionSort.js and the other in sorts/selectionSort.js.

  1. for every item in the collection
  2. find the smallest item in the unsorted portion of the array and swap it with the current item
  1. for every item in the collection
  2. check if the previous item is greater than the current item
  3. if greater, the current item is not in place: swap it with the previous item and repeat

Open index.html to see your sorting algorithm played back to you visually in the browser:

  • A red flash indicates that an array element has been written
  • A green flash indicates that an array element has been read

Here is how your solution may look:

Alt Text

Deliverables

  • Write insertion and selection sort in the ./src directory
  • Discuss an explanation for the different speeds of the sorts
  • Understanding that one visual action (either a read or write) is occurring for each array every unit of time (e.g. they have always completed the same amount of actions at any given point), discuss what this is an accurate, and inaccurate, time representation of.
  • Provide an explanation for how both changes in array sizes as well as changes in how scrambled the arrays are would affect performance for the sorting algorithms

Tips

  • Feel free to alter the size of the arrays and duration of the steps in config.js

m4-dq5-observing-selection-and-insertion-sort-nyc-web-051418's People

Contributors

danielseehausen avatar

Watchers

 avatar Rishikesh Tirumala avatar James Cloos avatar  avatar Victoria Thevenot avatar  avatar Joe Cardarelli avatar Sam Birk avatar Sara Tibbetts avatar The Learn Team avatar Sophie DeBenedetto avatar  avatar Antoin avatar Alex Griffith avatar  avatar Amanda D'Avria avatar  avatar A. Perez avatar Nicole Kroese  avatar Lisa Jiang avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.