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.
data/doc/Stack.html CHANGED
@@ -174,7 +174,7 @@
174
174
  <li class="public ">
175
175
  <span class="summary_signature">
176
176
 
177
- <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(size, array = []) &#x21d2; Stack </a>
177
+ <a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(size, data_set = []) &#x21d2; Stack </a>
178
178
 
179
179
 
180
180
 
@@ -236,9 +236,7 @@
236
236
 
237
237
 
238
238
 
239
- <span class="summary_desc"><div class='inline'>
240
- <p>Deletion, Worst-Case Time Complexity: O(1).</p>
241
- </div></span>
239
+ <span class="summary_desc"><div class='inline'></div></span>
242
240
 
243
241
  </li>
244
242
 
@@ -323,7 +321,7 @@ Complexity: O(n).</p>
323
321
  <div class="method_details first">
324
322
  <h3 class="signature first" id="initialize-instance_method">
325
323
 
326
- #<strong>initialize</strong>(size, array = []) &#x21d2; <tt><span class='object_link'><a href="" title="Stack (class)">Stack</a></span></tt>
324
+ #<strong>initialize</strong>(size, data_set = []) &#x21d2; <tt><span class='object_link'><a href="" title="Stack (class)">Stack</a></span></tt>
327
325
 
328
326
 
329
327
 
@@ -346,21 +344,21 @@ Complexity: O(n).</p>
346
344
  <pre class="lines">
347
345
 
348
346
 
349
- 266
350
- 267
351
- 268
352
- 269
353
- 270
354
- 271</pre>
347
+ 277
348
+ 278
349
+ 279
350
+ 280
351
+ 281
352
+ 282</pre>
355
353
  </td>
356
354
  <td>
357
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 266</span>
355
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 277</span>
358
356
 
359
- <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_array'>array</span><span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
357
+ <span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_size'>size</span><span class='comma'>,</span> <span class='id identifier rubyid_data_set'>data_set</span><span class='op'>=</span><span class='lbracket'>[</span><span class='rbracket'>]</span><span class='rparen'>)</span>
360
358
  <span class='ivar'>@size</span> <span class='op'>=</span> <span class='id identifier rubyid_size'>size</span>
361
359
  <span class='ivar'>@store</span> <span class='op'>=</span> <span class='const'>Array</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='ivar'>@size</span><span class='rparen'>)</span>
362
360
  <span class='ivar'>@top</span> <span class='op'>=</span> <span class='op'>-</span><span class='int'>1</span>
363
- <span class='id identifier rubyid_array'>array</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_el'>el</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
361
+ <span class='id identifier rubyid_data_set'>data_set</span><span class='period'>.</span><span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_el'>el</span><span class='op'>|</span> <span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_el'>el</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
364
362
  <span class='kw'>end</span></pre>
365
363
  </td>
366
364
  </tr>
@@ -411,12 +409,12 @@ Complexity: O(n).</p>
411
409
  <pre class="lines">
412
410
 
413
411
 
414
- 324
415
- 325
416
- 326</pre>
412
+ 334
413
+ 335
414
+ 336</pre>
417
415
  </td>
418
416
  <td>
419
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 324</span>
417
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 334</span>
420
418
 
421
419
  <span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
422
420
  <span class='ivar'>@top</span> <span class='op'>==</span> <span class='op'>-</span><span class='int'>1</span>
@@ -463,12 +461,12 @@ Complexity: O(n).</p>
463
461
  <pre class="lines">
464
462
 
465
463
 
466
- 320
467
- 321
468
- 322</pre>
464
+ 330
465
+ 331
466
+ 332</pre>
469
467
  </td>
470
468
  <td>
471
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 320</span>
469
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 330</span>
472
470
 
473
471
  <span class='kw'>def</span> <span class='id identifier rubyid_full?'>full?</span>
474
472
  <span class='ivar'>@top</span> <span class='op'>==</span> <span class='lparen'>(</span><span class='ivar'>@size</span> <span class='op'>-</span> <span class='int'>1</span><span class='rparen'>)</span>
@@ -493,12 +491,12 @@ Complexity: O(n).</p>
493
491
  <pre class="lines">
494
492
 
495
493
 
