algorithm_selector 0.1.1 → 0.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.yardoc/checksums +2 -2
- data/.yardoc/objects/root.dat +0 -0
- data/README.md +145 -34
- data/algorithm_selector.gemspec +2 -2
- data/doc/AlgorithmSelector.html +71 -60
- data/doc/BSTNode.html +19 -19
- data/doc/BinaryTree.html +46 -46
- data/doc/LinkNode.html +19 -19
- data/doc/LinkedList.html +72 -72
- data/doc/Queue.html +55 -68
- data/doc/Searches.html +141 -78
- data/doc/Sorts.html +124 -123
- data/doc/Stack.html +64 -77
- data/doc/_index.html +1 -1
- data/doc/file.README.html +147 -22
- data/doc/index.html +147 -22
- data/doc/top-level-namespace.html +1 -1
- data/lib/algorithm_selector.rb +118 -108
- data/lib/algorithm_selector/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c92f24acb4d6a2fafd53e85e8175d4df16852bad
|
4
|
+
data.tar.gz: ecb1b1b2af1a69e09694f0203d47902a58e16bba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 36a078f0b02d232a1ee251ae9e55c94448f503f6fc2d5bcd72b042cbc3eab1db91d585fcfdaf96e0b312ca1071f579e2bc7d9a15c3ebd445ee92ada0cf2f8fab
|
7
|
+
data.tar.gz: 2fe851dd30394dc7f9bff8e7c5b78b14ef9afb25931aa0500c0cd66d63cdde907ee21b68efa4152c04049bb065c4bd8f3c58b57ab9358d7c1dc31cbe7cc10cbb
|
data/.gitignore
CHANGED
data/.yardoc/checksums
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
lib/algorithm_selector.rb
|
2
|
-
lib/algorithm_selector/version.rb
|
1
|
+
lib/algorithm_selector.rb 300cdf69ec09250719da398de917f15df18d8761
|
2
|
+
lib/algorithm_selector/version.rb 87587aa036583321d3bbdda4db673036572e46a9
|
data/.yardoc/objects/root.dat
CHANGED
Binary file
|
data/README.md
CHANGED
@@ -1,9 +1,151 @@
|
|
1
|
-
#
|
1
|
+
# algorithm_selector [![Gem Version](https://badge.fury.io/rb/algorithm_selector.svg)](https://badge.fury.io/rb/algorithm_selector)
|
2
|
+
|
3
|
+
* [Live](https://rubygems.org/gems/algorithm_selector)
|
4
|
+
* [Documentation](http://www.rubydoc.info/gems/algorithm_selector)
|
2
5
|
|
3
6
|
## Description
|
4
7
|
|
5
|
-
|
6
|
-
|
8
|
+
Calculates algorithms and data structures for sorting and searching. Selects best one to use for particular data set.
|
9
|
+
|
10
|
+
Additionally, data structures can be used for own purposes. All data structures have the ability to insert and search. Will add deletion in the future.
|
11
|
+
|
12
|
+
Written by Joseph Bui.
|
13
|
+
### Currently supports the following algorithms and data structures:
|
14
|
+
* Sorting (`"sort"`)
|
15
|
+
* Bubble Sort (`"bubble_sort"`)
|
16
|
+
* Insertion Sort (`"insertion_sort"`)
|
17
|
+
* Selection Sort (`"selection_sort"`)
|
18
|
+
* Merge Sort (`"merge_sort"`)
|
19
|
+
* Quick Sort(`"quick_sort"`)
|
20
|
+
* Searching (`"search"`)
|
21
|
+
* Stack (`"stack"`)
|
22
|
+
* Queue (`"queue"`)
|
23
|
+
* Singly-Linked List (`"linked_list"`)
|
24
|
+
* Binary Search Tree (`"binary_tree"`)
|
25
|
+
|
26
|
+
### Parameters
|
27
|
+
|
28
|
+
* `action` is the string of the action, can be `"sort"` or `"search"`
|
29
|
+
* `data_set` has to be in array format
|
30
|
+
* `trials` is number of test trials (optional, default = 1)
|
31
|
+
* `target` is element user wants to search (unnecessary for `sort`, default = null)
|
32
|
+
* `algorithm` is the string of the algorithm or data structure
|
33
|
+
|
34
|
+
### Methods
|
35
|
+
|
36
|
+
* `all(action, data_set, trials, target)`
|
37
|
+
* Returns the times for each algorithm
|
38
|
+
* Example:
|
39
|
+
```ruby
|
40
|
+
AlgorithmSelector.all("sort", [2,1,4,3], 1000)
|
41
|
+
AlgorithmSelector.all("search", [2,1,4,3], 1000, 4)
|
42
|
+
```
|
43
|
+
* `best(action, data_set, trials, target)`
|
44
|
+
* Returns the algorithm with the best time
|
45
|
+
* Example:
|
46
|
+
```ruby
|
47
|
+
AlgorithmSelector.best("sort", [2,1,4,3], 1000)
|
48
|
+
AlgorithmSelector.best("search", [2,1,4,3], 1000, 4)
|
49
|
+
```
|
50
|
+
|
51
|
+
* `analyze(action, data_set, algorithm, trials, target)`
|
52
|
+
* Returns time for specified algorithm or data structure
|
53
|
+
* Example:
|
54
|
+
```ruby
|
55
|
+
AlgorithmSelector.analyze("sort", [2,1,4,3], "merge_sort", 1000)
|
56
|
+
AlgorithmSelector.analyze("search", [2,1,4,3], "linked_list", 1000, 4)
|
57
|
+
```
|
58
|
+
|
59
|
+
* `compare(action, data_set, first_algorithm, second_algorithm, trials, target)`
|
60
|
+
* Returns the times of two specified algorithms for comparison
|
61
|
+
* Example:
|
62
|
+
```ruby
|
63
|
+
AlgorithmSelector.compare("sort", [2,1,4,3], "merge_sort", "quick_sort", 1000)
|
64
|
+
AlgorithmSelector.compare("search", [2,1,4,3], "stack", "linked_list", 1000, 4)
|
65
|
+
```
|
66
|
+
|
67
|
+
* `sort(data_set, algorithm)`
|
68
|
+
* Returns sorted array of specified sorting algorithm
|
69
|
+
* Example:
|
70
|
+
```ruby
|
71
|
+
AlgorithmSelector.compare([2,1,4,3], "bubble_sort")
|
72
|
+
```
|
73
|
+
|
74
|
+
### Data Structures
|
75
|
+
|
76
|
+
#### Stack
|
77
|
+
* Initialize
|
78
|
+
```ruby
|
79
|
+
size = 10
|
80
|
+
stack = Stack.new(size)
|
81
|
+
```
|
82
|
+
* Insertion
|
83
|
+
```ruby
|
84
|
+
# returns nil
|
85
|
+
value = 6
|
86
|
+
stack.push(value)
|
87
|
+
```
|
88
|
+
* Search
|
89
|
+
```ruby
|
90
|
+
# returns true if found, else returns false
|
91
|
+
target = 4
|
92
|
+
stack.search(target)
|
93
|
+
```
|
94
|
+
|
95
|
+
#### Queue
|
96
|
+
* Initialize
|
97
|
+
```ruby
|
98
|
+
size = 10
|
99
|
+
queue = Queue.new(size)
|
100
|
+
```
|
101
|
+
* Insertion
|
102
|
+
```ruby
|
103
|
+
# returns nil
|
104
|
+
value = 6
|
105
|
+
queue.enqueue(value)
|
106
|
+
```
|
107
|
+
* Search
|
108
|
+
```ruby
|
109
|
+
# returns true if found, else returns false
|
110
|
+
target = 4
|
111
|
+
queue.search(target)
|
112
|
+
```
|
113
|
+
|
114
|
+
#### Linked List
|
115
|
+
* Initialize
|
116
|
+
```ruby
|
117
|
+
linked_list = LinkedList.new
|
118
|
+
```
|
119
|
+
* Insertion
|
120
|
+
```ruby
|
121
|
+
# returns nil
|
122
|
+
value = 6
|
123
|
+
linked_list.insert(value)
|
124
|
+
```
|
125
|
+
* Search
|
126
|
+
```ruby
|
127
|
+
# returns true if found, else returns false
|
128
|
+
target = 4
|
129
|
+
linked_list.search(target)
|
130
|
+
```
|
131
|
+
|
132
|
+
#### Binary Search Tree
|
133
|
+
* Initialize
|
134
|
+
```ruby
|
135
|
+
binary_tree = BinaryTree.new
|
136
|
+
```
|
137
|
+
* Insertion
|
138
|
+
```ruby
|
139
|
+
# returns nil
|
140
|
+
value = 6
|
141
|
+
binary_tree.insert(value)
|
142
|
+
```
|
143
|
+
* Search
|
144
|
+
```ruby
|
145
|
+
# returns true if found, else returns false
|
146
|
+
target = 4
|
147
|
+
binary_tree.search(target)
|
148
|
+
```
|
7
149
|
|
8
150
|
## Installation
|
9
151
|
|
@@ -27,37 +169,6 @@ Require the Gem:
|
|
27
169
|
|
28
170
|
$ require 'algorithm_selector'
|
29
171
|
|
30
|
-
### Features
|
31
|
-
|
32
|
-
* See all times of algorithms for data set
|
33
|
-
```ruby
|
34
|
-
# For Sorting algorithms
|
35
|
-
all(type, array, number_of_trials)
|
36
|
-
|
37
|
-
# example
|
38
|
-
# => {:sorted=>[1, 2, 3, 4, 5],
|
39
|
-
# :results=>
|
40
|
-
# {:bubble_sort=>1.329500000000018e-06,
|
41
|
-
# :insertion_sort=>1.3745000000000046e-06,
|
42
|
-
# :selection_sort=>5.778000000000015e-06,
|
43
|
-
# :merge_sort=>6.3820000000000526e-06,
|
44
|
-
# :quick_sort=>5.709000000000024e-06}}
|
45
|
-
|
46
|
-
####################################
|
47
|
-
|
48
|
-
# For Searching algorithms
|
49
|
-
all(type, array, number_of_trials, target)
|
50
|
-
|
51
|
-
# example
|
52
|
-
# all("search", [5,4,3,2,1], 2000, 3)
|
53
|
-
# => {:found=>true,
|
54
|
-
# :results=>
|
55
|
-
# {:stack=>6.156000000000004e-06,
|
56
|
-
# :queue=>5.315499999999899e-06,
|
57
|
-
# :linked_list=>1.050999999999992e-06,
|
58
|
-
# :binary_tree=>8.534999999999816e-07}}
|
59
|
-
|
60
|
-
```
|
61
172
|
|
62
173
|
## Contributing
|
63
174
|
|
data/algorithm_selector.gemspec
CHANGED
@@ -10,8 +10,8 @@ Gem::Specification.new do |spec|
|
|
10
10
|
spec.email = ["jnvbui@gmail.com"]
|
11
11
|
|
12
12
|
spec.summary = %q{Takes a desired action and data set, returns best algorithm.}
|
13
|
-
spec.description = %q{
|
14
|
-
Currently supports
|
13
|
+
spec.description = %q{Calculates algorithms and data structures for sorting and searching. Selects best one to use for particular data set.
|
14
|
+
Currently supports: Bubble Sort, Insertion Sort, Selection Sort, Merge Sort, Quick Sort, Stack, Queue, Linked List, Binary Search Tree}
|
15
15
|
spec.homepage = "https://github.com/jnvbui/algorithm_selector"
|
16
16
|
spec.license = "MIT"
|
17
17
|
|
data/doc/AlgorithmSelector.html
CHANGED
@@ -97,14 +97,25 @@
|
|
97
97
|
|
98
98
|
</div>
|
99
99
|
|
100
|
+
<h2>Overview</h2><div class="docstring">
|
101
|
+
<div class="discussion">
|
102
|
+
|
103
|
+
<p>algorithm-selector library; 5 methods (all, best, analyze, compare, sort)</p>
|
104
|
+
|
100
105
|
|
106
|
+
</div>
|
107
|
+
</div>
|
108
|
+
<div class="tags">
|
109
|
+
|
110
|
+
|
111
|
+
</div>
|
101
112
|
<h2>Constant Summary</h2>
|
102
113
|
<dl class="constants">
|
103
114
|
|
104
115
|
<dt id="VERSION-constant" class="">VERSION =
|
105
116
|
|
106
117
|
</dt>
|
107
|
-
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.
|
118
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.1</span><span class='tstring_end'>"</span></span></pre></dd>
|
108
119
|
|
109
120
|
</dl>
|
110
121
|
|
@@ -125,7 +136,7 @@
|
|
125
136
|
<li class="public ">
|
126
137
|
<span class="summary_signature">
|
127
138
|
|
128
|
-
<a href="#all-instance_method" title="#all (instance method)">#<strong>all</strong>(
|
139
|
+
<a href="#all-instance_method" title="#all (instance method)">#<strong>all</strong>(action, data_set, trials = 1, target = nil) ⇒ Object </a>
|
129
140
|
|
130
141
|
|
131
142
|
|
@@ -140,7 +151,7 @@
|
|
140
151
|
|
141
152
|
|
142
153
|
<span class="summary_desc"><div class='inline'>
|
143
|
-
<p>
|
154
|
+
<p>Returns the times for each algorithm.</p>
|
144
155
|
</div></span>
|
145
156
|
|
146
157
|
</li>
|
@@ -149,7 +160,7 @@
|
|
149
160
|
<li class="public ">
|
150
161
|
<span class="summary_signature">
|
151
162
|
|
152
|
-
<a href="#analyze-instance_method" title="#analyze (instance method)">#<strong>analyze</strong>(
|
163
|
+
<a href="#analyze-instance_method" title="#analyze (instance method)">#<strong>analyze</strong>(action, data_set, algorithm, trials = 1, target = nil) ⇒ Object </a>
|
153
164
|
|
154
165
|
|
155
166
|
|
@@ -164,7 +175,7 @@
|
|
164
175
|
|
165
176
|
|
166
177
|
<span class="summary_desc"><div class='inline'>
|
167
|
-
<p>
|
178
|
+
<p>Returns time for specified algorithm or data structure.</p>
|
168
179
|
</div></span>
|
169
180
|
|
170
181
|
</li>
|
@@ -173,7 +184,7 @@
|
|
173
184
|
<li class="public ">
|
174
185
|
<span class="summary_signature">
|
175
186
|
|
176
|
-
<a href="#best-instance_method" title="#best (instance method)">#<strong>best</strong>(
|
187
|
+
<a href="#best-instance_method" title="#best (instance method)">#<strong>best</strong>(action, data_set, trials = 1, target = nil) ⇒ Object </a>
|
177
188
|
|
178
189
|
|
179
190
|
|
@@ -188,7 +199,7 @@
|
|
188
199
|
|
189
200
|
|
190
201
|
<span class="summary_desc"><div class='inline'>
|
191
|
-
<p>
|
202
|
+
<p>Returns the algorithm with the best time.</p>
|
192
203
|
</div></span>
|
193
204
|
|
194
205
|
</li>
|
@@ -197,7 +208,7 @@
|
|
197
208
|
<li class="public ">
|
198
209
|
<span class="summary_signature">
|
199
210
|
|
200
|
-
<a href="#compare-instance_method" title="#compare (instance method)">#<strong>compare</strong>(
|
211
|
+
<a href="#compare-instance_method" title="#compare (instance method)">#<strong>compare</strong>(action, data_set, first_algorithm, second_algorithm, trials = 1, target = nil) ⇒ Object </a>
|
201
212
|
|
202
213
|
|
203
214
|
|
@@ -212,7 +223,7 @@
|
|
212
223
|
|
213
224
|
|
214
225
|
<span class="summary_desc"><div class='inline'>
|
215
|
-
<p>
|
226
|
+
<p>Returns the times of two specified algorithms for comparison.</p>
|
216
227
|
</div></span>
|
217
228
|
|
218
229
|
</li>
|
@@ -221,7 +232,7 @@
|
|
221
232
|
<li class="public ">
|
222
233
|
<span class="summary_signature">
|
223
234
|
|
224
|
-
<a href="#sort-instance_method" title="#sort (instance method)">#<strong>sort</strong>(
|
235
|
+
<a href="#sort-instance_method" title="#sort (instance method)">#<strong>sort</strong>(data_set, algorithm) ⇒ Object </a>
|
225
236
|
|
226
237
|
|
227
238
|
|
@@ -236,7 +247,7 @@
|
|
236
247
|
|
237
248
|
|
238
249
|
<span class="summary_desc"><div class='inline'>
|
239
|
-
<p>
|
250
|
+
<p>Returns sorted data_set of specified sorting algorithm.</p>
|
240
251
|
</div></span>
|
241
252
|
|
242
253
|
</li>
|
@@ -254,7 +265,7 @@
|
|
254
265
|
<div class="method_details first">
|
255
266
|
<h3 class="signature first" id="all-instance_method">
|
256
267
|
|
257
|
-
#<strong>all</strong>(
|
268
|
+
#<strong>all</strong>(action, data_set, trials = 1, target = nil) ⇒ <tt>Object</tt>
|
258
269
|
|
259
270
|
|
260
271
|
|
@@ -263,7 +274,7 @@
|
|
263
274
|
</h3><div class="docstring">
|
264
275
|
<div class="discussion">
|
265
276
|
|
266
|
-
<p>
|
277
|
+
<p>Returns the times for each algorithm</p>
|
267
278
|
|
268
279
|
|
269
280
|
</div>
|
@@ -277,22 +288,22 @@
|
|
277
288
|
<pre class="lines">
|
278
289
|
|
279
290
|
|
280
|
-
7
|
281
291
|
8
|
282
292
|
9
|
283
293
|
10
|
284
294
|
11
|
285
295
|
12
|
286
|
-
13
|
296
|
+
13
|
297
|
+
14</pre>
|
287
298
|
</td>
|
288
299
|
<td>
|
289
|
-
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line
|
300
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 8</span>
|
290
301
|
|
291
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier
|
292
|
-
<span class='kw'>if</span> <span class='id identifier
|
293
|
-
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier
|
294
|
-
<span class='kw'>elsif</span> <span class='id identifier
|
295
|
-
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier
|
302
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
303
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>sort</span><span class='tstring_end'>"</span></span>
|
304
|
+
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='rparen'>)</span>
|
305
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>search</span><span class='tstring_end'>"</span></span>
|
306
|
+
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
296
307
|
<span class='kw'>end</span>
|
297
308
|
<span class='kw'>end</span></pre>
|
298
309
|
</td>
|
@@ -303,7 +314,7 @@
|
|
303
314
|
<div class="method_details ">
|
304
315
|
<h3 class="signature " id="analyze-instance_method">
|
305
316
|
|
306
|
-
#<strong>analyze</strong>(
|
317
|
+
#<strong>analyze</strong>(action, data_set, algorithm, trials = 1, target = nil) ⇒ <tt>Object</tt>
|
307
318
|
|
308
319
|
|
309
320
|
|
@@ -312,7 +323,7 @@
|
|
312
323
|
</h3><div class="docstring">
|
313
324
|
<div class="discussion">
|
314
325
|
|
315
|
-
<p>
|
326
|
+
<p>Returns time for specified algorithm or data structure</p>
|
316
327
|
|
317
328
|
|
318
329
|
</div>
|
@@ -326,22 +337,22 @@
|
|
326
337
|
<pre class="lines">
|
327
338
|
|
328
339
|
|
329
|
-
25
|
330
340
|
26
|
331
341
|
27
|
332
342
|
28
|
333
343
|
29
|
334
344
|
30
|
335
|
-
31
|
345
|
+
31
|
346
|
+
32</pre>
|
336
347
|
</td>
|
337
348
|
<td>
|
338
|
-
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line
|
349
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 26</span>
|
339
350
|
|
340
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier
|
341
|
-
<span class='kw'>if</span> <span class='id identifier
|
342
|
-
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier
|
343
|
-
<span class='kw'>elsif</span> <span class='id identifier
|
344
|
-
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier
|
351
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
352
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>sort</span><span class='tstring_end'>"</span></span>
|
353
|
+
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='rparen'>)</span>
|
354
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>search</span><span class='tstring_end'>"</span></span>
|
355
|
+
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
345
356
|
<span class='kw'>end</span>
|
346
357
|
<span class='kw'>end</span></pre>
|
347
358
|
</td>
|
@@ -352,7 +363,7 @@
|
|
352
363
|
<div class="method_details ">
|
353
364
|
<h3 class="signature " id="best-instance_method">
|
354
365
|
|
355
|
-
#<strong>best</strong>(
|
366
|
+
#<strong>best</strong>(action, data_set, trials = 1, target = nil) ⇒ <tt>Object</tt>
|
356
367
|
|
357
368
|
|
358
369
|
|
@@ -361,7 +372,7 @@
|
|
361
372
|
</h3><div class="docstring">
|
362
373
|
<div class="discussion">
|
363
374
|
|
364
|
-
<p>
|
375
|
+
<p>Returns the algorithm with the best time</p>
|
365
376
|
|
366
377
|
|
367
378
|
</div>
|
@@ -375,22 +386,22 @@
|
|
375
386
|
<pre class="lines">
|
376
387
|
|
377
388
|
|
378
|
-
16
|
379
389
|
17
|
380
390
|
18
|
381
391
|
19
|
382
392
|
20
|
383
393
|
21
|
384
|
-
22
|
394
|
+
22
|
395
|
+
23</pre>
|
385
396
|
</td>
|
386
397
|
<td>
|
387
|
-
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line
|
398
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 17</span>
|
388
399
|
|
389
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier
|
390
|
-
<span class='kw'>if</span> <span class='id identifier
|
391
|
-
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier
|
392
|
-
<span class='kw'>elsif</span> <span class='id identifier
|
393
|
-
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier
|
400
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
401
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>sort</span><span class='tstring_end'>"</span></span>
|
402
|
+
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='rparen'>)</span>
|
403
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>search</span><span class='tstring_end'>"</span></span>
|
404
|
+
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
394
405
|
<span class='kw'>end</span>
|
395
406
|
<span class='kw'>end</span></pre>
|
396
407
|
</td>
|
@@ -401,7 +412,7 @@
|
|
401
412
|
<div class="method_details ">
|
402
413
|
<h3 class="signature " id="compare-instance_method">
|
403
414
|
|
404
|
-
#<strong>compare</strong>(
|
415
|
+
#<strong>compare</strong>(action, data_set, first_algorithm, second_algorithm, trials = 1, target = nil) ⇒ <tt>Object</tt>
|
405
416
|
|
406
417
|
|
407
418
|
|
@@ -410,7 +421,7 @@
|
|
410
421
|
</h3><div class="docstring">
|
411
422
|
<div class="discussion">
|
412
423
|
|
413
|
-
<p>
|
424
|
+
<p>Returns the times of two specified algorithms for comparison</p>
|
414
425
|
|
415
426
|
|
416
427
|
</div>
|
@@ -424,22 +435,22 @@
|
|
424
435
|
<pre class="lines">
|
425
436
|
|
426
437
|
|
427
|
-
34
|
428
438
|
35
|
429
439
|
36
|
430
440
|
37
|
431
441
|
38
|
432
442
|
39
|
433
|
-
40
|
443
|
+
40
|
444
|
+
41</pre>
|
434
445
|
</td>
|
435
446
|
<td>
|
436
|
-
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line
|
447
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 35</span>
|
437
448
|
|
438
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier
|
439
|
-
<span class='kw'>if</span> <span class='id identifier
|
440
|
-
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier
|
441
|
-
<span class='kw'>elsif</span> <span class='id identifier
|
442
|
-
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier
|
449
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier rubyid_action'>action</span><span class='comma'>,</span> <span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_first_algorithm'>first_algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_second_algorithm'>second_algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='op'>=</span><span class='int'>1</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
450
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>sort</span><span class='tstring_end'>"</span></span>
|
451
|
+
<span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_first_algorithm'>first_algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_second_algorithm'>second_algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='rparen'>)</span>
|
452
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_action'>action</span> <span class='op'>==</span> <span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>search</span><span class='tstring_end'>"</span></span>
|
453
|
+
<span class='const'>Searches</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_first_algorithm'>first_algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_second_algorithm'>second_algorithm</span><span class='comma'>,</span> <span class='id identifier rubyid_trials'>trials</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
443
454
|
<span class='kw'>end</span>
|
444
455
|
<span class='kw'>end</span></pre>
|
445
456
|
</td>
|
@@ -450,7 +461,7 @@
|
|
450
461
|
<div class="method_details ">
|
451
462
|
<h3 class="signature " id="sort-instance_method">
|
452
463
|
|
453
|
-
#<strong>sort</strong>(
|
464
|
+
#<strong>sort</strong>(data_set, algorithm) ⇒ <tt>Object</tt>
|
454
465
|
|
455
466
|
|
456
467
|
|
@@ -459,7 +470,7 @@
|
|
459
470
|
</h3><div class="docstring">
|
460
471
|
<div class="discussion">
|
461
472
|
|
462
|
-
<p>
|
473
|
+
<p>Returns sorted data_set of specified sorting algorithm</p>
|
463
474
|
|
464
475
|
|
465
476
|
</div>
|
@@ -473,17 +484,17 @@
|
|
473
484
|
<pre class="lines">
|
474
485
|
|
475
486
|
|
476
|
-
43
|
477
487
|
44
|
478
488
|
45
|
479
|
-
46
|
489
|
+
46
|
490
|
+
47</pre>
|
480
491
|
</td>
|
481
492
|
<td>
|
482
|
-
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line
|
493
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 44</span>
|
483
494
|
|
484
|
-
<span class='kw'>def</span> <span class='id identifier rubyid_sort'>sort</span><span class='lparen'>(</span><span class='id identifier
|
485
|
-
<span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier
|
486
|
-
<span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier
|
495
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sort'>sort</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm'>algorithm</span><span class='rparen'>)</span>
|
496
|
+
<span class='id identifier rubyid_method'>method</span> <span class='op'>=</span> <span class='const'>Sorts</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='period'>.</span><span class='id identifier rubyid_method'>method</span><span class='lparen'>(</span><span class='id identifier rubyid_algorithm'>algorithm</span><span class='rparen'>)</span>
|
497
|
+
<span class='id identifier rubyid_method'>method</span><span class='period'>.</span><span class='id identifier rubyid_call'>call</span><span class='lparen'>(</span><span class='id identifier rubyid_data_set'>data_set</span><span class='rparen'>)</span>
|
487
498
|
<span class='kw'>end</span></pre>
|
488
499
|
</td>
|
489
500
|
</tr>
|
@@ -495,7 +506,7 @@
|
|
495
506
|
</div>
|
496
507
|
|
497
508
|
<div id="footer">
|
498
|
-
Generated on
|
509
|
+
Generated on Sat Jul 23 23:26:27 2016 by
|
499
510
|
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
500
511
|
0.9.4 (ruby-2.1.2).
|
501
512
|
</div>
|