GithubHelp home page GithubHelp logo

algorithm-sg's Introduction

About Algorithm-SG

This repo contains code used for a Learn.co study group on various algorithms and implementation in Ruby.

About quicksort

QuickSort study group, 6 Mar 2017:

About quicksort1.rb

The code in quicksort1.rb is a sample implementation of the quicksort algorithm. The inplace_quicksort method is defined to accept arguments of an array, left index, and right index. The indices effectively define the length of the array to be sorted. The partition_array method accepts an array as an argument, and uses a divide-and-conquer paradigm to reorganize the passed array into two groups, based on a pivot value. Values greater than the pivot are grouped to the right of the pivot's index, and values less than the pivot are grouped to the left.

About quicksort2.rb

The code in quicksort2.rb defines quicksort as an Array class method, so that the method may be called directly on an Array object. This implementation of quicksort uses native Ruby methods in the Array and Enumerable modules.

About mergesort

Merge sort study group, 17 April 2017:

About mergesort.rb

The code in mergesort.rb is a sample implementation of the mergesort algorithm. The mergesort method accepts an array as an argument, and recursively divides the array in half, until the resulting subarrays have 1 or fewer elements. The merge method accepts the left- and right-half sorted subarrays, and merges the subarrays into a sorted combined array.

About mergesort2.rb

This code is an attempt to implement mergesort as an Array class method.

algorithm-sg's People

Contributors

christinalcole avatar

Stargazers

Jacilyn Hayden avatar

Watchers

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