496
- 316
497
- 317
498
- 318</pre>
494
+ 326
495
+ 327
496
+ 328</pre>
499
497
  </td>
500
498
  <td>
501
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 316</span>
499
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 326</span>
502
500
 
503
501
  <span class='kw'>def</span> <span class='id identifier rubyid_look'>look</span>
504
502
  <span class='ivar'>@store</span><span class='lbracket'>[</span><span class='ivar'>@top</span><span class='rbracket'>]</span>
@@ -517,36 +515,25 @@ Complexity: O(n).</p>
517
515
 
518
516
 
519
517
 
520
- </h3><div class="docstring">
521
- <div class="discussion">
522
-
523
- <p>Deletion, Worst-Case Time Complexity: O(1)</p>
524
-
525
-
526
- </div>
527
- </div>
528
- <div class="tags">
529
-
530
-
531
- </div><table class="source_code">
518
+ </h3><table class="source_code">
532
519
  <tr>
533
520
  <td>
534
521
  <pre class="lines">
535
522
 
536
523
 
537
- 290
538
- 291
539
- 292
540
- 293
541
- 294
542
- 295
543
- 296
544
- 297
545
- 298
546
- 299</pre>
524
+ 300
525
+ 301
526
+ 302
527
+ 303
528
+ 304
529
+ 305
530
+ 306
531
+ 307
532
+ 308
533
+ 309</pre>
547
534
  </td>
548
535
  <td>
549
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 290</span>
536
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 300</span>
550
537
 
551
538
  <span class='kw'>def</span> <span class='id identifier rubyid_pop'>pop</span>
552
539
  <span class='kw'>if</span> <span class='id identifier rubyid_empty?'>empty?</span>
@@ -589,18 +576,18 @@ Complexity: O(n).</p>
589
576
  <pre class="lines">
590
577
 
591
578
 
592
- 302
593
- 303
594
- 304
595
- 305
596
- 306
597
- 307
598
- 308
599
- 309
600
- 310</pre>
579
+ 312
580
+ 313
581
+ 314
582
+ 315
583
+ 316
584
+ 317
585
+ 318
586
+ 319
587
+ 320</pre>
601
588
  </td>
602
589
  <td>
603
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 302</span>
590
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 312</span>
604
591
 
605
592
  <span class='kw'>def</span> <span class='id identifier rubyid_push'>push</span><span class='lparen'>(</span><span class='id identifier rubyid_el'>el</span><span class='rparen'>)</span>
606
593
  <span class='kw'>if</span> <span class='id identifier rubyid_full?'>full?</span> <span class='kw'>or</span> <span class='id identifier rubyid_el'>el</span><span class='period'>.</span><span class='id identifier rubyid_nil?'>nil?</span>
@@ -643,22 +630,22 @@ Complexity: O(n)</p>
643
630
  <pre class="lines">
644
631
 
645
632
 
646
- 275
647
- 276
648
- 277
649
- 278
650
- 279
651
- 280
652
- 281
653
- 282
654
- 283
655
- 284
656
- 285
657
633
  286
658
- 287</pre>
634
+ 287
635
+ 288
636
+ 289
637
+ 290
638
+ 291
639
+ 292
640
+ 293
641
+ 294
642
+ 295
643
+ 296
644
+ 297
645
+ 298</pre>
659
646
  </td>
660
647
  <td>
661
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 275</span>
648
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 286</span>
662
649
 
