SnowArraySort 1.0.12 → 1.0.13

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 1843fcfcdd2d4bc1cfdcd014c3b7f43b8fcc704a
4
+ data.tar.gz: 5f6856d6fa4c9e294c4926081c94529854db655b
5
+ SHA512:
6
+ metadata.gz: 69ad33893f44a2db1dee700a8e922f214bfb0541512bf9ca334b270e58c437ba0ed7351057f3a4c1926ae2be76132b67a0a345650735f06404989b9b55d83bd5
7
+ data.tar.gz: e942ebc7694729f11c1d2384a2debe234a1053759e7f8d665afdb8a686ccae787e53ccb93cdd835e56af80e4c5697ac2dab87c73bfc49efdd83d867ab4777925
data/Gemfile CHANGED
@@ -1,3 +1,3 @@
1
- source 'https://rubygems.org'
2
-
3
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
data/README.md CHANGED
@@ -1,2 +1,3 @@
1
- # SnowArraySort
2
- Algorithm's for sorting array's
1
+ # SnowArraySort
2
+ Algorithm's for sorting array's
3
+ # SnowArraySort
@@ -1,11 +1,11 @@
1
- module SnowArraySort
2
- class SnowAD
3
- include SnowArraySort
4
-
5
- def <=>(other)
6
- -super
7
- end
8
- end
9
- end
10
-
11
-
1
+ module SnowArraySort
2
+ class SnowAD
3
+ include SnowArraySort
4
+
5
+ def <=>(other)
6
+ -super
7
+ end
8
+ end
9
+ end
10
+
11
+
@@ -1,38 +1,16 @@
1
- module SnowArraySort
2
- class MASort
3
- include SnowArraySort
4
-
5
- def self.mergesort(array)
6
- def self.merge(left_sorted, right_sorted)
7
- res = []
8
- l = 0
9
- r = 0
10
-
11
- loop do
12
- break if r >= right_sorted.length and l >= left_sorted.length
13
-
14
- if r >= right_sorted.length or (l < left_sorted.length and left_sorted[l] < right_sorted[r])
15
- res << left_sorted[l]
16
- l += 1
17
- else
18
- res << right_sorted[r]
19
- r += 1
20
- end
21
- end
22
-
23
- return res
24
- end
25
-
26
- def self.mergesort_iter(array_sliced)
27
- return array_sliced if array_sliced.length <= 1
28
-
29
- mid = array_sliced.length/2 - 1
30
- left_sorted = mergesort_iter(array_sliced[0..mid])
31
- right_sorted = mergesort_iter(array_sliced[mid+1..-1])
32
- return merge(left_sorted, right_sorted)
33
- end
34
-
35
- mergesort_iter(array)
36
- end
37
- end
38
- end
1
+ module SnowArraySort
2
+ class MaSort
3
+ include SnowArraySort
4
+
5
+ def self.merge_sort(lists)
6
+ return lists if lists.count == 1
7
+
8
+ middle = lists[0..(lists.count / 2) - 1 ]
9
+ left = lists[0..middle.count - 1]
10
+ right = lists[middle.count..lists.count]
11
+
12
+ x = merge_sort(left)
13
+ y = merge_sort(right)
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+ module SnowArraySort
2
+ class Arrays < MaSort
3
+
4
+ include SnowArraySort
5
+
6
+
7
+ def initialize(merge_sort)
8
+ super (merge_sort)
9
+ end
10
+
11
+ def self.merged_arrays
12
+
13
+ a = [1,3,4,6,7,2,2]
14
+ f = MaSort.merge_sort a
15
+
16
+
17
+ puts f
18
+ end
19
+ end
20
+ end
@@ -1,4 +1,4 @@
1
- module SnowArraySort
2
- VERSION = "1.0.12"
3
- end
4
-
1
+ module SnowArraySort
2
+ VERSION = "1.0.13"
3
+ end
4
+
data/lib/SnowArraySort.rb CHANGED
@@ -1,8 +1,8 @@
1
- require "SnowArraySort/version"
2
- require "SnowArraySort/merge_array_sort_snow"
3
- require 'SnowArraySort/asc_desc_array_sort_snow'
4
-
5
-
6
- module SnowArraySort
7
-
8
- end
1
+ require_relative "SnowArraySort/version"
2
+ require_relative "SnowArraySort/merge_array_sort_snow"
3
+ require_relative "SnowArraySort/asc_desc_array_sort_snow"
4
+ require_relative "SnowArraySort/test_of_merge_array"
5
+
6
+ module SnowArraySort
7
+
8
+ end
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: SnowArraySort
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.12
5
- prerelease:
4
+ version: 1.0.13
6
5
  platform: ruby
7
6
  authors:
8
7
  - Justin Snow
@@ -19,35 +18,35 @@ executables: []
19
18
  extensions: []
20
19
  extra_rdoc_files: []
21
20
  files:
22
- - README.md
23
21
  - Gemfile
22
+ - README.md
23
+ - lib/SnowArraySort.rb
24
+ - lib/SnowArraySort/asc_desc_array_sort_snow.rb
24
25
  - lib/SnowArraySort/merge_array_sort_snow.rb
26
+ - lib/SnowArraySort/test_of_merge_array.rb
25
27
  - lib/SnowArraySort/version.rb
26
- - lib/SnowArraySort/asc_desc_array_sort_snow.rb
27
- - lib/SnowArraySort.rb
28
28
  homepage: https://github.com/Jrsnow8921/SnowArraySort
29
29
  licenses:
30
30
  - MIT
31
+ metadata: {}
31
32
  post_install_message:
32
33
  rdoc_options: []
33
34
  require_paths:
34
35
  - lib
35
36
  required_ruby_version: !ruby/object:Gem::Requirement
36
- none: false
37
37
  requirements:
38
- - - ! '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  required_rubygems_version: !ruby/object:Gem::Requirement
42
- none: false
43
42
  requirements:
44
- - - ! '>='
43
+ - - ">="
45
44
  - !ruby/object:Gem::Version
46
45
  version: '0'
47
46
  requirements: []
48
47
  rubyforge_project:
49
- rubygems_version: 1.8.23.2
48
+ rubygems_version: 2.2.2
50
49
  signing_key:
51
- specification_version: 3
50
+ specification_version: 4
52
51
  summary: Algorithms for sorting arrays
53
52
  test_files: []