algorithm_selector 0.1.0
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 +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
data/doc/LinkNode.html
ADDED
@@ -0,0 +1,440 @@
|
|
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
|
+
Class: LinkNode
|
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 = "LinkNode";
|
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 (L)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">LinkNode</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>Class: LinkNode
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</h1>
|
69
|
+
<div class="box_info">
|
70
|
+
|
71
|
+
<dl>
|
72
|
+
<dt>Inherits:</dt>
|
73
|
+
<dd>
|
74
|
+
<span class="inheritName">Object</span>
|
75
|
+
|
76
|
+
<ul class="fullTree">
|
77
|
+
<li>Object</li>
|
78
|
+
|
79
|
+
<li class="next">LinkNode</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
|
94
|
+
|
95
|
+
|
96
|
+
|
97
|
+
<dl>
|
98
|
+
<dt>Defined in:</dt>
|
99
|
+
<dd>lib/algorithm_selector.rb</dd>
|
100
|
+
</dl>
|
101
|
+
|
102
|
+
</div>
|
103
|
+
|
104
|
+
<h2>Overview</h2><div class="docstring">
|
105
|
+
<div class="discussion">
|
106
|
+
|
107
|
+
<p>Node helper class for Linked List</p>
|
108
|
+
|
109
|
+
|
110
|
+
</div>
|
111
|
+
</div>
|
112
|
+
<div class="tags">
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
<h2>Instance Attribute Summary <small><a href="#" class="summary_toggle">collapse</a></small></h2>
|
120
|
+
<ul class="summary">
|
121
|
+
|
122
|
+
<li class="public ">
|
123
|
+
<span class="summary_signature">
|
124
|
+
|
125
|
+
<a href="#next-instance_method" title="#next (instance method)">#<strong>next</strong> ⇒ Object </a>
|
126
|
+
|
127
|
+
|
128
|
+
|
129
|
+
</span>
|
130
|
+
|
131
|
+
|
132
|
+
|
133
|
+
|
134
|
+
|
135
|
+
|
136
|
+
|
137
|
+
|
138
|
+
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
<span class="summary_desc"><div class='inline'>
|
143
|
+
<p>Returns the value of attribute next.</p>
|
144
|
+
</div></span>
|
145
|
+
|
146
|
+
</li>
|
147
|
+
|
148
|
+
|
149
|
+
<li class="public ">
|
150
|
+
<span class="summary_signature">
|
151
|
+
|
152
|
+
<a href="#prev-instance_method" title="#prev (instance method)">#<strong>prev</strong> ⇒ Object </a>
|
153
|
+
|
154
|
+
|
155
|
+
|
156
|
+
</span>
|
157
|
+
|
158
|
+
|
159
|
+
|
160
|
+
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
<span class="summary_desc"><div class='inline'>
|
170
|
+
<p>Returns the value of attribute prev.</p>
|
171
|
+
</div></span>
|
172
|
+
|
173
|
+
</li>
|
174
|
+
|
175
|
+
|
176
|
+
<li class="public ">
|
177
|
+
<span class="summary_signature">
|
178
|
+
|
179
|
+
<a href="#val-instance_method" title="#val (instance method)">#<strong>val</strong> ⇒ Object </a>
|
180
|
+
|
181
|
+
|
182
|
+
|
183
|
+
</span>
|
184
|
+
|
185
|
+
|
186
|
+
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<span class="summary_desc"><div class='inline'>
|
197
|
+
<p>Returns the value of attribute val.</p>
|
198
|
+
</div></span>
|
199
|
+
|
200
|
+
</li>
|
201
|
+
|
202
|
+
|
203
|
+
</ul>
|
204
|
+
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
|
209
|
+
<h2>
|
210
|
+
Instance Method Summary
|
211
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
212
|
+
</h2>
|
213
|
+
|
214
|
+
<ul class="summary">
|
215
|
+
|
216
|
+
<li class="public ">
|
217
|
+
<span class="summary_signature">
|
218
|
+
|
219
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(val = nil) ⇒ LinkNode </a>
|
220
|
+
|
221
|
+
|
222
|
+
|
223
|
+
</span>
|
224
|
+
|
225
|
+
|
226
|
+
<span class="note title constructor">constructor</span>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
<span class="summary_desc"><div class='inline'>
|
236
|
+
<p>A new instance of LinkNode.</p>
|
237
|
+
</div></span>
|
238
|
+
|
239
|
+
</li>
|
240
|
+
|
241
|
+
|
242
|
+
</ul>
|
243
|
+
|
244
|
+
|
245
|
+
<div id="constructor_details" class="method_details_list">
|
246
|
+
<h2>Constructor Details</h2>
|
247
|
+
|
248
|
+
<div class="method_details first">
|
249
|
+
<h3 class="signature first" id="initialize-instance_method">
|
250
|
+
|
251
|
+
#<strong>initialize</strong>(val = nil) ⇒ <tt><span class='object_link'><a href="" title="LinkNode (class)">LinkNode</a></span></tt>
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
</h3><div class="docstring">
|
258
|
+
<div class="discussion">
|
259
|
+
|
260
|
+
<p>Returns a new instance of LinkNode</p>
|
261
|
+
|
262
|
+
|
263
|
+
</div>
|
264
|
+
</div>
|
265
|
+
<div class="tags">
|
266
|
+
|
267
|
+
|
268
|
+
</div><table class="source_code">
|
269
|
+
<tr>
|
270
|
+
<td>
|
271
|
+
<pre class="lines">
|
272
|
+
|
273
|
+
|
274
|
+
547
|
275
|
+
548
|
276
|
+
549
|
277
|
+
550
|
278
|
+
551</pre>
|
279
|
+
</td>
|
280
|
+
<td>
|
281
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 547</span>
|
282
|
+
|
283
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='op'>=</span><span class='kw'>nil</span><span class='rparen'>)</span>
|
284
|
+
<span class='ivar'>@val</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span>
|
285
|
+
<span class='ivar'>@next</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
286
|
+
<span class='ivar'>@prev</span> <span class='op'>=</span> <span class='kw'>nil</span>
|
287
|
+
<span class='kw'>end</span></pre>
|
288
|
+
</td>
|
289
|
+
</tr>
|
290
|
+
</table>
|
291
|
+
</div>
|
292
|
+
|
293
|
+
</div>
|
294
|
+
|
295
|
+
<div id="instance_attr_details" class="attr_details">
|
296
|
+
<h2>Instance Attribute Details</h2>
|
297
|
+
|
298
|
+
|
299
|
+
<span id="next=-instance_method"></span>
|
300
|
+
<div class="method_details first">
|
301
|
+
<h3 class="signature first" id="next-instance_method">
|
302
|
+
|
303
|
+
#<strong>next</strong> ⇒ <tt>Object</tt>
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
</h3><div class="docstring">
|
310
|
+
<div class="discussion">
|
311
|
+
|
312
|
+
<p>Returns the value of attribute next</p>
|
313
|
+
|
314
|
+
|
315
|
+
</div>
|
316
|
+
</div>
|
317
|
+
<div class="tags">
|
318
|
+
|
319
|
+
|
320
|
+
</div><table class="source_code">
|
321
|
+
<tr>
|
322
|
+
<td>
|
323
|
+
<pre class="lines">
|
324
|
+
|
325
|
+
|
326
|
+
546
|
327
|
+
547
|
328
|
+
548</pre>
|
329
|
+
</td>
|
330
|
+
<td>
|
331
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 546</span>
|
332
|
+
|
333
|
+
<span class='kw'>def</span> <span class='kw'>next</span>
|
334
|
+
<span class='ivar'>@next</span>
|
335
|
+
<span class='kw'>end</span></pre>
|
336
|
+
</td>
|
337
|
+
</tr>
|
338
|
+
</table>
|
339
|
+
</div>
|
340
|
+
|
341
|
+
|
342
|
+
<span id="prev=-instance_method"></span>
|
343
|
+
<div class="method_details ">
|
344
|
+
<h3 class="signature " id="prev-instance_method">
|
345
|
+
|
346
|
+
#<strong>prev</strong> ⇒ <tt>Object</tt>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
</h3><div class="docstring">
|
353
|
+
<div class="discussion">
|
354
|
+
|
355
|
+
<p>Returns the value of attribute prev</p>
|
356
|
+
|
357
|
+
|
358
|
+
</div>
|
359
|
+
</div>
|
360
|
+
<div class="tags">
|
361
|
+
|
362
|
+
|
363
|
+
</div><table class="source_code">
|
364
|
+
<tr>
|
365
|
+
<td>
|
366
|
+
<pre class="lines">
|
367
|
+
|
368
|
+
|
369
|
+
546
|
370
|
+
547
|
371
|
+
548</pre>
|
372
|
+
</td>
|
373
|
+
<td>
|
374
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 546</span>
|
375
|
+
|
376
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_prev'>prev</span>
|
377
|
+
<span class='ivar'>@prev</span>
|
378
|
+
<span class='kw'>end</span></pre>
|
379
|
+
</td>
|
380
|
+
</tr>
|
381
|
+
</table>
|
382
|
+
</div>
|
383
|
+
|
384
|
+
|
385
|
+
<span id="val=-instance_method"></span>
|
386
|
+
<div class="method_details ">
|
387
|
+
<h3 class="signature " id="val-instance_method">
|
388
|
+
|
389
|
+
#<strong>val</strong> ⇒ <tt>Object</tt>
|
390
|
+
|
391
|
+
|
392
|
+
|
393
|
+
|
394
|
+
|
395
|
+
</h3><div class="docstring">
|
396
|
+
<div class="discussion">
|
397
|
+
|
398
|
+
<p>Returns the value of attribute val</p>
|
399
|
+
|
400
|
+
|
401
|
+
</div>
|
402
|
+
</div>
|
403
|
+
<div class="tags">
|
404
|
+
|
405
|
+
|
406
|
+
</div><table class="source_code">
|
407
|
+
<tr>
|
408
|
+
<td>
|
409
|
+
<pre class="lines">
|
410
|
+
|
411
|
+
|
412
|
+
546
|
413
|
+
547
|
414
|
+
548</pre>
|
415
|
+
</td>
|
416
|
+
<td>
|
417
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 546</span>
|
418
|
+
|
419
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_val'>val</span>
|
420
|
+
<span class='ivar'>@val</span>
|
421
|
+
<span class='kw'>end</span></pre>
|
422
|
+
</td>
|
423
|
+
</tr>
|
424
|
+
</table>
|
425
|
+
</div>
|
426
|
+
|
427
|
+
</div>
|
428
|
+
|
429
|
+
|
430
|
+
</div>
|
431
|
+
|
432
|
+
<div id="footer">
|
433
|
+
Generated on Fri Jul 22 11:22:31 2016 by
|
434
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
435
|
+
0.9.4 (ruby-2.1.2).
|
436
|
+
</div>
|
437
|
+
|
438
|
+
</div>
|
439
|
+
</body>
|
440
|
+
</html>
|
data/doc/LinkedList.html
ADDED
@@ -0,0 +1,879 @@
|
|
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
|
+
Class: LinkedList
|
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 = "LinkedList";
|
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 (L)</a> »
|
40
|
+
|
41
|
+
|
42
|
+
<span class="title">LinkedList</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>Class: LinkedList
|
65
|
+
|
66
|
+
|
67
|
+
|
68
|
+
</h1>
|
69
|
+
<div class="box_info">
|
70
|
+
|
71
|
+
<dl>
|
72
|
+
<dt>Inherits:</dt>
|
73
|
+
<dd>
|
74
|
+
<span class="inheritName">Object</span>
|
75
|
+
|
76
|
+
<ul class="fullTree">
|
77
|
+
<li>Object</li>
|
78
|
+
|
79
|
+
<li class="next">LinkedList</li>
|
80
|
+
|
81
|
+
</ul>
|
82
|
+
<a href="#" class="inheritanceTree">show all</a>
|
83
|
+
|
84
|
+
</dd>
|
85
|
+
</dl>
|
86
|
+
|
87
|
+
|
88
|
+
|
89
|
+
|
90
|
+
|
91
|
+
|
92
|
+
<dl>
|
93
|
+
<dt>Includes:</dt>
|
94
|
+
<dd>Enumerable</dd>
|
95
|
+
</dl>
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
<dl>
|
103
|
+
<dt>Defined in:</dt>
|
104
|
+
<dd>lib/algorithm_selector.rb</dd>
|
105
|
+
</dl>
|
106
|
+
|
107
|
+
</div>
|
108
|
+
|
109
|
+
<h2>Overview</h2><div class="docstring">
|
110
|
+
<div class="discussion">
|
111
|
+
|
112
|
+
<p>Singly-Linked List data structure Worst-Case Space Complexity: O(n)</p>
|
113
|
+
|
114
|
+
|
115
|
+
</div>
|
116
|
+
</div>
|
117
|
+
<div class="tags">
|
118
|
+
|
119
|
+
|
120
|
+
</div>
|
121
|
+
|
122
|
+
|
123
|
+
|
124
|
+
|
125
|
+
|
126
|
+
|
127
|
+
|
128
|
+
<h2>
|
129
|
+
Instance Method Summary
|
130
|
+
<small><a href="#" class="summary_toggle">collapse</a></small>
|
131
|
+
</h2>
|
132
|
+
|
133
|
+
<ul class="summary">
|
134
|
+
|
135
|
+
<li class="public ">
|
136
|
+
<span class="summary_signature">
|
137
|
+
|
138
|
+
<a href="#%5B%5D-instance_method" title="#[] (instance method)">#<strong>[]</strong>(i) ⇒ Object </a>
|
139
|
+
|
140
|
+
|
141
|
+
|
142
|
+
</span>
|
143
|
+
|
144
|
+
|
145
|
+
|
146
|
+
|
147
|
+
|
148
|
+
|
149
|
+
|
150
|
+
|
151
|
+
|
152
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
153
|
+
|
154
|
+
</li>
|
155
|
+
|
156
|
+
|
157
|
+
<li class="public ">
|
158
|
+
<span class="summary_signature">
|
159
|
+
|
160
|
+
<a href="#each-instance_method" title="#each (instance method)">#<strong>each</strong> ⇒ Object </a>
|
161
|
+
|
162
|
+
|
163
|
+
|
164
|
+
</span>
|
165
|
+
|
166
|
+
|
167
|
+
|
168
|
+
|
169
|
+
|
170
|
+
|
171
|
+
|
172
|
+
|
173
|
+
|
174
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
175
|
+
|
176
|
+
</li>
|
177
|
+
|
178
|
+
|
179
|
+
<li class="public ">
|
180
|
+
<span class="summary_signature">
|
181
|
+
|
182
|
+
<a href="#empty%3F-instance_method" title="#empty? (instance method)">#<strong>empty?</strong> ⇒ Boolean </a>
|
183
|
+
|
184
|
+
|
185
|
+
|
186
|
+
</span>
|
187
|
+
|
188
|
+
|
189
|
+
|
190
|
+
|
191
|
+
|
192
|
+
|
193
|
+
|
194
|
+
|
195
|
+
|
196
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
197
|
+
|
198
|
+
</li>
|
199
|
+
|
200
|
+
|
201
|
+
<li class="public ">
|
202
|
+
<span class="summary_signature">
|
203
|
+
|
204
|
+
<a href="#first-instance_method" title="#first (instance method)">#<strong>first</strong> ⇒ Object </a>
|
205
|
+
|
206
|
+
|
207
|
+
|
208
|
+
</span>
|
209
|
+
|
210
|
+
|
211
|
+
|
212
|
+
|
213
|
+
|
214
|
+
|
215
|
+
|
216
|
+
|
217
|
+
|
218
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
219
|
+
|
220
|
+
</li>
|
221
|
+
|
222
|
+
|
223
|
+
<li class="public ">
|
224
|
+
<span class="summary_signature">
|
225
|
+
|
226
|
+
<a href="#get-instance_method" title="#get (instance method)">#<strong>get</strong>(val) ⇒ Object </a>
|
227
|
+
|
228
|
+
|
229
|
+
|
230
|
+
</span>
|
231
|
+
|
232
|
+
|
233
|
+
|
234
|
+
|
235
|
+
|
236
|
+
|
237
|
+
|
238
|
+
|
239
|
+
|
240
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
241
|
+
|
242
|
+
</li>
|
243
|
+
|
244
|
+
|
245
|
+
<li class="public ">
|
246
|
+
<span class="summary_signature">
|
247
|
+
|
248
|
+
<a href="#include%3F-instance_method" title="#include? (instance method)">#<strong>include?</strong>(val) ⇒ Boolean </a>
|
249
|
+
|
250
|
+
|
251
|
+
|
252
|
+
</span>
|
253
|
+
|
254
|
+
|
255
|
+
|
256
|
+
|
257
|
+
|
258
|
+
|
259
|
+
|
260
|
+
|
261
|
+
|
262
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
263
|
+
|
264
|
+
</li>
|
265
|
+
|
266
|
+
|
267
|
+
<li class="public ">
|
268
|
+
<span class="summary_signature">
|
269
|
+
|
270
|
+
<a href="#initialize-instance_method" title="#initialize (instance method)">#<strong>initialize</strong>(array = []) ⇒ LinkedList </a>
|
271
|
+
|
272
|
+
|
273
|
+
|
274
|
+
</span>
|
275
|
+
|
276
|
+
|
277
|
+
<span class="note title constructor">constructor</span>
|
278
|
+
|
279
|
+
|
280
|
+
|
281
|
+
|
282
|
+
|
283
|
+
|
284
|
+
|
285
|
+
|
286
|
+
<span class="summary_desc"><div class='inline'>
|
287
|
+
<p>A new instance of LinkedList.</p>
|
288
|
+
</div></span>
|
289
|
+
|
290
|
+
</li>
|
291
|
+
|
292
|
+
|
293
|
+
<li class="public ">
|
294
|
+
<span class="summary_signature">
|
295
|
+
|
296
|
+
<a href="#insert-instance_method" title="#insert (instance method)">#<strong>insert</strong>(val) ⇒ Object </a>
|
297
|
+
|
298
|
+
|
299
|
+
|
300
|
+
</span>
|
301
|
+
|
302
|
+
|
303
|
+
|
304
|
+
|
305
|
+
|
306
|
+
|
307
|
+
|
308
|
+
|
309
|
+
|
310
|
+
<span class="summary_desc"><div class='inline'>
|
311
|
+
<p>Insertion, Worst-Case Time Complexity: O(1).</p>
|
312
|
+
</div></span>
|
313
|
+
|
314
|
+
</li>
|
315
|
+
|
316
|
+
|
317
|
+
<li class="public ">
|
318
|
+
<span class="summary_signature">
|
319
|
+
|
320
|
+
<a href="#last-instance_method" title="#last (instance method)">#<strong>last</strong> ⇒ Object </a>
|
321
|
+
|
322
|
+
|
323
|
+
|
324
|
+
</span>
|
325
|
+
|
326
|
+
|
327
|
+
|
328
|
+
|
329
|
+
|
330
|
+
|
331
|
+
|
332
|
+
|
333
|
+
|
334
|
+
<span class="summary_desc"><div class='inline'></div></span>
|
335
|
+
|
336
|
+
</li>
|
337
|
+
|
338
|
+
|
339
|
+
<li class="public ">
|
340
|
+
<span class="summary_signature">
|
341
|
+
|
342
|
+
<a href="#remove-instance_method" title="#remove (instance method)">#<strong>remove</strong>(val) ⇒ Object </a>
|
343
|
+
|
344
|
+
|
345
|
+
|
346
|
+
</span>
|
347
|
+
|
348
|
+
|
349
|
+
|
350
|
+
|
351
|
+
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
|
356
|
+
<span class="summary_desc"><div class='inline'>
|
357
|
+
<p>Deletion, Worst-Case Time Complexity: O(1).</p>
|
358
|
+
</div></span>
|
359
|
+
|
360
|
+
</li>
|
361
|
+
|
362
|
+
|
363
|
+
<li class="public ">
|
364
|
+
<span class="summary_signature">
|
365
|
+
|
366
|
+
<a href="#search-instance_method" title="#search (instance method)">#<strong>search</strong>(target) ⇒ Object </a>
|
367
|
+
|
368
|
+
|
369
|
+
|
370
|
+
</span>
|
371
|
+
|
372
|
+
|
373
|
+
|
374
|
+
|
375
|
+
|
376
|
+
|
377
|
+
|
378
|
+
|
379
|
+
|
380
|
+
<span class="summary_desc"><div class='inline'>
|
381
|
+
<p>Search, Worst-Case Time Complexity: O(n).</p>
|
382
|
+
</div></span>
|
383
|
+
|
384
|
+
</li>
|
385
|
+
|
386
|
+
|
387
|
+
</ul>
|
388
|
+
|
389
|
+
|
390
|
+
|
391
|
+
<div id="constructor_details" class="method_details_list">
|
392
|
+
<h2>Constructor Details</h2>
|
393
|
+
|
394
|
+
<div class="method_details first">
|
395
|
+
<h3 class="signature first" id="initialize-instance_method">
|
396
|
+
|
397
|
+
#<strong>initialize</strong>(array = []) ⇒ <tt><span class='object_link'><a href="" title="LinkedList (class)">LinkedList</a></span></tt>
|
398
|
+
|
399
|
+
|
400
|
+
|
401
|
+
|
402
|
+
|
403
|
+
</h3><div class="docstring">
|
404
|
+
<div class="discussion">
|
405
|
+
|
406
|
+
<p>Returns a new instance of LinkedList</p>
|
407
|
+
|
408
|
+
|
409
|
+
</div>
|
410
|
+
</div>
|
411
|
+
<div class="tags">
|
412
|
+
|
413
|
+
|
414
|
+
</div><table class="source_code">
|
415
|
+
<tr>
|
416
|
+
<td>
|
417
|
+
<pre class="lines">
|
418
|
+
|
419
|
+
|
420
|
+
399
|
421
|
+
400
|
422
|
+
401
|
423
|
+
402
|
424
|
+
403
|
425
|
+
404
|
426
|
+
405</pre>
|
427
|
+
</td>
|
428
|
+
<td>
|
429
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 399</span>
|
430
|
+
|
431
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_initialize'>initialize</span><span class='lparen'>(</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>
|
432
|
+
<span class='ivar'>@head</span> <span class='op'>=</span> <span class='const'>LinkNode</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
433
|
+
<span class='ivar'>@tail</span> <span class='op'>=</span> <span class='const'>LinkNode</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span>
|
434
|
+
<span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span> <span class='op'>=</span> <span class='ivar'>@tail</span>
|
435
|
+
<span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='ivar'>@head</span>
|
436
|
+
<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_i'>i</span><span class='op'>|</span> <span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span> <span class='rbrace'>}</span>
|
437
|
+
<span class='kw'>end</span></pre>
|
438
|
+
</td>
|
439
|
+
</tr>
|
440
|
+
</table>
|
441
|
+
</div>
|
442
|
+
|
443
|
+
</div>
|
444
|
+
|
445
|
+
|
446
|
+
<div id="instance_method_details" class="method_details_list">
|
447
|
+
<h2>Instance Method Details</h2>
|
448
|
+
|
449
|
+
|
450
|
+
<div class="method_details first">
|
451
|
+
<h3 class="signature first" id="[]-instance_method">
|
452
|
+
|
453
|
+
#<strong>[]</strong>(i) ⇒ <tt>Object</tt>
|
454
|
+
|
455
|
+
|
456
|
+
|
457
|
+
|
458
|
+
|
459
|
+
</h3><table class="source_code">
|
460
|
+
<tr>
|
461
|
+
<td>
|
462
|
+
<pre class="lines">
|
463
|
+
|
464
|
+
|
465
|
+
412
|
466
|
+
413
|
467
|
+
414
|
468
|
+
415</pre>
|
469
|
+
</td>
|
470
|
+
<td>
|
471
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 412</span>
|
472
|
+
|
473
|
+
<span class='kw'>def</span> <span class='op'>[]</span><span class='lparen'>(</span><span class='id identifier rubyid_i'>i</span><span class='rparen'>)</span>
|
474
|
+
<span class='id identifier rubyid_each_with_index'>each_with_index</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_link'>link</span><span class='comma'>,</span> <span class='id identifier rubyid_j'>j</span><span class='op'>|</span> <span class='kw'>return</span> <span class='id identifier rubyid_link'>link</span> <span class='kw'>if</span> <span class='id identifier rubyid_i'>i</span> <span class='op'>==</span> <span class='id identifier rubyid_j'>j</span> <span class='rbrace'>}</span>
|
475
|
+
<span class='kw'>nil</span>
|
476
|
+
<span class='kw'>end</span></pre>
|
477
|
+
</td>
|
478
|
+
</tr>
|
479
|
+
</table>
|
480
|
+
</div>
|
481
|
+
|
482
|
+
<div class="method_details ">
|
483
|
+
<h3 class="signature " id="each-instance_method">
|
484
|
+
|
485
|
+
#<strong>each</strong> ⇒ <tt>Object</tt>
|
486
|
+
|
487
|
+
|
488
|
+
|
489
|
+
|
490
|
+
|
491
|
+
</h3><table class="source_code">
|
492
|
+
<tr>
|
493
|
+
<td>
|
494
|
+
<pre class="lines">
|
495
|
+
|
496
|
+
|
497
|
+
462
|
498
|
+
463
|
499
|
+
464
|
500
|
+
465
|
501
|
+
466
|
502
|
+
467
|
503
|
+
468</pre>
|
504
|
+
</td>
|
505
|
+
<td>
|
506
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 462</span>
|
507
|
+
|
508
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_each'>each</span>
|
509
|
+
<span class='id identifier rubyid_current_link'>current_link</span> <span class='op'>=</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
|
510
|
+
<span class='kw'>until</span> <span class='id identifier rubyid_current_link'>current_link</span> <span class='op'>==</span> <span class='ivar'>@tail</span>
|
511
|
+
<span class='kw'>yield</span> <span class='id identifier rubyid_current_link'>current_link</span>
|
512
|
+
<span class='id identifier rubyid_current_link'>current_link</span> <span class='op'>=</span> <span class='id identifier rubyid_current_link'>current_link</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
|
513
|
+
<span class='kw'>end</span>
|
514
|
+
<span class='kw'>end</span></pre>
|
515
|
+
</td>
|
516
|
+
</tr>
|
517
|
+
</table>
|
518
|
+
</div>
|
519
|
+
|
520
|
+
<div class="method_details ">
|
521
|
+
<h3 class="signature " id="empty?-instance_method">
|
522
|
+
|
523
|
+
#<strong>empty?</strong> ⇒ <tt>Boolean</tt>
|
524
|
+
|
525
|
+
|
526
|
+
|
527
|
+
|
528
|
+
|
529
|
+
</h3><div class="docstring">
|
530
|
+
<div class="discussion">
|
531
|
+
|
532
|
+
|
533
|
+
</div>
|
534
|
+
</div>
|
535
|
+
<div class="tags">
|
536
|
+
|
537
|
+
<p class="tag_title">Returns:</p>
|
538
|
+
<ul class="return">
|
539
|
+
|
540
|
+
<li>
|
541
|
+
|
542
|
+
|
543
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
</li>
|
548
|
+
|
549
|
+
</ul>
|
550
|
+
|
551
|
+
</div><table class="source_code">
|
552
|
+
<tr>
|
553
|
+
<td>
|
554
|
+
<pre class="lines">
|
555
|
+
|
556
|
+
|
557
|
+
425
|
558
|
+
426
|
559
|
+
427</pre>
|
560
|
+
</td>
|
561
|
+
<td>
|
562
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 425</span>
|
563
|
+
|
564
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_empty?'>empty?</span>
|
565
|
+
<span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span> <span class='op'>==</span> <span class='ivar'>@tail</span>
|
566
|
+
<span class='kw'>end</span></pre>
|
567
|
+
</td>
|
568
|
+
</tr>
|
569
|
+
</table>
|
570
|
+
</div>
|
571
|
+
|
572
|
+
<div class="method_details ">
|
573
|
+
<h3 class="signature " id="first-instance_method">
|
574
|
+
|
575
|
+
#<strong>first</strong> ⇒ <tt>Object</tt>
|
576
|
+
|
577
|
+
|
578
|
+
|
579
|
+
|
580
|
+
|
581
|
+
</h3><table class="source_code">
|
582
|
+
<tr>
|
583
|
+
<td>
|
584
|
+
<pre class="lines">
|
585
|
+
|
586
|
+
|
587
|
+
417
|
588
|
+
418
|
589
|
+
419</pre>
|
590
|
+
</td>
|
591
|
+
<td>
|
592
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 417</span>
|
593
|
+
|
594
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_first'>first</span>
|
595
|
+
<span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='ivar'>@head</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
|
596
|
+
<span class='kw'>end</span></pre>
|
597
|
+
</td>
|
598
|
+
</tr>
|
599
|
+
</table>
|
600
|
+
</div>
|
601
|
+
|
602
|
+
<div class="method_details ">
|
603
|
+
<h3 class="signature " id="get-instance_method">
|
604
|
+
|
605
|
+
#<strong>get</strong>(val) ⇒ <tt>Object</tt>
|
606
|
+
|
607
|
+
|
608
|
+
|
609
|
+
|
610
|
+
|
611
|
+
</h3><table class="source_code">
|
612
|
+
<tr>
|
613
|
+
<td>
|
614
|
+
<pre class="lines">
|
615
|
+
|
616
|
+
|
617
|
+
429
|
618
|
+
430
|
619
|
+
431
|
620
|
+
432</pre>
|
621
|
+
</td>
|
622
|
+
<td>
|
623
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 429</span>
|
624
|
+
|
625
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_get'>get</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
626
|
+
<span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_link'>link</span><span class='op'>|</span> <span class='kw'>return</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='kw'>if</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='id identifier rubyid_val'>val</span> <span class='rbrace'>}</span>
|
627
|
+
<span class='kw'>nil</span>
|
628
|
+
<span class='kw'>end</span></pre>
|
629
|
+
</td>
|
630
|
+
</tr>
|
631
|
+
</table>
|
632
|
+
</div>
|
633
|
+
|
634
|
+
<div class="method_details ">
|
635
|
+
<h3 class="signature " id="include?-instance_method">
|
636
|
+
|
637
|
+
#<strong>include?</strong>(val) ⇒ <tt>Boolean</tt>
|
638
|
+
|
639
|
+
|
640
|
+
|
641
|
+
|
642
|
+
|
643
|
+
</h3><div class="docstring">
|
644
|
+
<div class="discussion">
|
645
|
+
|
646
|
+
|
647
|
+
</div>
|
648
|
+
</div>
|
649
|
+
<div class="tags">
|
650
|
+
|
651
|
+
<p class="tag_title">Returns:</p>
|
652
|
+
<ul class="return">
|
653
|
+
|
654
|
+
<li>
|
655
|
+
|
656
|
+
|
657
|
+
<span class='type'>(<tt>Boolean</tt>)</span>
|
658
|
+
|
659
|
+
|
660
|
+
|
661
|
+
</li>
|
662
|
+
|
663
|
+
</ul>
|
664
|
+
|
665
|
+
</div><table class="source_code">
|
666
|
+
<tr>
|
667
|
+
<td>
|
668
|
+
<pre class="lines">
|
669
|
+
|
670
|
+
|
671
|
+
434
|
672
|
+
435
|
673
|
+
436</pre>
|
674
|
+
</td>
|
675
|
+
<td>
|
676
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 434</span>
|
677
|
+
|
678
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_include?'>include?</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
679
|
+
<span class='id identifier rubyid_any?'>any?</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_link'>link</span><span class='op'>|</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='id identifier rubyid_val'>val</span> <span class='rbrace'>}</span>
|
680
|
+
<span class='kw'>end</span></pre>
|
681
|
+
</td>
|
682
|
+
</tr>
|
683
|
+
</table>
|
684
|
+
</div>
|
685
|
+
|
686
|
+
<div class="method_details ">
|
687
|
+
<h3 class="signature " id="insert-instance_method">
|
688
|
+
|
689
|
+
#<strong>insert</strong>(val) ⇒ <tt>Object</tt>
|
690
|
+
|
691
|
+
|
692
|
+
|
693
|
+
|
694
|
+
|
695
|
+
</h3><div class="docstring">
|
696
|
+
<div class="discussion">
|
697
|
+
|
698
|
+
<p>Insertion, Worst-Case Time Complexity: O(1)</p>
|
699
|
+
|
700
|
+
|
701
|
+
</div>
|
702
|
+
</div>
|
703
|
+
<div class="tags">
|
704
|
+
|
705
|
+
|
706
|
+
</div><table class="source_code">
|
707
|
+
<tr>
|
708
|
+
<td>
|
709
|
+
<pre class="lines">
|
710
|
+
|
711
|
+
|
712
|
+
439
|
713
|
+
440
|
714
|
+
441
|
715
|
+
442
|
716
|
+
443
|
717
|
+
444
|
718
|
+
445
|
719
|
+
446
|
720
|
+
447</pre>
|
721
|
+
</td>
|
722
|
+
<td>
|
723
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 439</span>
|
724
|
+
|
725
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_insert'>insert</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
726
|
+
<span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_link'>link</span><span class='op'>|</span> <span class='kw'>return</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>=</span> <span class='id identifier rubyid_val'>val</span> <span class='kw'>if</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='id identifier rubyid_val'>val</span> <span class='rbrace'>}</span>
|
727
|
+
<span class='id identifier rubyid_new_link'>new_link</span> <span class='op'>=</span> <span class='const'>LinkNode</span><span class='period'>.</span><span class='id identifier rubyid_new'>new</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
728
|
+
<span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span> <span class='op'>=</span> <span class='id identifier rubyid_new_link'>new_link</span>
|
729
|
+
<span class='id identifier rubyid_new_link'>new_link</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span>
|
730
|
+
<span class='id identifier rubyid_new_link'>new_link</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span> <span class='op'>=</span> <span class='ivar'>@tail</span>
|
731
|
+
<span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='id identifier rubyid_new_link'>new_link</span>
|
732
|
+
<span class='id identifier rubyid_new_link'>new_link</span>
|
733
|
+
<span class='kw'>end</span></pre>
|
734
|
+
</td>
|
735
|
+
</tr>
|
736
|
+
</table>
|
737
|
+
</div>
|
738
|
+
|
739
|
+
<div class="method_details ">
|
740
|
+
<h3 class="signature " id="last-instance_method">
|
741
|
+
|
742
|
+
#<strong>last</strong> ⇒ <tt>Object</tt>
|
743
|
+
|
744
|
+
|
745
|
+
|
746
|
+
|
747
|
+
|
748
|
+
</h3><table class="source_code">
|
749
|
+
<tr>
|
750
|
+
<td>
|
751
|
+
<pre class="lines">
|
752
|
+
|
753
|
+
|
754
|
+
421
|
755
|
+
422
|
756
|
+
423</pre>
|
757
|
+
</td>
|
758
|
+
<td>
|
759
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 421</span>
|
760
|
+
|
761
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_last'>last</span>
|
762
|
+
<span class='id identifier rubyid_empty?'>empty?</span> <span class='op'>?</span> <span class='kw'>nil</span> <span class='op'>:</span> <span class='ivar'>@tail</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span>
|
763
|
+
<span class='kw'>end</span></pre>
|
764
|
+
</td>
|
765
|
+
</tr>
|
766
|
+
</table>
|
767
|
+
</div>
|
768
|
+
|
769
|
+
<div class="method_details ">
|
770
|
+
<h3 class="signature " id="remove-instance_method">
|
771
|
+
|
772
|
+
#<strong>remove</strong>(val) ⇒ <tt>Object</tt>
|
773
|
+
|
774
|
+
|
775
|
+
|
776
|
+
|
777
|
+
|
778
|
+
</h3><div class="docstring">
|
779
|
+
<div class="discussion">
|
780
|
+
|
781
|
+
<p>Deletion, Worst-Case Time Complexity: O(1)</p>
|
782
|
+
|
783
|
+
|
784
|
+
</div>
|
785
|
+
</div>
|
786
|
+
<div class="tags">
|
787
|
+
|
788
|
+
|
789
|
+
</div><table class="source_code">
|
790
|
+
<tr>
|
791
|
+
<td>
|
792
|
+
<pre class="lines">
|
793
|
+
|
794
|
+
|
795
|
+
450
|
796
|
+
451
|
797
|
+
452
|
798
|
+
453
|
799
|
+
454
|
800
|
+
455
|
801
|
+
456
|
802
|
+
457
|
803
|
+
458
|
804
|
+
459
|
805
|
+
460</pre>
|
806
|
+
</td>
|
807
|
+
<td>
|
808
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 450</span>
|
809
|
+
|
810
|
+
<span class='kw'>def</span> <span class='id identifier rubyid_remove'>remove</span><span class='lparen'>(</span><span class='id identifier rubyid_val'>val</span><span class='rparen'>)</span>
|
811
|
+
<span class='id identifier rubyid_each'>each</span> <span class='kw'>do</span> <span class='op'>|</span><span class='id identifier rubyid_link'>link</span><span class='op'>|</span>
|
812
|
+
<span class='kw'>if</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='id identifier rubyid_val'>val</span>
|
813
|
+
<span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span> <span class='op'>=</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span>
|
814
|
+
<span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span>
|
815
|
+
<span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_next'>next</span><span class='comma'>,</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_prev'>prev</span> <span class='op'>=</span> <span class='kw'>nil</span><span class='comma'>,</span> <span class='kw'>nil</span>
|
816
|
+
<span class='kw'>return</span> <span class='id identifier rubyid_link'>link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span>
|
817
|
+
<span class='kw'>end</span>
|
818
|
+
<span class='kw'>end</span>
|
819
|
+
<span class='kw'>nil</span>
|
820
|
+
<span class='kw'>end</span></pre>
|
821
|
+
</td>
|
822
|
+
</tr>
|
823
|
+
</table>
|
824
|
+
</div>
|
825
|
+
|
826
|
+
<div class="method_details ">
|
827
|
+
<h3 class="signature " id="search-instance_method">
|
828
|
+
|
829
|
+
#<strong>search</strong>(target) ⇒ <tt>Object</tt>
|
830
|
+
|
831
|
+
|
832
|
+
|
833
|
+
|
834
|
+
|
835
|
+
</h3><div class="docstring">
|
836
|
+
<div class="discussion">
|
837
|
+
|
838
|
+
<p>Search, Worst-Case Time Complexity: O(n)</p>
|
839
|
+
|
840
|
+
|
841
|
+
</div>
|
842
|
+
</div>
|
843
|
+
<div class="tags">
|
844
|
+
|
845
|
+
|
846
|
+
</div><table class="source_code">
|
847
|
+
<tr>
|
848
|
+
<td>
|
849
|
+
<pre class="lines">
|
850
|
+
|
851
|
+
|
852
|
+
408
|
853
|
+
409
|
854
|
+
410</pre>
|
855
|
+
</td>
|
856
|
+
<td>
|
857
|
+
<pre class="code"><span class="info file"># File 'lib/algorithm_selector.rb', line 408</span>
|
858
|
+
|
859
|
+
<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>
|
860
|
+
<span class='id identifier rubyid_each'>each</span> <span class='lbrace'>{</span> <span class='op'>|</span><span class='id identifier rubyid_current_link'>current_link</span><span class='op'>|</span> <span class='kw'>return</span> <span class='id identifier rubyid_current_link'>current_link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='kw'>if</span> <span class='id identifier rubyid_current_link'>current_link</span><span class='period'>.</span><span class='id identifier rubyid_val'>val</span> <span class='op'>==</span> <span class='id identifier rubyid_target'>target</span> <span class='rbrace'>}</span>
|
861
|
+
<span class='kw'>end</span></pre>
|
862
|
+
</td>
|
863
|
+
</tr>
|
864
|
+
</table>
|
865
|
+
</div>
|
866
|
+
|
867
|
+
</div>
|
868
|
+
|
869
|
+
</div>
|
870
|
+
|
871
|
+
<div id="footer">
|
872
|
+
Generated on Fri Jul 22 11:22:31 2016 by
|
873
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
874
|
+
0.9.4 (ruby-2.1.2).
|
875
|
+
</div>
|
876
|
+
|
877
|
+
</div>
|
878
|
+
</body>
|
879
|
+
</html>
|