663
650
  <span class='kw'>def</span> <span class='id identifier rubyid_search'>search</span><span class='lparen'>(</span><span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
664
651
  <span class='id identifier rubyid_found'>found</span> <span class='op'>=</span> <span class='kw'>false</span>
@@ -693,12 +680,12 @@ Complexity: O(n)</p>
693
680
  <pre class="lines">
694
681
 
695
682
 
696
- 312
697
- 313
698
- 314</pre>
683
+ 322
684
+ 323
685
+ 324</pre>
699
686
  </td>
700
687
  <td>
701
- <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 312</span>
688
+ <pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 322</span>
702
689
 
703
690
  <span class='kw'>def</span> <span class='id identifier rubyid_size'>size</span>
704
691
  <span class='ivar'>@size</span>
@@ -713,7 +700,7 @@ Complexity: O(n)</p>
713
700
  </div>
714
701
 
715
702
  <div id="footer">
716
- Generated on Fri Jul 22 11:22:30 2016 by
703
+ Generated on Sat Jul 23 23:26:27 2016 by
717
704
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
718
705
  0.9.4 (ruby-2.1.2).
719
706
  </div>
data/doc/_index.html CHANGED
@@ -173,7 +173,7 @@
173
173
  </div>
174
174
 
175
175
  <div id="footer">
176
- Generated on Fri Jul 22 11:22:30 2016 by
176
+ Generated on Sat Jul 23 23:26:27 2016 by
177
177
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
178
178
  0.9.4 (ruby-2.1.2).
179
179
  </div>
data/doc/file.README.html CHANGED
@@ -60,7 +60,152 @@
60
60
  <iframe id="search_frame" src="file_list.html"></iframe>
61
61
 
62
62
  <div id="content"><div id='filecontents'>
63
- <h1 id="label-AlgorithmSelector">AlgorithmSelector</h1>
63
+ <h1 id="label-algorithm_selector+rdoc-image-3Ahttps-3A-2F-2Fbadge.fury.io-2Frb-2Falgorithm_selector.svg">algorithm_selector <a href="https://badge.fury.io/rb/algorithm_selector"><img src="https://badge.fury.io/rb/algorithm_selector.svg"></a></h1>
64
+ <ul><li>
65
+ <p><a href="https://rubygems.org/gems/algorithm_selector">Live</a></p>
66
+ </li><li>
67
+ <p><a href="http://www.rubydoc.info/gems/algorithm_selector">Documentation</a></p>
68
+ </li></ul>
69
+
70
+ <h2 id="label-Description">Description</h2>
71
+
72
+ <p>Calculates algorithms and data structures for sorting and searching.
73
+ Selects best one to use for particular data set.</p>
74
+
75
+ <p>Additionally, data structures can be used for own purposes. All data
76
+ structures have the ability to insert and search. Will add deletion in the
77
+ future.</p>
78
+
79
+ <p>Written by Joseph Bui.</p>
80
+
81
+ <h3 id="label-Currently+supports+the+following+algorithms+and+data+structures-3A">Currently supports the following algorithms and data structures:</h3>
82
+ <ul><li>
83
+ <p>Sorting (<code>&quot;sort&quot;</code>)</p>
84
+ </li><li>
85
+ <p>Bubble Sort (<code>&quot;bubble_sort&quot;</code>)</p>
86
+ </li><li>
87
+ <p>Insertion Sort (<code>&quot;insertion_sort&quot;</code>)</p>
88
+ </li><li>
89
+ <p>Selection Sort (<code>&quot;selection_sort&quot;</code>)</p>
90
+ </li><li>
91
+ <p>Merge Sort (<code>&quot;merge_sort&quot;</code>)</p>
92
+ </li><li>
93
+ <p>Quick Sort(<code>&quot;quick_sort&quot;</code>)</p>
94
+ </li><li>
95
+ <p>Searching (<code>&quot;search&quot;</code>)</p>
96
+ </li><li>
97
+ <p>Stack (<code>&quot;stack&quot;</code>)</p>
98
+ </li><li>
99
+ <p>Queue (<code>&quot;queue&quot;</code>)</p>
100
+ </li><li>
101
+ <p>Singly-Linked List (<code>&quot;linked_list&quot;</code>)</p>
102
+ </li><li>
103
+ <p>Binary Search Tree (<code>&quot;binary_tree&quot;</code>)</p>
104
+ </li></ul>
105
+
106
+ <h3 id="label-Parameters">Parameters</h3>
107
+ <ul><li>
108
+ <p><code>action</code> is the string of the action, can be
109
+ <code>&quot;sort&quot;</code> or <code>&quot;search&quot;</code></p>
110
+ </li><li>
111
+ <p><code>data_set</code> has to be in array format</p>
112
+ </li><li>
113
+ <p><code>trials</code> is number of test trials (optional, default = 1)</p>
114
+ </li><li>
115
+ <p><code>target</code> is element user wants to search (unnecessary for
116
+ <code>sort</code>, default = null)</p>
117
+ </li><li>
118
+ <p><code>algorithm</code> is the string of the algorithm or data structure</p>
119
+ </li></ul>
120
+
121
+ <h3 id="label-Methods">Methods</h3>
122
+ <ul><li>
123
+ <p><code>all(action, data_set, trials, target)</code></p>
124
+ </li><li>
125
+ <p>Returns the times for each algorithm</p>
126
+ </li><li>
127
+ <p>Example: <code>ruby AlgorithmSelector.all(&quot;sort&quot;, [2,1,4,3],
128
+ 1000) AlgorithmSelector.all(&quot;search&quot;, [2,1,4,3], 1000, 4) </code></p>
129
+ </li><li>
130
+ <p><code>best(action, data_set, trials, target)</code></p>
131
+ </li><li>
132
+ <p>Returns the algorithm with the best time</p>
133
+ </li><li>
134
+ <p>Example: <code>ruby AlgorithmSelector.best(&quot;sort&quot;, [2,1,4,3],
135
+ 1000) AlgorithmSelector.best(&quot;search&quot;, [2,1,4,3], 1000, 4)
136
+ </code></p>
137
+ </li><li>
138
+ <p><code>analyze(action, data_set, algorithm, trials, target)</code></p>
139
+ </li><li>
140
+ <p>Returns time for specified algorithm or data structure</p>
141
+ </li><li>
142
+ <p>Example: <code>ruby AlgorithmSelector.analyze(&quot;sort&quot;, [2,1,4,3],
143
+ &quot;merge_sort&quot;, 1000) AlgorithmSelector.analyze(&quot;search&quot;,
144
+ [2,1,4,3], &quot;linked_list&quot;, 1000, 4) </code></p>
145
+ </li><li>
146
+ <p><code>compare(action, data_set, first_algorithm, second_algorithm, trials,
147
+ target)</code></p>
148
+ </li><li>
149
+ <p>Returns the times of two specified algorithms for comparison</p>
150
+ </li><li>
151
+ <p>Example: <code>ruby AlgorithmSelector.compare(&quot;sort&quot;, [2,1,4,3],
152
+ &quot;merge_sort&quot;, &quot;quick_sort&quot;, 1000)
153
+ AlgorithmSelector.compare(&quot;search&quot;, [2,1,4,3], &quot;stack&quot;,
154
+ &quot;linked_list&quot;, 1000, 4) </code></p>
155
+ </li><li>
156
+ <p><code>sort(data_set, algorithm)</code></p>
157
+ </li><li>
158
+ <p>Returns sorted array of specified sorting algorithm</p>
159
+ </li><li>
160
+ <p>Example: <code>ruby AlgorithmSelector.compare([2,1,4,3],
161
+ &quot;bubble_sort&quot;) </code></p>
162
+ </li></ul>
163
+
164
+ <h3 id="label-Data+Structures">Data Structures</h3>
165
+
166
+ <h4 id="label-Stack">Stack</h4>
167
+ <ul><li>
168
+ <p>Initialize <code>ruby size = 10 stack = Stack.new(size) </code></p>
169
+ </li><li>
170
+ <p>Insertion <code>ruby # returns nil value = 6 stack.push(value)
171
+ </code></p>
172
+ </li><li>
173
+ <p>Search <code>ruby # returns true if found, else returns false target =
174
+ 4 stack.search(target) </code></p>
175
+ </li></ul>
176
+
177
+ <h4 id="label-Queue">Queue</h4>
178
+ <ul><li>
179
+ <p>Initialize <code>ruby size = 10 queue = Queue.new(size) </code></p>
180
+ </li><li>
181
+ <p>Insertion <code>ruby # returns nil value = 6 queue.enqueue(value)
182
+ </code></p>
183
+ </li><li>
184
+ <p>Search <code>ruby # returns true if found, else returns false target =
185
+ 4 queue.search(target) </code></p>
186
+ </li></ul>
187
+
188
+ <h4 id="label-Linked+List">Linked List</h4>
189
+ <ul><li>
190
+ <p>Initialize <code>ruby linked_list = LinkedList.new </code></p>
191
+ </li><li>
192
+ <p>Insertion <code>ruby # returns nil value = 6
193
+ linked_list.insert(value) </code></p>
194
+ </li><li>
195
+ <p>Search <code>ruby # returns true if found, else returns false target =
196
+ 4 linked_list.search(target) </code></p>
197
+ </li></ul>
198
+
199
+ <h4 id="label-Binary+Search+Tree">Binary Search Tree</h4>
200
+ <ul><li>
201
+ <p>Initialize <code>ruby binary_tree = BinaryTree.new </code></p>
202
+ </li><li>
203
+ <p>Insertion <code>ruby # returns nil value = 6
204
+ binary_tree.insert(value) </code></p>
205
+ </li><li>
206
+ <p>Search <code>ruby # returns true if found, else returns false target =
207
+ 4 binary_tree.search(target) </code></p>
208
+ </li></ul>
64
209
 
65
210
  <h2 id="label-Installation">Installation</h2>
66
211
 
@@ -83,26 +228,6 @@
83
228
 
84
229
  <pre class="code ruby"><code class="ruby">$ require &#39;algorithm_selector&#39;</code></pre>
85
230
 
86
- <h3 id="label-Saying+hello">Saying hello</h3>
87
-
88
- <p>You can create a string “hello” by using the test method. For example:</p>
89
-
90
- <p><a href="1">AlgorithmSelector.test(</a>) #=&gt; “hello”</p>
91
-
92
- <h2 id="label-Development">Development</h2>
93
-
94
- <p>After checking out the repo, run <code>bin/setup</code> to install
95
- dependencies. Then, run <code>rake spec</code> to run the tests. You can
96
- also run <code>bin/console</code> for an interactive prompt that will allow
97
- you to experiment.</p>
98
-
99
- <p>To install this gem onto your local machine, run <code>bundle exec rake
100
- install</code>. To release a new version, update the version number in
101
- <code>version.rb</code>, and then run <code>bundle exec rake
102
- release</code>, which will create a git tag for the version, push git
103
- commits and tags, and push the <code>.gem</code> file to <a
104
- href="https://rubygems.org">rubygems.org</a>.</p>
105
-
106
231
  <h2 id="label-Contributing">Contributing</h2>
107
232
 
108
233
  <p>Bug reports and pull requests are welcome on GitHub at <a
@@ -119,7 +244,7 @@ href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
119
244
  </div></div>
120
245
 
121
246
  <div id="footer">
122
- Generated on Fri Jul 22 11:22:30 2016 by
247
+ Generated on Sat Jul 23 23:26:27 2016 by
123
248
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
124
249
  0.9.4 (ruby-2.1.2).
125
250
  </div>
data/doc/index.html CHANGED
@@ -60,7 +60,152 @@
60
60
  <iframe id="search_frame" src="class_list.html"></iframe>
61
61
 
62
62
  <div id="content"><div id='filecontents'>
63
- <h1 id="label-AlgorithmSelector">AlgorithmSelector</h1>
63
+ <h1 id="label-algorithm_selector+rdoc-image-3Ahttps-3A-2F-2Fbadge.fury.io-2Frb-2Falgorithm_selector.svg">algorithm_selector <a href="https://badge.fury.io/rb/algorithm_selector"><img src="https://badge.fury.io/rb/algorithm_selector.svg"></a></h1>
64
+ <ul><li>
65
+ <p><a href="https://rubygems.org/gems/algorithm_selector">Live</a></p>
66
+ </li><li>
67
+ <p><a href="http://www.rubydoc.info/gems/algorithm_selector">Documentation</a></p>
68
+ </li></ul>
69
+
70
+ <h2 id="label-Description">Description</h2>
71
+
72
+ <p>Calculates algorithms and data structures for sorting and searching.
73
+ Selects best one to use for particular data set.</p>
74
+
75
+ <p>Additionally, data structures can be used for own purposes. All data
76
+ structures have the ability to insert and search. Will add deletion in the
77
+ future.</p>
78
+
79
+ <p>Written by Joseph Bui.</p>
80
+
81
+ <h3 id="label-Currently+supports+the+following+algorithms+and+data+structures-3A">Currently supports the following algorithms and data structures:</h3>
82
+ <ul><li>
83
+ <p>Sorting (<code>&quot;sort&quot;</code>)</p>
84
+ </li><li>
85
+ <p>Bubble Sort (<code>&quot;bubble_sort&quot;</code>)</p>
86
+ </li><li>
87
+ <p>Insertion Sort (<code>&quot;insertion_sort&quot;</code>)</p>
88
+ </li><li>
89
+ <p>Selection Sort (<code>&quot;selection_sort&quot;</code>)</p>
90
+ </li><li>
91
+ <p>Merge Sort (<code>&quot;merge_sort&quot;</code>)</p>
92
+ </li><li>
93
+ <p>Quick Sort(<code>&quot;quick_sort&quot;</code>)</p>
94
+ </li><li>
95
+ <p>Searching (<code>&quot;search&quot;</code>)</p>
96
+ </li><li>
97
+ <p>Stack (<code>&quot;stack&quot;</code>)</p>
98
+ </li><li>
99
+ <p>Queue (<code>&quot;queue&quot;</code>)</p>
100
+ </li><li>
101
+ <p>Singly-Linked List (<code>&quot;linked_list&quot;</code>)</p>
102
+ </li><li>
103
+ <p>Binary Search Tree (<code>&quot;binary_tree&quot;</code>)</p>
104
+ </li></ul>
105
+
106
+ <h3 id="label-Parameters">Parameters</h3>
107
+ <ul><li>
108
+ <p><code>action</code> is the string of the action, can be
109
+ <code>&quot;sort&quot;</code> or <code>&quot;search&quot;</code></p>
110
+ </li><li>
111
+ <p><code>data_set</code> has to be in array format</p>
112
+ </li><li>
113
+ <p><code>trials</code> is number of test trials (optional, default = 1)</p>
114
+ </li><li>
115
+ <p><code>target</code> is element user wants to search (unnecessary for
116
+ <code>sort</code>, default = null)</p>
117
+ </li><li>
118
+ <p><code>algorithm</code> is the string of the algorithm or data structure</p>
119
+ </li></ul>
120
+
121
+ <h3 id="label-Methods">Methods</h3>
122
+ <ul><li>
123
+ <p><code>all(action, data_set, trials, target)</code></p>
124
+ </li><li>
125
+ <p>Returns the times for each algorithm</p>
126
+ </li><li>
127
+ <p>Example: <code>ruby AlgorithmSelector.all(&quot;sort&quot;, [2,1,4,3],
128
+ 1000) AlgorithmSelector.all(&quot;search&quot;, [2,1,4,3], 1000, 4) </code></p>
129
+ </li><li>
130
+ <p><code>best(action, data_set, trials, target)</code></p>
131
+ </li><li>
132
+ <p>Returns the algorithm with the best time</p>
133
+ </li><li>
134
+ <p>Example: <code>ruby AlgorithmSelector.best(&quot;sort&quot;, [2,1,4,3],
135
+ 1000) AlgorithmSelector.best(&quot;search&quot;, [2,1,4,3], 1000, 4)
136
+ </code></p>
137
+ </li><li>
138
+ <p><code>analyze(action, data_set, algorithm, trials, target)</code></p>
139
+ </li><li>
140
+ <p>Returns time for specified algorithm or data structure</p>
141
+ </li><li>
142
+ <p>Example: <code>ruby AlgorithmSelector.analyze(&quot;sort&quot;, [2,1,4,3],
143
+ &quot;merge_sort&quot;, 1000) AlgorithmSelector.analyze(&quot;search&quot;,
144
+ [2,1,4,3], &quot;linked_list&quot;, 1000, 4) </code></p>
145
+ </li><li>
146
+ <p><code>compare(action, data_set, first_algorithm, second_algorithm, trials,
147
+ target)</code></p>
148
+ </li><li>
149
+ <p>Returns the times of two specified algorithms for comparison</p>
150
+ </li><li>
151
+ <p>Example: <code>ruby AlgorithmSelector.compare(&quot;sort&quot;, [2,1,4,3],
152
+ &quot;merge_sort&quot;, &quot;quick_sort&quot;, 1000)
153
+ AlgorithmSelector.compare(&quot;search&quot;, [2,1,4,3], &quot;stack&quot;,
154
+ &quot;linked_list&quot;, 1000, 4) </code></p>
155
+ </li><li>
156
+ <p><code>sort(data_set, algorithm)</code></p>
157
+ </li><li>
158
+ <p>Returns sorted array of specified sorting algorithm</p>
159
+ </li><li>
160
+ <p>Example: <code>ruby AlgorithmSelector.compare([2,1,4,3],
161
+ &quot;bubble_sort&quot;) </code></p>
162
+ </li></ul>
163
+
164
+ <h3 id="label-Data+Structures">Data Structures</h3>
165
+
166
+ <h4 id="label-Stack">Stack</h4>
167
+ <ul><li>
168
+ <p>Initialize <code>ruby size = 10 stack = Stack.new(size) </code></p>
169
+ </li><li>
170
+ <p>Insertion <code>ruby # returns nil value = 6 stack.push(value)
171
+ </code></p>
172
+ </li><li>
173
+ <p>Search <code>ruby # returns true if found, else returns false target =
174
+ 4 stack.search(target) </code></p>
175
+ </li></ul>
176
+
177
+ <h4 id="label-Queue">Queue</h4>
178
+ <ul><li>
179
+ <p>Initialize <code>ruby size = 10 queue = Queue.new(size) </code></p>
180
+ </li><li>
181
+ <p>Insertion <code>ruby # returns nil value = 6 queue.enqueue(value)
182
+ </code></p>
183
+ </li><li>
184
+ <p>Search <code>ruby # returns true if found, else returns false target =
185
+ 4 queue.search(target) </code></p>
186
+ </li></ul>
187
+
188
+ <h4 id="label-Linked+List">Linked List</h4>
189
+ <ul><li>
190
+ <p>Initialize <code>ruby linked_list = LinkedList.new </code></p>
191
+ </li><li>
192
+ <p>Insertion <code>ruby # returns nil value = 6
193
+ linked_list.insert(value) </code></p>
194
+ </li><li>
195
+ <p>Search <code>ruby # returns true if found, else returns false target =
196
+ 4 linked_list.search(target) </code></p>
197
+ </li></ul>
198
+
199
+ <h4 id="label-Binary+Search+Tree">Binary Search Tree</h4>
200
+ <ul><li>
201
+ <p>Initialize <code>ruby binary_tree = BinaryTree.new </code></p>
202
+ </li><li>
203
+ <p>Insertion <code>ruby # returns nil value = 6
204
+ binary_tree.insert(value) </code></p>
205
+ </li><li>
206
+ <p>Search <code>ruby # returns true if found, else returns false target =
207
+ 4 binary_tree.search(target) </code></p>
208
+ </li></ul>
64
209
 
65
210
  <h2 id="label-Installation">Installation</h2>
66
211
 
@@ -83,26 +228,6 @@
83
228
 
84
229
  <pre class="code ruby"><code class="ruby">$ require &#39;algorithm_selector&#39;</code></pre>
85
230
 
86
- <h3 id="label-Saying+hello">Saying hello</h3>
87
-
88
- <p>You can create a string “hello” by using the test method. For example:</p>
89
-
90
- <p><a href="1">AlgorithmSelector.test(</a>) #=&gt; “hello”</p>
91
-
92
- <h2 id="label-Development">Development</h2>
93
-
94
- <p>After checking out the repo, run <code>bin/setup</code> to install
95
- dependencies. Then, run <code>rake spec</code> to run the tests. You can
96
- also run <code>bin/console</code> for an interactive prompt that will allow
97
- you to experiment.</p>
98
-
99
- <p>To install this gem onto your local machine, run <code>bundle exec rake
100
- install</code>. To release a new version, update the version number in
101
- <code>version.rb</code>, and then run <code>bundle exec rake
102
- release</code>, which will create a git tag for the version, push git
103
- commits and tags, and push the <code>.gem</code> file to <a
104
- href="https://rubygems.org">rubygems.org</a>.</p>
105
-
106
231
  <h2 id="label-Contributing">Contributing</h2>
107
232
 
108
233
  <p>Bug reports and pull requests are welcome on GitHub at <a
@@ -119,7 +244,7 @@ href="http://opensource.org/licenses/MIT">MIT License</a>.</p>
119
244
  </div></div>
120
245
 
121
246
  <div id="footer">
122
- Generated on Fri Jul 22 11:22:30 2016 by
247
+ Generated on Sat Jul 23 23:26:27 2016 by
123
248
  <a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
124
249
  0.9.4 (ruby-2.1.2).
125
250
  </div>