algorithm_selector 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.DS_Store +0 -0
- data/.gitignore +1 -0
- data/.yardoc/checksums +2 -0
- data/.yardoc/object_types +0 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +45 -0
- data/Rakefile +6 -0
- data/algorithm_selector.gemspec +35 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/doc/AlgorithmSelector.html +505 -0
- data/doc/BSTNode.html +440 -0
- data/doc/BinaryTree.html +572 -0
- data/doc/LinkNode.html +440 -0
- data/doc/LinkedList.html +879 -0
- data/doc/Queue.html +569 -0
- data/doc/Searches.html +442 -0
- data/doc/Sorts.html +916 -0
- data/doc/Stack.html +723 -0
- data/doc/_index.html +183 -0
- data/doc/class_list.html +51 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +58 -0
- data/doc/css/style.css +481 -0
- data/doc/file.README.html +129 -0
- data/doc/file_list.html +56 -0
- data/doc/frames.html +17 -0
- data/doc/index.html +129 -0
- data/doc/js/app.js +243 -0
- data/doc/js/full_list.js +216 -0
- data/doc/js/jquery.js +4 -0
- data/doc/method_list.html +507 -0
- data/doc/top-level-namespace.html +114 -0
- data/lib/.DS_Store +0 -0
- data/lib/algorithm_selector.rb +562 -0
- data/lib/algorithm_selector/version.rb +3 -0
- metadata +129 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 032b14485d824a2c4dd81927fb396ec2e8459eb8
|
4
|
+
data.tar.gz: 978f5e84e437c271fdfa1c01ea9db81ba925cbb7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: edc6f796d8d1021a322c959cc500d0f807a50b894dd446f54b34f14c3a32fafe407a7f65b754be7a5420e31f8f43d274b9aa061a76aa1ed1c9322cb564640b04
|
7
|
+
data.tar.gz: 0b600354d700711fc4095f056685f22d13e369bc3b0cbbde4622be6d920afada8451830332bbefa9d00ea7e7449a23226bcdda38d0872e59667b38c7fd854020
|
data/.DS_Store
ADDED
Binary file
|
data/.gitignore
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
algorithm_selector-0.1.0.gem
|
data/.yardoc/checksums
ADDED
Binary file
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at jnvbui@gmail.com. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2016 joseph
|
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
ADDED
@@ -0,0 +1,45 @@
|
|
1
|
+
# AlgorithmSelector
|
2
|
+
|
3
|
+
## Installation
|
4
|
+
|
5
|
+
Add this line to your application's Gemfile:
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'algorithm_selector'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install algorithm_selector
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
Require the Gem:
|
22
|
+
|
23
|
+
$ require 'algorithm_selector'
|
24
|
+
|
25
|
+
### Saying hello
|
26
|
+
|
27
|
+
You can create a string "hello" by using the test method. For example:
|
28
|
+
|
29
|
+
AlgorithmSelector.test([1])
|
30
|
+
#=> "hello"
|
31
|
+
|
32
|
+
## Development
|
33
|
+
|
34
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
35
|
+
|
36
|
+
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).
|
37
|
+
|
38
|
+
## Contributing
|
39
|
+
|
40
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/algorithm_selector. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
41
|
+
|
42
|
+
|
43
|
+
## License
|
44
|
+
|
45
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
@@ -0,0 +1,35 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'algorithm_selector/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "algorithm_selector"
|
8
|
+
spec.version = AlgorithmSelector::VERSION
|
9
|
+
spec.authors = ["joseph"]
|
10
|
+
spec.email = ["jnvbui@gmail.com"]
|
11
|
+
|
12
|
+
spec.summary = %q{Takes a desired action and data set, returns best algorithm.}
|
13
|
+
spec.description = %q{A gem for determing the most efficient algorithm to use for a particular data set.
|
14
|
+
Currently supports Sorting, Searching, Inserting and Deleting algorithms.
|
15
|
+
Will add Graph Algorithms in the future}
|
16
|
+
spec.homepage = "https://github.com/jnvbui/algorithm_selector"
|
17
|
+
spec.license = "MIT"
|
18
|
+
|
19
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
20
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
21
|
+
# if spec.respond_to?(:metadata)
|
22
|
+
# spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com'"
|
23
|
+
# else
|
24
|
+
# raise "RubyGems 2.0 or newer is required to protect against public gem pushes."
|
25
|
+
# end
|
26
|
+
|
27
|
+
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
28
|
+
spec.bindir = "exe"
|
29
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
30
|
+
spec.require_paths = ["lib"]
|
31
|
+
|
32
|
+
spec.add_development_dependency "bundler", "~> 1.12"
|
33
|
+
spec.add_development_dependency "rake", "~> 10.0"
|
34
|
+
spec.add_development_dependency "rspec", "~> 3.0"
|
35
|
+
end
|
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "algorithm_selector"
|
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
ADDED
@@ -0,0 +1,505 @@
|
|
1
|
+
<!DOCTYPE html>
|
2
|
+
<html>
|
3
|
+
<head>
|
4
|
+
<meta charset="utf-8">
|
5
|
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
6
|
+
<title>
|
7
|
+
Module: AlgorithmSelector
|
8
|
+
|
9
|
+
— Documentation by YARD 0.9.4
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
pathId = "AlgorithmSelector";
|
19
|
+
relpath = '';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
|
23
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
24
|
+
|
25
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
26
|
+
|
27
|
+
|
28
|
+
</head>
|
29
|
+
<body>
|
30
|
+
<div class="nav_wrap">
|
31
|
+
<iframe id="nav" src="class_list.html"></iframe>
|
32
|
+
<div id="resizer"></div>
|
33
|
+
</div>
|
34
|
+
|
35
|
+
<div id="main" tabindex="-1">
|
36
|
+
<div id="header">
|
37
|
+
<div id="menu">
|
38
|
+
|
39
|
+
<a href="_index.html">Index (A)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">AlgorithmSelector</span>
|
43
|
+
|
44
|
+
</div>
|
45
|
+
|
46
|
+
<div id="search">
|
47
|
+
|
48
|
+
<a class="full_list_link" id="class_list_link"
|
49
|
+
href="class_list.html">
|
50
|
+
|
51
|
+
<svg width="24" height="24">
|
52
|
+
<rect x="0" y="4" width="24" height="4" rx="1" ry="1"></rect>
|
53
|
+
<rect x="0" y="12" width="24" height="4" rx="1" ry="1"></rect>
|
54
|
+
<rect x="0" y="20" width="24" height="4" rx="1" ry="1"></rect>
|
55
|
+
</svg>
|
56
|
+
</a>
|
57
|
+
|
58
|
+
</div>
|
59
|
+
<div class="clear"></div>
|
60
|
+
</div>
|
61
|
+
|
62
|
+
<iframe id="search_frame" src="class_list.html"></iframe>
|
63
|
+
|
64
|
+
<div id="content"><h1>Module: AlgorithmSelector
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</h1>
|
69
|
+
<div class="box_info">
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dl>
|
75
|
+
<dt>Extended by:</dt>
|
76
|
+
<dd><span class='object_link'><a href="" title="AlgorithmSelector (module)">AlgorithmSelector</a></span></dd>
|
77
|
+
</dl>
|
78
|
+
|
79
|
+
|
80
|
+
|
81
|
+
|
82
|
+
|
83
|
+
|
84
|
+
<dl>
|
85
|
+
<dt>Included in:</dt>
|
86
|
+
<dd><span class='object_link'><a href="" title="AlgorithmSelector (module)">AlgorithmSelector</a></span></dd>
|
87
|
+
</dl>
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
<dl>
|
92
|
+
<dt>Defined in:</dt>
|
93
|
+
<dd>lib/algorithm_selector.rb<span class="defines">,<br />
|
94
|
+
lib/algorithm_selector/version.rb</span>
|
95
|
+
</dd>
|
96
|
+
</dl>
|
97
|
+
|
98
|
+
</div>
|
99
|
+
|
100
|
+
|
101
|
+
<h2>Constant Summary</h2>
|
102
|
+
<dl class="constants">
|
103
|
+
|
104
|
+
<dt id="VERSION-constant" class="">VERSION =
|
105
|
+
|
106
|
+
</dt>
|
107
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.1.0</span><span class='tstring_end'>"</span></span></pre></dd>
|
108
|
+
|
109
|
+
</dl>
|
110
|
+
|
111
|
+
|
112
|
+
|
113
|
+
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
<h2>
|
119
|
+
Instance Method Summary
|
120
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
121
|
+
</h2>
|
122
|
+
|
123
|
+
<ul class="summary">
|
124
|
+
|
125
|
+
<li class="public ">
|
126
|
+
<span class="summary_signature">
|
127
|
+
|
128
|
+
<a href="#all-instance_method" title="#all (instance method)">#<strong>all</strong>(type, array, num_tests = 1, target = nil) ⇒ Object </a>
|
129
|
+
|
130
|
+
|
131
|
+
|
132
|
+
</span>
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
143
|
+
<p>get all algorithms.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#analyze-instance_method" title="#analyze (instance method)">#<strong>analyze</strong>(type, array, algorithm_name, num_tests = 1, target = nil) ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
<span class="summary_desc"><div class='inline'>
|
167
|
+
<p>get one algorithm by name.</p>
|
168
|
+
</div></span>
|
169
|
+
|
170
|
+
</li>
|
171
|
+
|
172
|
+
|
173
|
+
<li class="public ">
|
174
|
+
<span class="summary_signature">
|
175
|
+
|
176
|
+
<a href="#best-instance_method" title="#best (instance method)">#<strong>best</strong>(type, array, num_tests = 1, target = nil) ⇒ Object </a>
|
177
|
+
|
178
|
+
|
179
|
+
|
180
|
+
</span>
|
181
|
+
|
182
|
+
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
<span class="summary_desc"><div class='inline'>
|
191
|
+
<p>get best algorithm.</p>
|
192
|
+
</div></span>
|
193
|
+
|
194
|
+
</li>
|
195
|
+
|
196
|
+
|
197
|
+
<li class="public ">
|
198
|
+
<span class="summary_signature">
|
199
|
+
|
200
|
+
<a href="#compare-instance_method" title="#compare (instance method)">#<strong>compare</strong>(type, array, first_algorithm_name, second_algorithm_name, num_tests = 1, target = nil) ⇒ Object </a>
|
201
|
+
|
202
|
+
|
203
|
+
|
204
|
+
</span>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
<span class="summary_desc"><div class='inline'>
|
215
|
+
<p>compare two algorithms.</p>
|
216
|
+
</div></span>
|
217
|
+
|
218
|
+
</li>
|
219
|
+
|
220
|
+
|
221
|
+
<li class="public ">
|
222
|
+
<span class="summary_signature">
|
223
|
+
|
224
|
+
<a href="#sort-instance_method" title="#sort (instance method)">#<strong>sort</strong>(array, algorithm_name) ⇒ Object </a>
|
225
|
+
|
226
|
+
|
227
|
+
|
228
|
+
</span>
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
<span class="summary_desc"><div class='inline'>
|
239
|
+
<p>call sort algorithm method.</p>
|
240
|
+
</div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
</ul>
|
246
|
+
|
247
|
+
|
248
|
+
|
249
|
+
|
250
|
+
<div id="instance_method_details" class="method_details_list">
|
251
|
+
<h2>Instance Method Details</h2>
|
252
|
+
|
253
|
+
|
254
|
+
<div class="method_details first">
|
255
|
+
<h3 class="signature first" id="all-instance_method">
|
256
|
+
|
257
|
+
#<strong>all</strong>(type, array, num_tests = 1, target = nil) ⇒ <tt>Object</tt>
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
|
263
|
+
</h3><div class="docstring">
|
264
|
+
<div class="discussion">
|
265
|
+
|
266
|
+
<p>get all algorithms</p>
|
267
|
+
|
268
|
+
|
269
|
+
</div>
|
270
|
+
</div>
|
271
|
+
<div class="tags">
|
272
|
+
|
273
|
+
|
274
|
+
</div><table class="source_code">
|
275
|
+
<tr>
|
276
|
+
<td>
|
277
|
+
<pre class="lines">
|
278
|
+
|
279
|
+
|
280
|
+
7
|
281
|
+
8
|
282
|
+
9
|
283
|
+
10
|
284
|
+
11
|
285
|
+
12
|
286
|
+
13</pre>
|
287
|
+
</td>
|
288
|
+
<td>
|
289
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 7</span>
|
290
|
+
|
291
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_all'>all</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</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>
|
292
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='rparen'>)</span>
|
294
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
296
|
+
<span class='kw'>end</span>
|
297
|
+
<span class='kw'>end</span></pre>
|
298
|
+
</td>
|
299
|
+
</tr>
|
300
|
+
</table>
|
301
|
+
</div>
|
302
|
+
|
303
|
+
<div class="method_details ">
|
304
|
+
<h3 class="signature " id="analyze-instance_method">
|
305
|
+
|
306
|
+
#<strong>analyze</strong>(type, array, algorithm_name, num_tests = 1, target = nil) ⇒ <tt>Object</tt>
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
|
311
|
+
|
312
|
+
</h3><div class="docstring">
|
313
|
+
<div class="discussion">
|
314
|
+
|
315
|
+
<p>get one algorithm by name</p>
|
316
|
+
|
317
|
+
|
318
|
+
</div>
|
319
|
+
</div>
|
320
|
+
<div class="tags">
|
321
|
+
|
322
|
+
|
323
|
+
</div><table class="source_code">
|
324
|
+
<tr>
|
325
|
+
<td>
|
326
|
+
<pre class="lines">
|
327
|
+
|
328
|
+
|
329
|
+
25
|
330
|
+
26
|
331
|
+
27
|
332
|
+
28
|
333
|
+
29
|
334
|
+
30
|
335
|
+
31</pre>
|
336
|
+
</td>
|
337
|
+
<td>
|
338
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 25</span>
|
339
|
+
|
340
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_analyze'>analyze</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm_name'>algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</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>
|
341
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm_name'>algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='rparen'>)</span>
|
343
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm_name'>algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
345
|
+
<span class='kw'>end</span>
|
346
|
+
<span class='kw'>end</span></pre>
|
347
|
+
</td>
|
348
|
+
</tr>
|
349
|
+
</table>
|
350
|
+
</div>
|
351
|
+
|
352
|
+
<div class="method_details ">
|
353
|
+
<h3 class="signature " id="best-instance_method">
|
354
|
+
|
355
|
+
#<strong>best</strong>(type, array, num_tests = 1, target = nil) ⇒ <tt>Object</tt>
|
356
|
+
|
357
|
+
|
358
|
+
|
359
|
+
|
360
|
+
|
361
|
+
</h3><div class="docstring">
|
362
|
+
<div class="discussion">
|
363
|
+
|
364
|
+
<p>get best algorithm</p>
|
365
|
+
|
366
|
+
|
367
|
+
</div>
|
368
|
+
</div>
|
369
|
+
<div class="tags">
|
370
|
+
|
371
|
+
|
372
|
+
</div><table class="source_code">
|
373
|
+
<tr>
|
374
|
+
<td>
|
375
|
+
<pre class="lines">
|
376
|
+
|
377
|
+
|
378
|
+
16
|
379
|
+
17
|
380
|
+
18
|
381
|
+
19
|
382
|
+
20
|
383
|
+
21
|
384
|
+
22</pre>
|
385
|
+
</td>
|
386
|
+
<td>
|
387
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 16</span>
|
388
|
+
|
389
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_best'>best</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</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>
|
390
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='rparen'>)</span>
|
392
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
394
|
+
<span class='kw'>end</span>
|
395
|
+
<span class='kw'>end</span></pre>
|
396
|
+
</td>
|
397
|
+
</tr>
|
398
|
+
</table>
|
399
|
+
</div>
|
400
|
+
|
401
|
+
<div class="method_details ">
|
402
|
+
<h3 class="signature " id="compare-instance_method">
|
403
|
+
|
404
|
+
#<strong>compare</strong>(type, array, first_algorithm_name, second_algorithm_name, num_tests = 1, target = nil) ⇒ <tt>Object</tt>
|
405
|
+
|
406
|
+
|
407
|
+
|
408
|
+
|
409
|
+
|
410
|
+
</h3><div class="docstring">
|
411
|
+
<div class="discussion">
|
412
|
+
|
413
|
+
<p>compare two algorithms</p>
|
414
|
+
|
415
|
+
|
416
|
+
</div>
|
417
|
+
</div>
|
418
|
+
<div class="tags">
|
419
|
+
|
420
|
+
|
421
|
+
</div><table class="source_code">
|
422
|
+
<tr>
|
423
|
+
<td>
|
424
|
+
<pre class="lines">
|
425
|
+
|
426
|
+
|
427
|
+
34
|
428
|
+
35
|
429
|
+
36
|
430
|
+
37
|
431
|
+
38
|
432
|
+
39
|
433
|
+
40</pre>
|
434
|
+
</td>
|
435
|
+
<td>
|
436
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 34</span>
|
437
|
+
|
438
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_compare'>compare</span><span class='lparen'>(</span><span class='id identifier rubyid_type'>type</span><span class='comma'>,</span> <span class='id identifier rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_first_algorithm_name'>first_algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_second_algorithm_name'>second_algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</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>
|
439
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_first_algorithm_name'>first_algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_second_algorithm_name'>second_algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='rparen'>)</span>
|
441
|
+
<span class='kw'>elsif</span> <span class='id identifier rubyid_type'>type</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>
|
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 rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_first_algorithm_name'>first_algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_second_algorithm_name'>second_algorithm_name</span><span class='comma'>,</span> <span class='id identifier rubyid_num_tests'>num_tests</span><span class='comma'>,</span> <span class='id identifier rubyid_target'>target</span><span class='rparen'>)</span>
|
443
|
+
<span class='kw'>end</span>
|
444
|
+
<span class='kw'>end</span></pre>
|
445
|
+
</td>
|
446
|
+
</tr>
|
447
|
+
</table>
|
448
|
+
</div>
|
449
|
+
|
450
|
+
<div class="method_details ">
|
451
|
+
<h3 class="signature " id="sort-instance_method">
|
452
|
+
|
453
|
+
#<strong>sort</strong>(array, algorithm_name) ⇒ <tt>Object</tt>
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
</h3><div class="docstring">
|
460
|
+
<div class="discussion">
|
461
|
+
|
462
|
+
<p>call sort algorithm method</p>
|
463
|
+
|
464
|
+
|
465
|
+
</div>
|
466
|
+
</div>
|
467
|
+
<div class="tags">
|
468
|
+
|
469
|
+
|
470
|
+
</div><table class="source_code">
|
471
|
+
<tr>
|
472
|
+
<td>
|
473
|
+
<pre class="lines">
|
474
|
+
|
475
|
+
|
476
|
+
43
|
477
|
+
44
|
478
|
+
45
|
479
|
+
46</pre>
|
480
|
+
</td>
|
481
|
+
<td>
|
482
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 43</span>
|
483
|
+
|
484
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_sort'>sort</span><span class='lparen'>(</span><span class='id identifier rubyid_array'>array</span><span class='comma'>,</span> <span class='id identifier rubyid_algorithm_name'>algorithm_name</span><span class='rparen'>)</span>
|
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 rubyid_algorithm_name'>algorithm_name</span><span class='rparen'>)</span>
|
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 rubyid_array'>array</span><span class='rparen'>)</span>
|
487
|
+
<span class='kw'>end</span></pre>
|
488
|
+
</td>
|
489
|
+
</tr>
|
490
|
+
</table>
|
491
|
+
</div>
|
492
|
+
|
493
|
+
</div>
|
494
|
+
|
495
|
+
</div>
|
496
|
+
|
497
|
+
<div id="footer">
|
498
|
+
Generated on Fri Jul 22 11:22:30 2016 by
|
499
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
500
|
+
0.9.4 (ruby-2.1.2).
|
501
|
+
</div>
|
502
|
+
|
503
|
+
</div>
|
504
|
+
</body>
|
505
|
+
</html>
|