ds 0.0.2 → 0.0.3

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.
Files changed (117) hide show
  1. data/.gitignore +2 -0
  2. data/README.rdoc +490 -0
  3. data/Rakefile +1 -1
  4. data/lib/ds.rb +17 -19
  5. data/lib/ds/ext/array_x.rb +35 -0
  6. data/lib/ds/graphs/graph.rb +36 -32
  7. data/lib/ds/graphs/graph_as_matrix.rb +22 -23
  8. data/lib/ds/graphs/graph_as_tri_matrix.rb +1 -2
  9. data/lib/ds/lists/list.rb +18 -21
  10. data/lib/ds/matrixes/array_2d.rb +4 -0
  11. data/lib/ds/pair.rb +14 -0
  12. data/lib/ds/queues/priority_queue.rb +36 -0
  13. data/lib/ds/queues/queue.rb +1 -1
  14. data/lib/ds/sets/ordered_set.rb +32 -0
  15. data/lib/ds/trees/binary_heap.rb +45 -14
  16. data/lib/ds/trees/binary_search_tree.rb +3 -1
  17. data/lib/ds/trees/binary_tree.rb +11 -5
  18. data/lib/ds/trees/complete_binary_tree.rb +24 -16
  19. data/lib/ds/trees/tree.rb +3 -3
  20. data/lib/ds/trees/tree_walker.rb +7 -6
  21. data/lib/ds/trees/trie.rb +14 -20
  22. data/lib/ds/version.rb +1 -1
  23. data/test/help.rb +12 -3
  24. data/test/test_array2d.rb +14 -4
  25. data/test/test_array_x.rb +27 -7
  26. data/test/test_binary_heap.rb +19 -1
  27. data/test/test_binary_search_tree.rb +8 -1
  28. data/test/test_binary_tree.rb +7 -1
  29. data/test/test_complete_binary_tree.rb +34 -6
  30. data/test/test_digraph.rb +1 -1
  31. data/test/test_graph.rb +10 -1
  32. data/test/test_list.rb +59 -2
  33. data/test/test_ordered_set.rb +28 -0
  34. data/test/test_pair.rb +26 -0
  35. data/test/test_priority_queue.rb +134 -0
  36. data/test/test_queue.rb +3 -3
  37. data/test/test_stack.rb +0 -2
  38. data/test/test_tree.rb +32 -9
  39. data/test/test_tree_walker.rb +22 -0
  40. data/test/test_trie.rb +20 -2
  41. metadata +13 -81
  42. data/doc/Array.html +0 -264
  43. data/doc/DS.html +0 -292
  44. data/doc/DS/Array2D.html +0 -345
  45. data/doc/DS/BinaryHeap.html +0 -493
  46. data/doc/DS/BinarySearchTree.html +0 -313
  47. data/doc/DS/BinaryTree.html +0 -433
  48. data/doc/DS/CompleteBinaryTree.html +0 -550
  49. data/doc/DS/CyclicList.html +0 -234
  50. data/doc/DS/Digraph.html +0 -299
  51. data/doc/DS/Edge.html +0 -283
  52. data/doc/DS/ExpandableArray.html +0 -316
  53. data/doc/DS/Graph.html +0 -739
  54. data/doc/DS/GraphAsList.html +0 -361
  55. data/doc/DS/GraphAsMatrix.html +0 -633
  56. data/doc/DS/GraphAsTriMatrix.html +0 -274
  57. data/doc/DS/List.html +0 -1263
  58. data/doc/DS/ListElement.html +0 -344
  59. data/doc/DS/Queue.html +0 -517
  60. data/doc/DS/Ring.html +0 -323
  61. data/doc/DS/Stack.html +0 -407
  62. data/doc/DS/Tree.html +0 -770
  63. data/doc/DS/TreeWalker.html +0 -561
  64. data/doc/DS/TriMatrix.html +0 -338
  65. data/doc/created.rid +0 -25
  66. data/doc/ds/graphs/digraph_rb.html +0 -52
  67. data/doc/ds/graphs/edge_rb.html +0 -52
  68. data/doc/ds/graphs/graph_as_list_rb.html +0 -52
  69. data/doc/ds/graphs/graph_as_matrix_rb.html +0 -52
  70. data/doc/ds/graphs/graph_as_tri_matrix_rb.html +0 -52
  71. data/doc/ds/graphs/graph_rb.html +0 -52
  72. data/doc/ds/lists/cyclic_list_rb.html +0 -52
  73. data/doc/ds/lists/list_element_rb.html +0 -52
  74. data/doc/ds/lists/list_rb.html +0 -52
  75. data/doc/ds/lists/ring_rb.html +0 -52
  76. data/doc/ds/matrixes/array_2d_rb.html +0 -52
  77. data/doc/ds/matrixes/expandable_array_rb.html +0 -52
  78. data/doc/ds/matrixes/tri_matrix_rb.html +0 -52
  79. data/doc/ds/queues/queue_rb.html +0 -52
  80. data/doc/ds/stacks/stack_rb.html +0 -52
  81. data/doc/ds/trees/binary_heap_rb.html +0 -52
  82. data/doc/ds/trees/binary_search_tree_rb.html +0 -52
  83. data/doc/ds/trees/binary_tree_rb.html +0 -52
  84. data/doc/ds/trees/complete_binary_tree_rb.html +0 -52
  85. data/doc/ds/trees/tree_rb.html +0 -52
  86. data/doc/ds/trees/tree_walker_rb.html +0 -52
  87. data/doc/ds/version_rb.html +0 -52
  88. data/doc/ds_rb.html +0 -98
  89. data/doc/ext/ext_rb.html +0 -52
  90. data/doc/images/brick.png +0 -0
  91. data/doc/images/brick_link.png +0 -0
  92. data/doc/images/bug.png +0 -0
  93. data/doc/images/bullet_black.png +0 -0
  94. data/doc/images/bullet_toggle_minus.png +0 -0
  95. data/doc/images/bullet_toggle_plus.png +0 -0
  96. data/doc/images/date.png +0 -0
  97. data/doc/images/find.png +0 -0
  98. data/doc/images/loadingAnimation.gif +0 -0
  99. data/doc/images/macFFBgHack.png +0 -0
  100. data/doc/images/package.png +0 -0
  101. data/doc/images/page_green.png +0 -0
  102. data/doc/images/page_white_text.png +0 -0
  103. data/doc/images/page_white_width.png +0 -0
  104. data/doc/images/plugin.png +0 -0
  105. data/doc/images/ruby.png +0 -0
  106. data/doc/images/tag_green.png +0 -0
  107. data/doc/images/wrench.png +0 -0
  108. data/doc/images/wrench_orange.png +0 -0
  109. data/doc/images/zoom.png +0 -0
  110. data/doc/index.html +0 -375
  111. data/doc/js/darkfish.js +0 -116
  112. data/doc/js/jquery.js +0 -32
  113. data/doc/js/quicksearch.js +0 -114
  114. data/doc/js/thickbox-compressed.js +0 -10
  115. data/doc/rdoc.css +0 -763
  116. data/lib/ds/ext/ext.rb +0 -36
  117. data/lib/ds/graphs/graph_as_list.rb +0 -48
