ruby-heap 0.2.2 → 1.0.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
- SHA1:
3
- metadata.gz: c9974abcd60bd8451a0b255d5a92a5662f017643
4
- data.tar.gz: 619d3a2efe5beb55f18451dfef513a55deb10255
2
+ SHA256:
3
+ metadata.gz: a75592e069ff9bc6d12e7c4edd27c564a49a17c8f60e13a40bb53a79c533a2f8
4
+ data.tar.gz: 243c19ac2859deddf570ab38ebd1f6c9d8962f482f69f7a114117a9590035bd9
5
5
  SHA512:
6
- metadata.gz: 0a49cc38bbdcb3d910ec6a80487bd6ff3fdbc7f9a5171d1a19e50db844702fa31b1320d78ab07f3496d0352c30ffe88f99829f655b01d24fefc57675b5a9e7e5
7
- data.tar.gz: 3eb7d687cad878bf3d38bc7e373d21e8d6d132b5fa6604a2254aebc394874c4c48b1c554e2c78d6f590ed63f8e87d925d5022557448b345124f045c7d5311a1a
6
+ metadata.gz: 2895bb61d6f02985c73fe5c392f6781c28797c04f42335d421e3b909055446cdb3f4e968ca85671ad07eaac8d996de988efce9406add86b91b9fff573b6e7649
7
+ data.tar.gz: cf5588e1671b4e6b2bb93821d937680bb441520e9a1818e42499a770a192dbff265decede40fadd284760420eddd4371db11936129f5ba61c7e3eceef2aa9189
data/.gitignore CHANGED
@@ -1,6 +1,5 @@
1
1
  /.bundle/
2
2
  /.yardoc
3
- /Gemfile.lock
4
3
  /_yardoc/
5
4
  /coverage/
6
5
  /doc/
@@ -8,3 +7,4 @@
8
7
  /spec/reports/
9
8
  /tmp/
10
9
  /.idea/
10
+ *.gem
data/.tool-versions ADDED
@@ -0,0 +1 @@
1
+ ruby 2.7.1
data/Gemfile.lock ADDED
@@ -0,0 +1,22 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ ruby-heap (1.0.2)
5
+
6
+ GEM
7
+ remote: https://rubygems.org/
8
+ specs:
9
+ minitest (5.14.4)
10
+ rake (13.0.6)
11
+
12
+ PLATFORMS
13
+ x86_64-darwin-20
14
+
15
+ DEPENDENCIES
16
+ bundler (>= 2.2.10)
17
+ minitest (~> 5.0)
18
+ rake (~> 13.0)
19
+ ruby-heap!
20
+
21
+ BUNDLED WITH
22
+ 2.2.29
data/Heap.gemspec CHANGED
@@ -1,5 +1,3 @@
1
- # coding: utf-8
2
-
3
1
  lib = File.expand_path('../lib', __FILE__)
4
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
3
  require 'Heap/version'
@@ -21,7 +19,7 @@ Gem::Specification.new do |spec|
21
19
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
22
20
  spec.require_paths = ['lib']
23
21
 
24
- spec.add_development_dependency 'bundler', '~> 1.14'
25
- spec.add_development_dependency 'rake', '~> 10.0'
22
+ spec.add_development_dependency 'bundler', '~> 2.2', '>= 2.2.10'
23
+ spec.add_development_dependency 'rake', '~> 13.0'
26
24
  spec.add_development_dependency 'minitest', '~> 5.0'
27
25
  end
