Git Product home page Git Product logo

list-mini-katas's Introduction

List mini katas

Preparing the way for sort and search.

  • What is algorithmic thinking?
  • What is an algorithm?
  • What is a data structure?
  • What data structures have you used?
  • How are data structures and algorithms related?
  • How do you navigate a data structure?

Mini katas

Write code and unit tests for the functions below.

Clone this repo and run the unit tests with mocha. The tests needs fixing.

Swap first two

Create a function:

  • That takes a list as a parameter.
  • Swap the first and the second entry in the list.
  • And returns the resulting list.

Given a list :

['apple', 'pear', 'mango', 'banana'];

It should return :

['pear', 'apple', 'mango', 'banana'];

Swap first and last

Create a function:

  • That takes a list as a parameter.
  • And swap the first and the last entry in the list.
  • And returns the resulting list.

Given a list :

['apple', 'pear', 'mango', 'banana']

It should return :

['banana', 'pear', 'mango', 'apple']

Know they neighbour

Create a function that:

  • takes a list of numbers;
  • loops through the numbers;
  • compares each number with its neighbour to the right;
  • if a number is bigger than its neighbour on the right, it should swap with its neighbour.
  • returns the resulting list.

What is the result of this function? Where does the biggest number ends up?

Use this data :

    [5, 19, 7, 17, 6, 1, 3]

list-mini-katas's People

Contributors

codex-avee avatar

Watchers

James Cloos 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.