@@ -1,323 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: DS::Ring</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
- <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
- <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
- <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
-
17
- </head>
18
- <body id="top" class="class">
19
-
20
- <div id="metadata">
21
- <div id="home-metadata">
22
- <div id="home-section" class="section">
23
- <h3 class="section-header">
24
- <a href="../index.html">Home</a>
25
- <a href="../index.html#classes">Classes</a>
26
- <a href="../index.html#methods">Methods</a>
27
- </h3>
28
- </div>
29
- </div>
30
-
31
- <div id="file-metadata">
32
- <div id="file-list-section" class="section">
33
- <h3 class="section-header">In Files</h3>
34
- <div class="section-body">
35
- <ul>
36
-
37
- <li><a href="../ds/lists/ring_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
- class="thickbox" title="ds/lists/ring.rb">ds/lists/ring.rb</a></li>
39
-
40
- </ul>
41
- </div>
42
- </div>
43
-
44
-
45
- </div>
46
-
47
- <div id="class-metadata">
48
-
49
- <!-- Parent Class -->
50
- <div id="parent-class-section" class="section">
51
- <h3 class="section-header">Parent</h3>
52
-
53
- <p class="link">CyclicList</p>
54
-
55
- </div>
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- <!-- Method Quickref -->
64
- <div id="method-list-section" class="section">
65
- <h3 class="section-header">Methods</h3>
66
- <ul class="link-list">
67
-
68
- <li><a href="#method-c-from_array">::from_array</a></li>
69
-
70
- <li><a href="#method-i-eliminate_by">#eliminate_by</a></li>
71
-
72
- <li><a href="#method-i-length">#length</a></li>
73
-
74
- </ul>
75
- </div>
76
-
77
-
78
-
79
- </div>
80
-
81
- <div id="project-metadata">
82
-
83
-
84
-
85
- <div id="classindex-section" class="section project-section">
86
- <h3 class="section-header">Class/Module Index
87
- <span class="search-toggle"><img src="../images/find.png"
88
- height="16" width="16" alt="[+]"
89
- title="show/hide quicksearch" /></span></h3>
90
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
91
- <fieldset>
92
- <legend>Quicksearch</legend>
93
- <input type="text" name="quicksearch" value=""
94
- class="quicksearch-field" />
95
- </fieldset>
96
- </form>
97
-
98
- <ul class="link-list">
99
-
100
- <li><a href="../DS.html">DS</a></li>
101
-
102
- <li><a href="../DS/Array2D.html">DS::Array2D</a></li>
103
-
104
- <li><a href="../DS/BinaryHeap.html">DS::BinaryHeap</a></li>
105
-
106
- <li><a href="../DS/BinarySearchTree.html">DS::BinarySearchTree</a></li>
107
-
108
- <li><a href="../DS/BinaryTree.html">DS::BinaryTree</a></li>
109
-
110
- <li><a href="../DS/CompleteBinaryTree.html">DS::CompleteBinaryTree</a></li>
111
-
112
- <li><a href="../DS/CyclicList.html">DS::CyclicList</a></li>
113
-
114
- <li><a href="../DS/Digraph.html">DS::Digraph</a></li>
115
-
116
- <li><a href="../DS/Edge.html">DS::Edge</a></li>
117
-
118
- <li><a href="../DS/ExpandableArray.html">DS::ExpandableArray</a></li>
119
-
120
- <li><a href="../DS/Graph.html">DS::Graph</a></li>
121
-
122
- <li><a href="../DS/GraphAsList.html">DS::GraphAsList</a></li>
123
-
124
- <li><a href="../DS/GraphAsMatrix.html">DS::GraphAsMatrix</a></li>
125
-
126
- <li><a href="../DS/GraphAsTriMatrix.html">DS::GraphAsTriMatrix</a></li>
127
-
128
- <li><a href="../DS/List.html">DS::List</a></li>
129
-
130
- <li><a href="../DS/ListElement.html">DS::ListElement</a></li>
131
-
132
- <li><a href="../DS/Queue.html">DS::Queue</a></li>
133
-
134
- <li><a href="../DS/Ring.html">DS::Ring</a></li>
135
-
136
- <li><a href="../DS/Stack.html">DS::Stack</a></li>
137
-
138
- <li><a href="../DS/Tree.html">DS::Tree</a></li>
139
-
140
- <li><a href="../DS/TreeWalker.html">DS::TreeWalker</a></li>
141
-
142
- <li><a href="../DS/TriMatrix.html">DS::TriMatrix</a></li>
143
-
144
- <li><a href="../Array.html">Array</a></li>
145
-
146
- </ul>
147
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
148
- </div>
149
-
150
-
151
- </div>
152
- </div>
153
-
154
- <div id="documentation">
155
- <h1 class="class">DS::Ring</h1>
156
-
157
- <div id="description" class="description">
158
-
159
- <p><a href="Ring.html">Ring</a> - represent list which head is linked with
160
- tail.</p>
161
-
162
- </div><!-- description -->
163
-
164
-
165
-
166
-
167
- <div id="5Buntitled-5D" class="documentation-section">
168
-
169
-
170
-
171
-
172
-
173
-
174
-
175
-
176
- <!-- Methods -->
177
-
178
- <div id="public-class-method-details" class="method-section section">
179
- <h3 class="section-header">Public Class Methods</h3>
180
-
181
-
182
- <div id="from_array-method" class="method-detail ">
183
- <a name="method-c-from_array"></a>
184
-
185
-
186
- <div class="method-heading">
187
- <span class="method-name">from_array</span><span
188
- class="method-args">(arr)</span>
189
- <span class="method-click-advice">click to toggle source</span>
190
- </div>
191
-
192
-
193
- <div class="method-description">
194
-
195
- <p>Creates ring from array.</p>
196
-
197
-
198
-
199
- <div class="method-source-code" id="from_array-source">
200
- <pre>
201
- <span class="ruby-comment"># File ds/lists/ring.rb, line 7</span>
202
- <span class="ruby-keyword">def</span> <span class="ruby-keyword">self</span>.<span class="ruby-identifier">from_array</span>(<span class="ruby-identifier">arr</span>)
203
- <span class="ruby-identifier">list</span> = <span class="ruby-constant">Ring</span>.<span class="ruby-identifier">new</span>(<span class="ruby-identifier">arr</span>.<span class="ruby-identifier">shift</span>)
204
- <span class="ruby-identifier">tail</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">head</span>
205
- <span class="ruby-identifier">arr</span>.<span class="ruby-identifier">each</span> { <span class="ruby-operator">|</span><span class="ruby-identifier">e</span><span class="ruby-operator">|</span> <span class="ruby-identifier">tail</span> = <span class="ruby-identifier">tail</span>.<span class="ruby-identifier">append</span>(<span class="ruby-identifier">e</span>) }
206
- <span class="ruby-identifier">tail</span>.<span class="ruby-identifier">next</span> = <span class="ruby-identifier">list</span>.<span class="ruby-identifier">head</span>
207
- <span class="ruby-identifier">list</span>
208
- <span class="ruby-keyword">end</span></pre>
209
- </div><!-- from_array-source -->
210
-
211
- </div>
212
-
213
-
214
-
215
-
216
- </div><!-- from_array-method -->
217
-
218
-
219
- </div><!-- public-class-method-details -->
220
-
221
- <div id="public-instance-method-details" class="method-section section">
222
- <h3 class="section-header">Public Instance Methods</h3>
223
-
224
-
225
- <div id="eliminate_by-method" class="method-detail ">
226
- <a name="method-i-eliminate_by"></a>
227
-
228
-
229
- <div class="method-heading">
230
- <span class="method-name">eliminate_by</span><span
231
- class="method-args">(k)</span>
232
- <span class="method-click-advice">click to toggle source</span>
233
- </div>
234
-
235
-
236
- <div class="method-description">
237
-
238
- <p>Removes ring elements by k until there is only one element in list.</p>
239
-
240
-
241
-
242
- <div class="method-source-code" id="eliminate_by-source">
243
- <pre>
244
- <span class="ruby-comment"># File ds/lists/ring.rb, line 20</span>
245
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">eliminate_by</span>(<span class="ruby-identifier">k</span>)
246
- <span class="ruby-identifier">elem</span> = <span class="ruby-keyword">self</span>.<span class="ruby-identifier">head</span>
247
- <span class="ruby-identifier">prev</span> = <span class="ruby-identifier">elem</span>
248
-
249
- <span class="ruby-identifier">k</span> = <span class="ruby-identifier">k</span><span class="ruby-operator">-</span><span class="ruby-value">1</span>
250
-
251
- <span class="ruby-keyword">while</span> <span class="ruby-identifier">prev</span> <span class="ruby-operator">!=</span> <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">next</span>
252
-
253
- <span class="ruby-identifier">k</span>.<span class="ruby-identifier">times</span> <span class="ruby-keyword">do</span>
254
- <span class="ruby-identifier">prev</span> = <span class="ruby-identifier">elem</span>
255
- <span class="ruby-identifier">elem</span> = <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">next</span>
256
- <span class="ruby-keyword">end</span>
257
-
258
- <span class="ruby-identifier">prev</span>.<span class="ruby-identifier">next</span> = <span class="ruby-identifier">elem</span>.<span class="ruby-identifier">next</span>
259
- <span class="ruby-identifier">elem</span> = <span class="ruby-identifier">prev</span>.<span class="ruby-identifier">next</span>
260
- <span class="ruby-keyword">end</span>
261
-
262
- <span class="ruby-keyword">return</span> <span class="ruby-identifier">prev</span>.<span class="ruby-identifier">data</span>
263
-
264
- <span class="ruby-keyword">end</span></pre>
265
- </div><!-- eliminate_by-source -->
266
-
267
- </div>
268
-
269
-
270
-
271
-
272
- </div><!-- eliminate_by-method -->
273
-
274
-
275
- <div id="length-method" class="method-detail ">
276
- <a name="method-i-length"></a>
277
-
278
-
279
- <div class="method-heading">
280
- <span class="method-name">length</span><span
281
- class="method-args">()</span>
282
- <span class="method-click-advice">click to toggle source</span>
283
- </div>
284
-
285
-
286
- <div class="method-description">
287
-
288
-
289
-
290
-
291
-
292
- <div class="method-source-code" id="length-source">
293
- <pre>
294
- <span class="ruby-comment"># File ds/lists/ring.rb, line 15</span>
295
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">length</span>
296
- <span class="ruby-identifier">cycle_size</span>
297
- <span class="ruby-keyword">end</span></pre>
298
- </div><!-- length-source -->
299
-
300
- </div>
301
-
302
-
303
-
304
-
305
- </div><!-- length-method -->
306
-
307
-
308
- </div><!-- public-instance-method-details -->
309
-
310
- </div><!-- 5Buntitled-5D -->
311
-
312
-
313
- </div><!-- documentation -->
314
-
315
- <div id="validator-badges">
316
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
317
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
318
- Rdoc Generator</a> 2</small>.</p>
319
- </div>
320
-
321
- </body>
322
- </html>
323
-
@@ -1,407 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
3
- "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
4
- <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
5
- <head>
6
- <meta content="text/html; charset=UTF-8" http-equiv="Content-Type" />
7
-
8
- <title>Class: DS::Stack</title>
9
-
10
- <link rel="stylesheet" href="../rdoc.css" type="text/css" media="screen" />
11
-
12
- <script src="../js/jquery.js" type="text/javascript" charset="utf-8"></script>
13
- <script src="../js/thickbox-compressed.js" type="text/javascript" charset="utf-8"></script>
14
- <script src="../js/quicksearch.js" type="text/javascript" charset="utf-8"></script>
15
- <script src="../js/darkfish.js" type="text/javascript" charset="utf-8"></script>
16
-
17
- </head>
18
- <body id="top" class="class">
19
-
20
- <div id="metadata">
21
- <div id="home-metadata">
22
- <div id="home-section" class="section">
23
- <h3 class="section-header">
24
- <a href="../index.html">Home</a>
25
- <a href="../index.html#classes">Classes</a>
26
- <a href="../index.html#methods">Methods</a>
27
- </h3>
28
- </div>
29
- </div>
30
-
31
- <div id="file-metadata">
32
- <div id="file-list-section" class="section">
33
- <h3 class="section-header">In Files</h3>
34
- <div class="section-body">
35
- <ul>
36
-
37
- <li><a href="../ds/stacks/stack_rb.html?TB_iframe=true&amp;height=550&amp;width=785"
38
- class="thickbox" title="ds/stacks/stack.rb">ds/stacks/stack.rb</a></li>
39
-
40
- </ul>
41
- </div>
42
- </div>
43
-
44
-
45
- </div>
46
-
47
- <div id="class-metadata">
48
-
49
- <!-- Parent Class -->
50
- <div id="parent-class-section" class="section">
51
- <h3 class="section-header">Parent</h3>
52
-
53
- <p class="link">Object</p>
54
-
55
- </div>
56
-
57
-
58
-
59
-
60
-
61
-
62
-
63
- <!-- Method Quickref -->
64
- <div id="method-list-section" class="section">
65
- <h3 class="section-header">Methods</h3>
66
- <ul class="link-list">
67
-
68
- <li><a href="#method-c-new">::new</a></li>
69
-
70
- <li><a href="#method-i-empty-3F">#empty?</a></li>
71
-
72
- <li><a href="#method-i-peek">#peek</a></li>
73
-
74
- <li><a href="#method-i-pop">#pop</a></li>
75
-
76
- <li><a href="#method-i-push">#push</a></li>
77
-
78
- <li><a href="#method-i-size">#size</a></li>
79
-
80
- </ul>
81
- </div>
82
-
83
-
84
-
85
- </div>
86
-
87
- <div id="project-metadata">
88
-
89
-
90
-
91
- <div id="classindex-section" class="section project-section">
92
- <h3 class="section-header">Class/Module Index
93
- <span class="search-toggle"><img src="../images/find.png"
94
- height="16" width="16" alt="[+]"
95
- title="show/hide quicksearch" /></span></h3>
96
- <form action="#" method="get" accept-charset="utf-8" class="initially-hidden">
97
- <fieldset>
98
- <legend>Quicksearch</legend>
99
- <input type="text" name="quicksearch" value=""
100
- class="quicksearch-field" />
101
- </fieldset>
102
- </form>
103
-
104
- <ul class="link-list">
105
-
106
- <li><a href="../DS.html">DS</a></li>
107
-
108
- <li><a href="../DS/Array2D.html">DS::Array2D</a></li>
109
-
110
- <li><a href="../DS/BinaryHeap.html">DS::BinaryHeap</a></li>
111
-
112
- <li><a href="../DS/BinarySearchTree.html">DS::BinarySearchTree</a></li>
113
-
114
- <li><a href="../DS/BinaryTree.html">DS::BinaryTree</a></li>
115
-
116
- <li><a href="../DS/CompleteBinaryTree.html">DS::CompleteBinaryTree</a></li>
117
-
118
- <li><a href="../DS/CyclicList.html">DS::CyclicList</a></li>
119
-
120
- <li><a href="../DS/Digraph.html">DS::Digraph</a></li>
121
-
122
- <li><a href="../DS/Edge.html">DS::Edge</a></li>
123
-
124
- <li><a href="../DS/ExpandableArray.html">DS::ExpandableArray</a></li>
125
-
126
- <li><a href="../DS/Graph.html">DS::Graph</a></li>
127
-
128
- <li><a href="../DS/GraphAsList.html">DS::GraphAsList</a></li>
129
-
130
- <li><a href="../DS/GraphAsMatrix.html">DS::GraphAsMatrix</a></li>
131
-
132
- <li><a href="../DS/GraphAsTriMatrix.html">DS::GraphAsTriMatrix</a></li>
133
-
134
- <li><a href="../DS/List.html">DS::List</a></li>
135
-
136
- <li><a href="../DS/ListElement.html">DS::ListElement</a></li>
137
-
138
- <li><a href="../DS/Queue.html">DS::Queue</a></li>
139
-
140
- <li><a href="../DS/Ring.html">DS::Ring</a></li>
141
-
142
- <li><a href="../DS/Stack.html">DS::Stack</a></li>
143
-
144
- <li><a href="../DS/Tree.html">DS::Tree</a></li>
145
-
146
- <li><a href="../DS/TreeWalker.html">DS::TreeWalker</a></li>
147
-
148
- <li><a href="../DS/TriMatrix.html">DS::TriMatrix</a></li>
149
-
150
- <li><a href="../Array.html">Array</a></li>
151
-
152
- </ul>
153
- <div id="no-class-search-results" style="display: none;">No matching classes.</div>
154
- </div>
155
-
156
-
157
- </div>
158
- </div>
159
-
160
- <div id="documentation">
161
- <h1 class="class">DS::Stack</h1>
162
-
163
- <div id="description" class="description">
164
-
165
- <p>Class implements <a href="Stack.html">Stack</a> data structure. Internaly
166
- uses array to store elements.</p>
167
-
168
- </div><!-- description -->
169
-
170
-
171
-
172
-
173
- <div id="5Buntitled-5D" class="documentation-section">
174
-
175
-
176
-
177
-
178
-
179
-
180
-
181
-
182
- <!-- Methods -->
183
-
184
- <div id="public-class-method-details" class="method-section section">
185
- <h3 class="section-header">Public Class Methods</h3>
186
-
187
-
188
- <div id="new-method" class="method-detail ">
189
- <a name="method-c-new"></a>
190
-
191
-
192
- <div class="method-heading">
193
- <span class="method-name">new</span><span
194
- class="method-args">()</span>
195
- <span class="method-click-advice">click to toggle source</span>
196
- </div>
197
-
198
-
199
- <div class="method-description">
200
-
201
-
202
-
203
-
204
-
205
- <div class="method-source-code" id="new-source">
206
- <pre>
207
- <span class="ruby-comment"># File ds/stacks/stack.rb, line 8</span>
208
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">initialize</span>
209
- <span class="ruby-ivar">@store</span> = []
210
- <span class="ruby-keyword">end</span></pre>
211
- </div><!-- new-source -->
212
-
213
- </div>
214
-
215
-
216
-
217
-
218
- </div><!-- new-method -->
219
-
220
-
221
- </div><!-- public-class-method-details -->
222
-
223
- <div id="public-instance-method-details" class="method-section section">
224
- <h3 class="section-header">Public Instance Methods</h3>
225
-
226
-
227
- <div id="empty-3F-method" class="method-detail ">
228
- <a name="method-i-empty-3F"></a>
229
-
230
-
231
- <div class="method-heading">
232
- <span class="method-name">empty?</span><span
233
- class="method-args">()</span>
234
- <span class="method-click-advice">click to toggle source</span>
235
- </div>
236
-
237
-
238
- <div class="method-description">
239
-
240
- <p>If stack is empty returns true otherwise returns false.</p>
241
-
242
-
243
-
244
- <div class="method-source-code" id="empty-3F-source">
245
- <pre>
246
- <span class="ruby-comment"># File ds/stacks/stack.rb, line 33</span>
247
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">empty?</span>
248
- <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">empty?</span>
249
- <span class="ruby-keyword">end</span></pre>
250
- </div><!-- empty-3F-source -->
251
-
252
- </div>
253
-
254
-
255
-
256
-
257
- </div><!-- empty-3F-method -->
258
-
259
-
260
- <div id="peek-method" class="method-detail ">
261
- <a name="method-i-peek"></a>
262
-
263
-
264
- <div class="method-heading">
265
- <span class="method-name">peek</span><span
266
- class="method-args">()</span>
267
- <span class="method-click-advice">click to toggle source</span>
268
- </div>
269
-
270
-
271
- <div class="method-description">
272
-
273
- <p>Returns element from the top of the stack.</p>
274
-
275
-
276
-
277
- <div class="method-source-code" id="peek-source">
278
- <pre>
279
- <span class="ruby-comment"># File ds/stacks/stack.rb, line 28</span>
280
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">peek</span>
281
- <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">last</span>
282
- <span class="ruby-keyword">end</span></pre>
283
- </div><!-- peek-source -->
284
-
285
- </div>
286
-
287
-
288
-
289
-
290
- </div><!-- peek-method -->
291
-
292
-
293
- <div id="pop-method" class="method-detail ">
294
- <a name="method-i-pop"></a>
295
-
296
-
297
- <div class="method-heading">
298
- <span class="method-name">pop</span><span
299
- class="method-args">()</span>
300
- <span class="method-click-advice">click to toggle source</span>
301
- </div>
302
-
303
-
304
- <div class="method-description">
305
-
306
- <p>Removes element from stack and returns it.</p>
307
-
308
-
309
-
310
- <div class="method-source-code" id="pop-source">
311
- <pre>
312
- <span class="ruby-comment"># File ds/stacks/stack.rb, line 18</span>
313
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">pop</span>
314
- <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">pop</span>
315
- <span class="ruby-keyword">end</span></pre>
316
- </div><!-- pop-source -->
317
-
318
- </div>
319
-
320
-
321
-
322
-
323
- </div><!-- pop-method -->
324
-
325
-
326
- <div id="push-method" class="method-detail ">
327
- <a name="method-i-push"></a>
328
-
329
-
330
- <div class="method-heading">
331
- <span class="method-name">push</span><span
332
- class="method-args">(x)</span>
333
- <span class="method-click-advice">click to toggle source</span>
334
- </div>
335
-
336
-
337
- <div class="method-description">
338
-
339
- <p>Adds element to the top of the stack.</p>
340
-
341
-
342
-
343
- <div class="method-source-code" id="push-source">
344
- <pre>
345
- <span class="ruby-comment"># File ds/stacks/stack.rb, line 23</span>
346
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">push</span>(<span class="ruby-identifier">x</span>)
347
- <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">push</span> <span class="ruby-identifier">x</span>
348
- <span class="ruby-keyword">end</span></pre>
349
- </div><!-- push-source -->
350
-
351
- </div>
352
-
353
-
354
-
355
-
356
- </div><!-- push-method -->
357
-
358
-
359
- <div id="size-method" class="method-detail ">
360
- <a name="method-i-size"></a>
361
-
362
-
363
- <div class="method-heading">
364
- <span class="method-name">size</span><span
365
- class="method-args">()</span>
366
- <span class="method-click-advice">click to toggle source</span>
367
- </div>
368
-
369
-
370
- <div class="method-description">
371
-
372
- <p>Returns the stack size.</p>
373
-
374
-
375
-
376
- <div class="method-source-code" id="size-source">
377
- <pre>
378
- <span class="ruby-comment"># File ds/stacks/stack.rb, line 13</span>
379
- <span class="ruby-keyword">def</span> <span class="ruby-identifier">size</span>
380
- <span class="ruby-ivar">@store</span>.<span class="ruby-identifier">size</span>
381
- <span class="ruby-keyword">end</span></pre>
382
- </div><!-- size-source -->
383
-
384
- </div>
385
-
386
-
387
-
388
-
389
- </div><!-- size-method -->
390
-
391
-
392
- </div><!-- public-instance-method-details -->
393
-
394
- </div><!-- 5Buntitled-5D -->
395
-
396
-
397
- </div><!-- documentation -->
398
-
399
- <div id="validator-badges">
400
- <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
401
- <p><small>Generated with the <a href="http://deveiate.org/projects/Darkfish-Rdoc/">Darkfish
402
- Rdoc Generator</a> 2</small>.</p>
403
- </div>
404
-
405
- </body>
406
- </html>
407
-