data/README.md CHANGED
@@ -1,6 +1,12 @@
1
- # Heap (ruby heapsort)
1
+ [![Gem Version](https://badge.fury.io/rb/ruby-heap.svg)](https://badge.fury.io/rb/ruby-heap)
2
+ [![Gem](https://img.shields.io/gem/dt/ruby-heap.svg)](https://rubygems.org/gems/ruby-heap)
3
+ [![Build Status](https://travis-ci.org/pups3s/ruby-heap.svg?branch=master)](https://travis-ci.org/pups3s/ruby-heap)
4
+ [![Code Climate](https://codeclimate.com/github/pups3s/ruby-heap/badges/gpa.svg)](https://codeclimate.com/github/pups3s/ruby-heap)
5
+
6
+ [Русская версия](README_ru.md)
2
7
 
3
- Gem is using for making Heaps (binary only for now).
8
+ # Heap (ruby heapsort)
9
+ Gem is using for making Heaps.
4
10
 
5
11
  ## Installation
6
12
 
@@ -20,6 +26,8 @@ Or install it yourself as:
20
26
 
21
27
  ## Usage
22
28
 
29
+ ### Binary Heaps
30
+
23
31
  #### Binary Heap with min root
24
32
  While Heap initialize you can add any comparable object in it (not numbers only).
25
33
  Objects must have compare functions (>, >=, <, <=).
@@ -72,10 +80,10 @@ b_heap.sort # [3, 2, 1, -1]
72
80
  # Count of elements in Heap
73
81
  b_heap.count # 4
74
82
 
75
- # Return min element without removing from Heap
83
+ # Return max element without removing from Heap
76
84
  b_heap.extract_max # 3
77
85
 
78
- # Return min element and remove it from Heap
86
+ # Return max element and remove it from Heap
79
87
  b_heap.extract_max! # 3
80
88
  b_heap.count # 3
81
89
  b_heap.elements # [2, -1, 1]
@@ -99,19 +107,28 @@ max_heap = Heap::BinaryHeap::MaxHeap.new [9, -1, 4]
99
107
  # Merge heaps
100
108
  min_heap.add max_heap
101
109
 
110
+ min_heap.count # 6
111
+ min_heap.sort # [-1, 1, 2, 3, 4, 9]
102
112
  ```
103
113
 
104
- ## Development
114
+ ### Multiple Heaps
105
115
 
106
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
116
+ Multiple (d-ary) heaps have **same methods as binary**. But initialize differs:
107
117
 
108
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
118
+ ```ruby
119
+ require 'Heap'
120
+
121
+ # First param is "d" of heap
122
+ # Second param is optional and can contain first elements
123
+ min_heap = Heap::MultipleHeap::MinHeap.new(5, [10, 20, 30])
124
+ max_heap = Heap::MultipleHeap::MaxHeap.new(7)
125
+ ```
109
126
 
110
127
  ## Contributing
111
128
 
112
- Bug reports and pull requests are welcome on GitHub at [Project page](https://github.com/pups3s/ruby-heap). This project is intended to be a safe, welcoming space for collaboration.
129
+ Bug reports and pull requests are welcome on GitHub at [Project page](https://github.com/pups3s/ruby-heap).
113
130
 
114
131
 
115
132
  ## License
116
133
 
117
- The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
134
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
data/README_ru.md ADDED
@@ -0,0 +1,131 @@
1
+ [![Gem Version](https://badge.fury.io/rb/ruby-heap.svg)](https://badge.fury.io/rb/ruby-heap)
2
+ [![Code Climate](https://codeclimate.com/github/pups3s/ruby-heap/badges/gpa.svg)](https://codeclimate.com/github/pups3s/ruby-heap)
3
+ # Heap (ruby сортировка кучей)
4
+ Библиотека используется для создания бинарной или d-ичной кучи (Heap).
5
+
6
+ ## Установка
7
+
8
+ Добавьте данную строчку в Gemfile Вашего приложения:
9
+
10
+ ```ruby
11
+ gem 'ruby-heap'
12
+ ```
13
+
14
+ Затем выполните:
15
+
16
+ $ bundle
17
+
18
+ Или установите библиотеку отдельно, выполнив:
19
+
20
+ $ gem install ruby-heap
21
+
22
+ ## Использование
23
+
24
+ ### Двоичные кучи
25
+
26
+ #### Двоичная куча с минимальным корнем
27
+ Во время инициализации (и после создания кучи) Вы можете добавить в нее любые сравниваемые объекты (не только числа).
28
+ Используемые объекты должны иметь функции сравнения (>, >=, <, <=).
29
+ ```ruby
30
+ require 'Heap'
31
+
32
+ # Инициализация
33
+ b_heap = Heap::BinaryHeap::MinHeap.new([2, 3, 1, -1])
34
+
35
+ # Получение элементов кучи (доступ только для чтения)
36
+ b_heap.elements # [-1, 1, 3, 2]
37
+
38
+ # Получение отсортированных элементов кучи без
39
+ # изменения её элементов
40
+ b_heap.sort # [-1, 1, 2, 3]
41
+
42
+ # Количество элементов в куче
43
+ b_heap.count # 4
44
+
45
+ # Получение минимального элемента без удаления его из кучи
46
+ b_heap.extract_min # -1
47
+
48
+ # Получение минимального элемента и его удаление из кучи
49
+ b_heap.extract_min! # -1
50
+ b_heap.count # 3
51
+ b_heap.elements # [1, 2, 3]
52
+
53
+ # Также Вы можете добавить новые элементы с помощью
54
+ # функции add
55
+ b_heap.add -1
56
+ b_heap.elements # [-1, 1, 3, 2]
57
+ b_heap.add [0, 9, 200, -15, 6]
58
+ b_heap.elements # [-15, -1, 3, 0, 1, 9, 200, 2, 6]
59
+ b_heap.sort # [-15, -1, 0, 1, 2, 3, 6, 9, 200]
60
+ ```
61
+
62
+ #### Те же действия с кучей (с максимальным корнем)
63
+ ```ruby
64
+ require 'Heap'
65
+
66
+ # Инициализация
67
+ b_heap = Heap::BinaryHeap::MaxHeap.new([2, 3, 1, -1])
68
+
69
+ # Получение элементов кучи (доступ только для чтения)
70
+ b_heap.elements # [3, 2, 1, -1]
71
+
72
+ # Получение отсортированных элементов кучи без
73
+ # изменения её элементов
74
+ b_heap.sort # [3, 2, 1, -1]
75
+
76
+ # Количество элементов в куче
77
+ b_heap.count # 4
78
+
79
+ # Получение максимального элемента без удаления его из кучи
80
+ b_heap.extract_max # 3
81
+
82
+ # Получение максимального элемента и его удаление из кучи
83
+ b_heap.extract_max! # 3
84
+ b_heap.count # 3
85
+ b_heap.elements # [2, -1, 1]
86
+
87
+ # Также Вы можете добавить новые элементы с помощью
88
+ # функции add
89
+ b_heap.add -1
90
+ b_heap.elements # [2, -1, 1, -1]
91
+ b_heap.add [0, 9, 200, -15, 6]
92
+ b_heap.elements # [200, 6, 9, 0, -1, 1, 2, -15, -1]
93
+ b_heap.sort # [200, 9, 6, 2, 1, 0, -1, -1, -15]
94
+ ```
95
+
96
+ #### Слияние куч
97
+ ```ruby
98
+ require 'Heap'
99
+
100
+ # Инициализация
101
+ min_heap = Heap::BinaryHeap::MinHeap.new [1, 2, 3]
102
+ max_heap = Heap::BinaryHeap::MaxHeap.new [9, -1, 4]
103
+
104
+ # Слияние
105
+ min_heap.add max_heap
106
+
107
+ min_heap.count # 6
108
+ min_heap.sort # [-1, 1, 2, 3, 4, 9]
109
+ ```
110
+
111
+ ### Многомерные кучи
112
+
113
+ Многомерные (d-ичные) кучи имеют **те же методы, что и бинарные**. Однако, отличается инициализация:
114
+
115
+ ```ruby
116
+ require 'Heap'
117
+
118
+ # Первый параметр - измерение кучи (d)
119
+ # Второй параметр опционален и может содержать первые элементы в куче
120
+ min_heap = Heap::MultipleHeap::MinHeap.new(5, [10, 20, 30])
121
+ max_heap = Heap::MultipleHeap::MaxHeap.new(7)
122
+ ```
123
+
124
+ ## Вклад в проект
125
+
126
+ **Баг репорты** и **pull реквесты** приветствуются на GitHub [Страница проекта](https://github.com/pups3s/ruby-heap).
127
+
128
+
129
+ ## Лицензия
130
+
131
+ Библиотека является open source и регламентируется [MIT License](http://opensource.org/licenses/MIT).
@@ -0,0 +1,23 @@
1
+ module Heap
2
+ module BinaryHeap
3
+ # Binary Heap template
4
+ class BinaryHeap < HeapTemplate
5
+
6
+ protected
7
+
8
+ def initialize(elements = [])
9
+ @elements = []
10
+ add(elements.pop) until elements.empty?
11
+ end
12
+
13
+ def get_children(index)
14
+ child1 = 2 * index
15
+ child2 = 2 * index + 1
16
+ children = {}
17
+ children[@elements[child1 - 1]] = child1 unless @elements[child1 - 1].nil?
18
+ children[@elements[child2 - 1]] = child2 unless @elements[child2 - 1].nil?
19
+ children
20
+ end
21
+ end
22
+ end
23
+ end
@@ -1,93 +1,32 @@
1
1
  module Heap
2
2
  module BinaryHeap
3
- class MaxHeap
4
- attr_reader :elements
5
-
6
- def initialize(elements = [])
7
- @elements = []
8
- add(elements.pop) until elements.empty?
9
- end
10
-
11
- def add(element)
12
- if element.is_a? Array
13
- element.each do |el|
14
- @elements.push el
15
- swim_up(count)
16
- end
17
- elsif defined? element.elements
18
- add element.elements
19
- else
20
- @elements.push element
21
- swim_up(count)
22
- end
23
- end
24
-
25
- def count
26
- @elements.length
27
- end
28
-
3
+ # Binary Heap with max root
4
+ class MaxHeap < BinaryHeap
29
5
  def extract_max
30
- @elements[0]
6
+ extract_root
31
7
  end
32
8
 
33
9
  def extract_max!
34
- swap(1, count)
35
- el = @elements.pop
36
- swim_down(1)
37
- el
38
- end
39
-
40
- def sort
41
- el_temp = @elements.clone
42
- result = []
43
- result.push extract_max! while count > 0
44
- @elements = el_temp
45
- result
10
+ extract_root!
46
11
  end
47
12
 
48
13
  private
49
14
 
50
- def swap(index1, index2)
51
- temp = @elements[index1 - 1]
52
- @elements[index1 - 1] = @elements[index2 - 1]
53
- @elements[index2 - 1] = temp
54
- end
55
-
56
15
  def swim_up(index)
57
16
  return if index == 1
58
- parent_index = (index / 2).floor
17
+ parent_index = index / 2
59
18
  return if @elements[parent_index - 1] >= @elements[index - 1]
60
19
  swap(parent_index, index)
61
20
  swim_up parent_index
62
21
  end
63
22
 
64
23
  def swim_down(index)
65
- child1_index = 2 * index
66
- child2_index = 2 * index + 1
67
- return if @elements[child1_index - 1].nil? && @elements[child2_index - 1].nil?
68
- if @elements[child2_index - 1].nil?
69
- return if @elements[child1_index - 1] <= @elements[index - 1]
70
- swap(index, child1_index)
71
- swim_down(child1_index)
72
- else
73
- if @elements[child2_index - 1] <= @elements[index - 1] && @elements[child1_index - 1] <= @elements[index - 1]
74
- return
75
- elsif @elements[child2_index - 1] > @elements[index - 1] && @elements[child1_index - 1] > @elements[index - 1]
76
- if @elements[child2_index - 1] > @elements[child1_index - 1]
77
- swap(child2_index, index)
78
- swim_down(child2_index)
79
- else
80
- swap(child1_index, index)
81
- swim_down(child1_index)
82
- end
83
- elsif @elements[child2_index - 1] > @elements[index - 1]
84
- swap(child2_index, index)
85
- swim_down(child2_index)
86
- elsif @elements[child1_index - 1] > @elements[index - 1]
87
- swap(child1_index, index)
88
- swim_down(child1_index)
89
- end
90
- end
24
+ children = get_children(index)
25
+ return if children.empty?
26
+ max_child = children.max
27
+ return if @elements[index - 1] >= max_child[0]
28
+ swap index, max_child[1]
29
+ swim_down max_child[1]
91
30
  end
92
31
  end
93
32
  end
@@ -1,93 +1,32 @@
1
1
  module Heap
2
2
  module BinaryHeap
3
- class MinHeap
4
- attr_reader :elements
5
-
6
- def initialize(elements = [])
7
- @elements = []
8
- add(elements.pop) until elements.empty?
9
- end
10
-
11
- def add(element)
12
- if element.is_a? Array
13
- element.each do |el|
14
- @elements.push el
15
- swim_up(count)
16
- end
17
- elsif defined? element.elements
18
- add element.elements
19
- else
20
- @elements.push element
21
- swim_up(count)
22
- end
23
- end
24
-
25
- def count
26
- @elements.length
27
- end
28
-
3
+ # Binary Heap with min root
4
+ class MinHeap < BinaryHeap
29
5
  def extract_min
30
- @elements[0]
6
+ extract_root
31
7
  end
32
8
 
33
9
  def extract_min!
34
- swap(1, count)
35
- el = @elements.pop
36
- swim_down(1)
37
- el
38
- end
39
-
40
- def sort
41
- el_temp = @elements.clone
42
- result = []
43
- result.push extract_min! while count > 0
44
- @elements = el_temp
45
- result
10
+ extract_root!
46
11
  end
47
12
 
48
13
  private
49
14
 
50
- def swap(index1, index2)
51
- temp = @elements[index1 - 1]
52
- @elements[index1 - 1] = @elements[index2 - 1]
53
- @elements[index2 - 1] = temp
54
- end
55
-
56
15
  def swim_up(index)
57
16
  return if index == 1
58
- parent_index = (index / 2).floor
17
+ parent_index = index / 2
59
18
  return if @elements[parent_index - 1] <= @elements[index - 1]
60
19
  swap(parent_index, index)
61
20
  swim_up parent_index
62
21
  end
63
22
 
64
23
  def swim_down(index)
65
- child1_index = 2 * index
66
- child2_index = 2 * index + 1
67
- return if @elements[child1_index - 1].nil? && @elements[child2_index - 1].nil?
68
- if @elements[child2_index - 1].nil?
69
- return if @elements[child1_index - 1] >= @elements[index - 1]
70
- swap(index, child1_index)
71
- swim_down(child1_index)
72
- else
73
- if @elements[child2_index - 1] >= @elements[index - 1] && @elements[child1_index - 1] >= @elements[index - 1]
74
- return
75
- elsif @elements[child2_index - 1] < @elements[index - 1] && @elements[child1_index - 1] < @elements[index - 1]
76
- if @elements[child2_index - 1] < @elements[child1_index - 1]
77
- swap(child2_index, index)
78
- swim_down(child2_index)
79
- else
80
- swap(child1_index, index)
81
- swim_down(child1_index)
82
- end
83
- elsif @elements[child2_index - 1] < @elements[index - 1]
84
- swap(child2_index, index)
85
- swim_down(child2_index)
86
- elsif @elements[child1_index - 1] < @elements[index - 1]
87
- swap(child1_index, index)
88
- swim_down(child1_index)
89
- end
90
- end
24
+ children = get_children(index)
25
+ return if children.empty?
26
+ max_child = children.min
27
+ return if @elements[index - 1] <= max_child[0]
28
+ swap index, max_child[1]
29
+ swim_down max_child[1]
91
30
  end
92
31
  end
93
32
  end
@@ -0,0 +1,51 @@
1
+ module Heap
2
+ # Heap Template
3
+ class HeapTemplate
4
+ attr_reader :elements
5
+
6
+ def add(element)
7
+ if element.is_a? Array
8
+ element.each do |el|
9
+ @elements.push el
10
+ swim_up(count)
11
+ end
12
+ elsif defined? element.elements
13
+ add element.elements
14
+ else
15
+ @elements.push element
16
+ swim_up(count)
17
+ end
18
+ end
19
+
20
+ def count
21
+ @elements.length
22
+ end
23
+
24
+ def sort
25
+ el_temp = @elements.clone
26
+ result = []
27
+ result.push extract_root! while count > 0
28
+ @elements = el_temp
29
+ result
30
+ end
31
+
32
+ protected
33
+
34
+ def extract_root
35
+ @elements[0]
36
+ end
37
+
38
+ def extract_root!
39
+ swap(1, count)
40
+ el = @elements.pop
41
+ swim_down(1)
42
+ el
43
+ end
44
+
45
+ def swap(index1, index2)
46
+ temp = @elements[index1 - 1]
47
+ @elements[index1 - 1] = @elements[index2 - 1]
48
+ @elements[index2 - 1] = temp
49
+ end
50
+ end
51
+ end
@@ -0,0 +1,27 @@
1
+ module Heap
2
+ module MultipleHeap
3
+ # Multiple Heap template
4
+ class MultipleHeap < HeapTemplate
5
+ attr_reader :d
6
+
7
+ protected
8
+
9
+ def initialize(d, elements = [])
10
+ @elements = []
11
+ @d = d
12
+ add(elements.pop) until elements.empty?
13
+ end
14
+
15
+ def get_children(index)
16
+ child_indexes = []
17
+ (2..(@d + 1)).each { |i| child_indexes.push((index - 1) * @d + i) }
18
+ child_indexes.delete_if { |ind| ind > count }
19
+ return if child_indexes.empty?
20
+
21
+ children = {}
22
+ child_indexes.each { |ind| children[@elements[ind - 1]] = ind }
23
+ children
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,34 @@
1
+ module Heap
2
+ module MultipleHeap
3
+ # Multiple Heap with max root
4
+ class MaxHeap < MultipleHeap
5
+ def extract_max
6
+ extract_root
7
+ end
8
+
9
+ def extract_max!
10
+ extract_root!
11
+ end
12
+
13
+ private
14
+
15
+ def swim_up(index)
16
+ return if index == 1
17
+ parent_index = ((index.to_f - 1) / @d).ceil
18
+ return if @elements[parent_index - 1] >= @elements[index - 1]
19
+ swap(parent_index, index)
20
+ swim_up parent_index
21
+ end
22
+
23
+ def swim_down(index)
24
+ children = get_children index
25
+ return if children.nil? || children.empty?
26
+ max_child = children.max
27
+
28
+ return if @elements[index - 1] >= max_child[0]
29
+ swap index, max_child[1]
30
+ swim_down max_child[1]
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,34 @@
1
+ module Heap
2
+ module MultipleHeap
3
+ # Multiple Heap with min root
4
+ class MinHeap < MultipleHeap
5
+ def extract_min
6
+ extract_root
7
+ end
8
+
9
+ def extract_min!
10
+ extract_root!
11
+ end
12
+
13
+ private
14
+
15
+ def swim_up(index)
16
+ return if index == 1
17
+ parent_index = ((index.to_f - 1) / @d).ceil
18
+ return if @elements[parent_index - 1] <= @elements[index - 1]
19
+ swap(parent_index, index)
20
+ swim_up parent_index
21
+ end
22
+
23
+ def swim_down(index)
24
+ children = get_children index
25
+ return if children.nil? || children.empty?
26
+ min_child = children.min
27
+
28
+ return if @elements[index - 1] <= min_child[0]
29
+ swap index, min_child[1]
30
+ swim_down min_child[1]
31
+ end
32
+ end
33
+ end
34
+ end
data/lib/Heap/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Heap
2
- VERSION = '0.2.2'
2
+ VERSION = '1.0.4'
3
3
  end
data/lib/Heap.rb CHANGED
@@ -1,6 +1,12 @@
1
1
  require 'Heap/version'
2
2
 
3
+ # Main ruby-heap rb file
3
4
  module Heap
5
+ require 'Heap/heap_template'
6
+ require 'Heap/binary_heap/binary_heap'
4
7
  require 'Heap/binary_heap/binary_heap_min'
5
8
  require 'Heap/binary_heap/binary_heap_max'
9
+ require 'Heap/multiple_heap/multiple_heap'
10
+ require 'Heap/multiple_heap/multiple_heap_max'
11
+ require 'Heap/multiple_heap/multiple_heap_min'
6
12
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-heap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 1.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexandr Sysoev
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-19 00:00:00.000000000 Z
11
+ date: 2021-10-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -16,28 +16,34 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '1.14'
19
+ version: '2.2'
20
+ - - ">="
21
+ - !ruby/object:Gem::Version
22
+ version: 2.2.10
20
23
  type: :development
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - "~>"
25
28
  - !ruby/object:Gem::Version
26
- version: '1.14'
29
+ version: '2.2'
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: 2.2.10
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: rake
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - "~>"
32
38
  - !ruby/object:Gem::Version
33
- version: '10.0'
39
+ version: '13.0'
34
40
  type: :development
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - "~>"
39
45
  - !ruby/object:Gem::Version
40
- version: '10.0'
46
+ version: '13.0'
41
47
  - !ruby/object:Gem::Dependency
42
48
  name: minitest
43
49
  requirement: !ruby/object:Gem::Requirement
@@ -52,7 +58,7 @@ dependencies:
52
58
  - - "~>"
53
59
  - !ruby/object:Gem::Version
54
60
  version: '5.0'
55
- description:
61
+ description:
56
62
  email:
57
63
  - sanchous.ok@gmail.com
58
64
  executables: []
@@ -60,24 +66,31 @@ extensions: []
60
66
  extra_rdoc_files: []
61
67
  files:
62
68
  - ".gitignore"
69
+ - ".tool-versions"
63
70
  - ".travis.yml"
64
71
  - Gemfile
72
+ - Gemfile.lock
65
73
  - Heap.gemspec
66
74
  - LICENSE.txt
67
75
  - README.md
76
+ - README_ru.md
68
77
  - Rakefile
69
78
  - bin/console
70
79
  - bin/setup
71
80
  - lib/Heap.rb
81
+ - lib/Heap/binary_heap/binary_heap.rb
72
82
  - lib/Heap/binary_heap/binary_heap_max.rb
73
83
  - lib/Heap/binary_heap/binary_heap_min.rb
84
+ - lib/Heap/heap_template.rb
85
+ - lib/Heap/multiple_heap/multiple_heap.rb
86
+ - lib/Heap/multiple_heap/multiple_heap_max.rb
87
+ - lib/Heap/multiple_heap/multiple_heap_min.rb
74
88
  - lib/Heap/version.rb
75
- - ruby-heap-0.2.1.gem
76
89
  homepage: https://github.com/pups3s/ruby-heap
77
90
  licenses:
78
91
  - MIT
79
92
  metadata: {}
80
- post_install_message:
93
+ post_install_message:
81
94
  rdoc_options: []
82
95
  require_paths:
83
96
  - lib
@@ -92,9 +105,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
92
105
  - !ruby/object:Gem::Version
93
106
  version: '0'
94
107
  requirements: []
95
- rubyforge_project:
96
- rubygems_version: 2.6.12
97
- signing_key:
108
+ rubygems_version: 3.1.2
109
+ signing_key:
98
110
  specification_version: 4
99
111
  summary: Binary or multiple heap
100
112
  test_files: []
data/ruby-heap-0.2.1.gem DELETED
Binary file