kibo-rb 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5174ee8f575e6cb3b2ec3e4ac2186fc4a0cce60f
4
- data.tar.gz: f51f8002b532f67e7c32fa13d88b75c162757133
3
+ metadata.gz: aa812fe79975eeef4edaed4b21b30b6d6fbb3757
4
+ data.tar.gz: 9d15736917ff7068172fe36514be28bcd9ec7763
5
5
  SHA512:
6
- metadata.gz: 147bbff3848a3c003a2bb2b290b433e07f1d5daf04c6b6c94af8f4065049eef6b1f410e17be5af1a53445ea87288f77fe704c2485f80ef8148f9475e9974c887
7
- data.tar.gz: b8c0e7e3160851970ed7982dde4e916cdfc830e7155cffe0fa953c9773f81b7d98da1f6f9a0dc8b94bdc72723700e61742c93d64eed5087ef31ad7b53e0f25e3
6
+ metadata.gz: e04809a20416cf895dccda5e156a028361bf26acccab87bd4b0c48de0d0f407d0119f9f12717e2e21de6be1d44e748a0c0a0c66e5550beb11779117626802277
7
+ data.tar.gz: 9812e765944cd6628c3558f1bdcca058e138528fb83bab8a361b6e9038dc9fb7b126a0fa7bc02df462118d4836f8fd43668b8cfcdbeea7a92004e12090a023aa
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kibo-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - oelizondo
@@ -46,19 +46,7 @@ executables: []
46
46
  extensions: []
47
47
  extra_rdoc_files: []
48
48
  files:
49
- - ".gitignore"
50
- - Gemfile
51
- - LICENSE.txt
52
- - README.md
53
- - Rakefile
54
- - bin/console
55
- - bin/setup
56
- - kibo.gemspec
57
49
  - lib/kibo.rb
58
- - lib/kibo/kibo_native.rb
59
- - lib/kibo/search.rb
60
- - lib/kibo/sort.rb
61
- - lib/kibo/version.rb
62
50
  homepage: https://github.com/oelizondo/Kibo
63
51
  licenses:
64
52
  - MIT
