Socket
Book a DemoInstallSign in
Socket

fastsort

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

fastsort

0.1.6
bundlerRubygems
Version published
Maintainers
1
Created
Source

Fastsort

Fastsort is a Ruby gem that provides an efficient sorting algorithm for arrays.

Installation

Add this line to your application's Gemfile:

$ gem install 'fastsort'
$ bundle install

TODO

Add more efficient sorting algorithms for arrays and arrays of objects...

Example usage

require 'fastsort'

arr = [
  75, 79, 21, 30, 12, 85, 24, 6, 66, 69,
  92, 98, 18, 57, 40, 71, 92, 14, 1, 79,
  15, 21, 55, 83, 45, 34, 25, 67, 9, 75,
  83, 75, 99, 10, 41, 63, 79, 22, 80, 7,
  38, 87, 31, 93, 60, 53, 39, 59, 67, 97
]

bucket_size = 10

sorter001 = Fastsort::Quicksort.new(arr)
sorter002 = Fastsort::Mergesort.new(arr)
sorter003 = Fastsort::Sonicsort.new(arr)
sorter004 = Fastsort::SelectionSort.new(arr)
sorter004 = Fastsort::BubbleSort.new(arr)
sorter006 = Fastsort::BucketSort.new(arr, bucket_size)
sorter007 = Fastsort::InsertionSort.new(arr)

sorter001.sort_array
sorter002.sort_array
sorter003.sort_quick_and_merge
sorter004.sort_array
sorter005.sort_array
sorter006.sort_array
sorter007.sort_array

puts "Sorted Array Quicksort: #{sorter_001.array}"
puts "Sorted Array Mergesort: #{sorter_002.array}"
puts "Sorted Array Sonicsort: #{sorter_003.array}"
puts "Sorted Array SelectionSort: #{sorter_004.array}"
puts "Sorted Array BubbleSort: #{sorter_005.array}"
puts "Sorted Array BucketSort: #{sorter_006.array}"
puts "Sorted Array InsertionSort: #{sorter_007.array}"




Development

After checking out the repo, run bin/setup to install dependencies. You can also run bin/console for an interactive prompt that will allow you to experiment.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/dants0/fastsort.

FAQs

Package last updated on 05 Jan 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

About

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.

  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc

U.S. Patent No. 12,346,443 & 12,314,394. Other pending.