0.0
No commit activity in last 3 years
No release in over 3 years
Algorithm and data structure
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 1.3
>= 0
 Project Readme

KimquyAlgo

I created a simple ruby gem for sorting algorithms:

  • insertion sort
  • merge sort
  • quick sort
  • bubble sort
  • selection sort
  • knuth_shuffle (shuffle an array)
  • shell sort (3-h shell sort)
  • updating more stuff ...

Example

	require 'kimquy_algo'
	require 'benchmark'

	arr = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]
	puts Benchmark.measure { arr.insertion_sort }


	arr = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]
	puts Benchmark.measure {arr.quicksort }


	arr = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]
	puts Benchmark.measure {arr.bubble_sort}


	arr = [20,19,18,17,16,15,14,13,12,11,10,9,8,7,6,5,4,3,2,1]
	puts Benchmark.measure {arr.selection_sort}

##Performance result
		0.000000   0.000000   0.000000 (  0.000120)
  	0.000000   0.000000   0.000000 (  0.000038)   (quicksort won!)
  	0.000000   0.000000   0.000000 (  0.000108)
  	0.000000   0.000000   0.000000 (  0.000068)

Installation

Add this line to your application's Gemfile:

gem 'kimquy_algo'

And then execute:

$ bundle

Or install it yourself as:

$ gem install kimquy_algo