data/.gitignore DELETED
@@ -1,9 +0,0 @@
1
- /.bundle/
2
- /.yardoc
3
- /Gemfile.lock
4
- /_yardoc/
5
- /coverage/
6
- /doc/
7
- /pkg/
8
- /spec/reports/
9
- /tmp/
data/Gemfile DELETED
@@ -1,4 +0,0 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in kibo.gemspec
4
- gemspec
data/LICENSE.txt DELETED
@@ -1,21 +0,0 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 oelizondo
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
data/README.md DELETED
@@ -1,60 +0,0 @@
1
- # Kibo
2
-
3
- Small API for sorting and finding elements in arrays and other data structures.
4
-
5
- ###What's so good about it?
6
-
7
- Almost everything is O(logn) or O(nlogn).
8
-
9
- ## Installation
10
-
11
- Add this line to your application's Gemfile:
12
-
13
- ```ruby
14
- gem 'kibo'
15
- ```
16
-
17
- And then execute:
18
-
19
- $ bundle
20
-
21
- Or install it yourself as:
22
-
23
- $ gem install kibo
24
-
25
- ## Usage
26
-
27
- Kibo is really easy to use, you just have to:
28
-
29
- ```ruby
30
- Kibo::Search.bsearch(your_array, your_element)
31
- ```
32
-
33
- Kibo also comes with a Native option
34
-
35
- ```ruby
36
- require 'kibo_native'
37
-
38
- a = (1..1_000_000).to_a
39
- a.binsearch(563_321)
40
- ```
41
-
42
- Kibo Native overrides the Array class to include the method ```binsearch``` so you don't have to make additional objects.
43
- Kibo will return true if the element exists in your array. Right now, ```.sbearch``` method only works wih integers, other data types will come later!
44
-
45
- ## Benchmarks
46
-
47
- Write benchmarks
48
-
49
- ##TODO
50
-
51
- * Write benchmarks for all methods
52
- * Wrtie tests for all methods
53
- * Implement sorts
54
- * Implement other search methods
55
-
56
-
57
- ## License
58
-
59
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
60
-
data/Rakefile DELETED
@@ -1,2 +0,0 @@
1
- require "bundler/gem_tasks"
2
- task :default => :spec
data/bin/console DELETED
@@ -1,14 +0,0 @@
1
- #!/usr/bin/env ruby
2
-
3
- require "bundler/setup"
4
- require "kibo"
5
-
6
- # You can add fixtures and/or initialization code here to make experimenting
7
- # with your gem easier. You can also use a different console, if you like.
8
-
9
- # (If you use this, don't forget to add pry to your Gemfile!)
10
- # require "pry"
11
- # Pry.start
12
-
13
- require "irb"
14
- IRB.start
data/bin/setup DELETED
@@ -1,8 +0,0 @@
1
- #!/usr/bin/env bash
2
- set -euo pipefail
3
- IFS=$'\n\t'
4
- set -vx
5
-
6
- bundle install
7
-
8
- # Do any other automated setup that you need to do here
data/kibo.gemspec DELETED
@@ -1,24 +0,0 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'kibo/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "kibo-rb"
8
- spec.version = Kibo::VERSION
9
- spec.authors = ["oelizondo"]
10
- spec.email = ["oscarmarcelo95@gmail.com"]
11
-
12
- spec.summary = %q{Kibo is a small library that implements classic algorithms like binary search, sorts, etc..}
13
- spec.description = %q{Kibo is a small library that implements classic algorithms like binary search, merge, sort, bubble sorts, etc..}
14
- spec.homepage = "https://github.com/oelizondo/Kibo"
15
- spec.license = "MIT"
16
-
17
- spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
18
- spec.bindir = "exe"
19
- spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
20
- spec.require_paths = ["lib"]
21
-
22
- spec.add_development_dependency "bundler", "~> 1.11"
23
- spec.add_development_dependency "rake", "~> 10.0"
24
- end
@@ -1,25 +0,0 @@
1
- class Array
2
- def binsearch(element)
3
- higher = self.length
4
- lower = 0
5
- half = higher / 2
6
- not_done = true
7
-
8
- return false if !element.is_a? Integer
9
- return false if self[self.length-1] < element
10
-
11
- while not_done
12
- if element == self[half]
13
- not_done = false
14
- elsif element < self[half]
15
- higher = half
16
- half = (half - lower) / 2
17
- else
18
- lower = half
19
- half = (higher + lower) / 2
20
- end
21
- end
22
-
23
- true
24
- end
25
- end
data/lib/kibo/search.rb DELETED
@@ -1,29 +0,0 @@
1
- module Kibo
2
- class Search
3
-
4
- def self.bsearch(arr, element)
5
- higher = arr.length
6
- lower = 0
7
- half = higher / 2
8
- not_done = true
9
-
10
- return false if !element.is_a? Integer
11
- return false if arr[arr.length-1] < element
12
-
13
- while not_done
14
- if element == arr[half]
15
- not_done = false
16
- elsif element < arr[half]
17
- higher = half
18
- half = (half - lower) / 2
19
- else
20
- lower = half
21
- half = (higher + lower) / 2
22
- end
23
- end
24
-
25
- true
26
- end
27
-
28
- end
29
- end
data/lib/kibo/sort.rb DELETED
@@ -1,25 +0,0 @@
1
- module Kibo
2
- class Sort
3
- def initialize(arr, type)
4
- case type
5
- when 'merge'
6
- eval("Merge.new(#{arr})")
7
- when 'quick'
8
- eval("Quick.new(#{arr})")
9
- end
10
- end
11
- end
12
-
13
- class Merge
14
- def initialize(arr)
15
- @arr = arr
16
- end
17
- end
18
-
19
- class Quick
20
- def initialize(arr)
21
- @arr = arr
22
- end
23
- end
24
-
25
- end
data/lib/kibo/version.rb DELETED
@@ -1,3 +0,0 @@
1
- module Kibo
2
- VERSION = "0.1.3"
3
- end