grosser-algorithms 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (47) hide show
  1. data/Manifest +45 -0
  2. data/VERSION +1 -0
  3. data/ext/containers/bst/bst.c +249 -0
  4. data/ext/containers/bst/extconf.rb +4 -0
  5. data/grosser-algorithms.gemspec +4 -4
  6. data/rdoc/classes/Algorithms.html +221 -0
  7. data/rdoc/classes/Algorithms/Algorithms.html +115 -0
  8. data/rdoc/classes/Algorithms/Algorithms/Sort.html +569 -0
  9. data/rdoc/classes/Algorithms/Containers.html +162 -0
  10. data/rdoc/classes/Algorithms/Containers/Heap.html +690 -0
  11. data/rdoc/classes/Algorithms/Containers/KDTree.html +195 -0
  12. data/rdoc/classes/Algorithms/Containers/MaxHeap.html +238 -0
  13. data/rdoc/classes/Algorithms/Containers/MinHeap.html +238 -0
  14. data/rdoc/classes/Algorithms/Containers/PriorityQueue.html +456 -0
  15. data/rdoc/classes/Algorithms/Containers/Queue.html +363 -0
  16. data/rdoc/classes/Algorithms/Containers/RubyDeque.html +617 -0
  17. data/rdoc/classes/Algorithms/Containers/RubyRBTreeMap.html +662 -0
  18. data/rdoc/classes/Algorithms/Containers/RubySplayTreeMap.html +623 -0
  19. data/rdoc/classes/Algorithms/Containers/Stack.html +363 -0
  20. data/rdoc/classes/Algorithms/Containers/SuffixArray.html +246 -0
  21. data/rdoc/classes/Algorithms/Containers/Trie.html +555 -0
  22. data/rdoc/classes/Algorithms/Search.html +273 -0
  23. data/rdoc/created.rid +1 -0
  24. data/rdoc/files/History_txt.html +281 -0
  25. data/rdoc/files/README_markdown.html +248 -0
  26. data/rdoc/files/lib/algorithms/search_rb.html +108 -0
  27. data/rdoc/files/lib/algorithms/sort_rb.html +108 -0
  28. data/rdoc/files/lib/algorithms/string_rb.html +115 -0
  29. data/rdoc/files/lib/algorithms_rb.html +252 -0
  30. data/rdoc/files/lib/containers/deque_rb.html +119 -0
  31. data/rdoc/files/lib/containers/heap_rb.html +124 -0
  32. data/rdoc/files/lib/containers/kd_tree_rb.html +135 -0
  33. data/rdoc/files/lib/containers/priority_queue_rb.html +108 -0
  34. data/rdoc/files/lib/containers/queue_rb.html +108 -0
  35. data/rdoc/files/lib/containers/rb_tree_map_rb.html +109 -0
  36. data/rdoc/files/lib/containers/splay_tree_map_rb.html +109 -0
  37. data/rdoc/files/lib/containers/stack_rb.html +108 -0
  38. data/rdoc/files/lib/containers/suffix_array_rb.html +113 -0
  39. data/rdoc/files/lib/containers/trie_rb.html +117 -0
  40. data/rdoc/fr_class_index.html +43 -0
  41. data/rdoc/fr_file_index.html +42 -0
  42. data/rdoc/fr_method_index.html +147 -0
  43. data/rdoc/index.html +24 -0
  44. data/rdoc/rdoc-style.css +208 -0
  45. data/spec/bst_gc_mark_spec.rb +25 -0
  46. data/spec/bst_spec.rb +25 -0
  47. metadata +50 -3
@@ -0,0 +1,248 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: README.markdown</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href=".././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>README.markdown</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>README.markdown
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Aug 10 14:11:18 +0200 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ # This branch
74
+ </p>
75
+ <pre>
76
+ - gem install grosser-algorithms
77
+ - misc fixes for jruby/1.9 by [szuecs](http://github.com/szuecs)
78
+ - gemification + rdoc by [Michael Grosser](http://pragmatig.wordpress.com)
79
+ </pre>
80
+ <p>
81
+ # algorithms
82
+ </p>
83
+ <ul>
84
+ <li>Official homes are here on github, and at [rubyforge](<a
85
+ href="http://rubyforge.org/projects/algorithms">rubyforge.org/projects/algorithms</a>/)
86
+
87
+ </li>
88
+ <li>Documentation: [<a
89
+ href="http://algorithms.rubyforge.org/](http://algorithms.rubyforge.org">algorithms.rubyforge.org/](http://algorithms.rubyforge.org</a>/)
90
+
91
+ </li>
92
+ </ul>
93
+ <p>
94
+ ## DESCRIPTION:
95
+ </p>
96
+ <p>
97
+ Started as a [Google Summer of Code 2008](<a
98
+ href="http://code.google.com/soc/2008/ruby/about.html">code.google.com/soc/2008/ruby/about.html</a>)
99
+ project
100
+ </p>
101
+ <p>
102
+ Written by [Kanwei Li](<a href="http://kanwei.com">kanwei.com</a>/),
103
+ mentored by Austin Ziegler
104
+ </p>
105
+ <p>
106
+ Original Proposal: Using the right data structure or algorithm for the
107
+ situation is an important aspect of programming. In computer science
108
+ literature, many data structures and algorithms have been researched and
109
+ extensively documented. However, there is still no standard library in Ruby
110
+ implementing useful structures and algorithms like Red/Black Trees, tries,
111
+ different sorting algorithms, etc. This project will create such a library
112
+ with documentation on when to use a particular structure/algorithm. It will
113
+ also come with a benchmark suite to compare performance in different
114
+ situations.
115
+ </p>
116
+ <p>
117
+ ## FEATURES:
118
+ </p>
119
+ <p>
120
+ Done so far:
121
+ </p>
122
+ <pre>
123
+ * Heaps Algorithms::Containers::Heap, Containers::MaxHeap, Containers::MinHeap
124
+ * Priority Queue Algorithms::Containers::PriorityQueue
125
+ * Deque Algorithms::Containers::Deque, Containers::CDeque (C extension), Containers::RubyDeque
126
+ * Stack Algorithms::Containers::Stack (uses Deque)
127
+ * Queue Algorithms::Containers::Queue (uses Deque)
128
+ * Red-Black Trees Algorithms::Containers::RBTreeMap, Containers::CRBTreeMap (C extension), Containers::RubyRBTreeMap
129
+ * Splay Trees Algorithms::Containers::SplayTreeMap, Containers::CSplayTreeMap (C extension), Containers::RubySplayTreeMap
130
+ * Tries Algorithms::Containers::Trie
131
+ * Suffix Array Algorithms::Containers::SuffixArray
132
+ * kd Tree Algorithms::Containers::KDTree
133
+
134
+ * Search algorithms
135
+ - Binary Search Algorithms::Algorithms::Search.binary_search
136
+ - Knuth-Morris-Pratt Algorithms::Algorithms::Search.kmp_search
137
+ * Sort algorithms
138
+ - Bubble sort Algorithms::Algorithms::Sort.bubble_sort
139
+ - Comb sort Algorithms::Algorithms::Sort.comb_sort
140
+ - Selection sort Algorithms::Algorithms::Sort.selection_sort
141
+ - Heapsort Algorithms::Algorithms::Sort.heapsort
142
+ - Insertion sort Algorithms::Algorithms::Sort.insertion_sort
143
+ - Shell sort Algorithms::Algorithms::Sort.shell_sort
144
+ - Quicksort Algorithms::Algorithms::Sort.quicksort
145
+ - Mergesort Algorithms::Algorithms::Sort.mergesort
146
+ </pre>
147
+ <p>
148
+ ## SYNOPSIS:
149
+ </p>
150
+ <pre>
151
+ require 'rubygems'
152
+ require 'algorithms'
153
+ max_heap = Algorithms::Containers::MaxHeap.new
154
+
155
+ # To not have to type &quot;Algorithms::&quot; before each class, use:
156
+ include Algorithms
157
+
158
+ max_heap = Containers::MaxHeap.new
159
+
160
+ # To not have to type &quot;Containers::&quot; before each class, use:
161
+ include Containers
162
+ max_heap = MaxHeap.new
163
+ </pre>
164
+ <p>
165
+ ## REQUIREMENTS:
166
+ </p>
167
+ <ul>
168
+ <li>Ruby 1.8 compatible Ruby, or Ruby 1.9
169
+
170
+ </li>
171
+ <li>C compiler for C extensions (optional, but very much recommended for vast
172
+ performance benefits)
173
+
174
+ </li>
175
+ </ul>
176
+ <p>
177
+ ## INSTALL:
178
+ </p>
179
+ <ul>
180
+ <li>sudo gem install algorithms
181
+
182
+ </li>
183
+ </ul>
184
+ <p>
185
+ ## LICENSE:
186
+ </p>
187
+ <p>
188
+ (The MIT License)
189
+ </p>
190
+ <p>
191
+ <a href="../classes/Algorithms.html">Algorithms</a> and Containers project
192
+ is Copyright (c) 2009 Kanwei Li
193
+ </p>
194
+ <p>
195
+ Permission is hereby granted, free of charge, to any person obtaining a
196
+ copy of this software and associated documentation files (the
197
+ &#8216;Software&#8217;), to deal in the Software without restriction,
198
+ including without limitation the rights to use, copy, modify, merge,
199
+ publish, distribute, sublicense, and/or sell copies of the Software, and to
200
+ permit persons to whom the Software is furnished to do so, subject to the
201
+ following conditions:
202
+ </p>
203
+ <p>
204
+ The above copyright notice and this permission notice shall be included in
205
+ all copies or substantial portions of the Software.
206
+ </p>
207
+ <p>
208
+ THE SOFTWARE IS PROVIDED &#8216;AS IS&#8217;, WITHOUT WARRANTY OF ANY KIND,
209
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
210
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN
211
+ NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
212
+ DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
213
+ OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
214
+ USE OR OTHER DEALINGS IN THE SOFTWARE.
215
+ </p>
216
+
217
+ </div>
218
+
219
+
220
+ </div>
221
+
222
+
223
+ </div>
224
+
225
+
226
+ <!-- if includes -->
227
+
228
+ <div id="section">
229
+
230
+
231
+
232
+
233
+
234
+
235
+
236
+
237
+ <!-- if method_list -->
238
+
239
+
240
+ </div>
241
+
242
+
243
+ <div id="validator-badges">
244
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
245
+ </div>
246
+
247
+ </body>
248
+ </html>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: search.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>search.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/algorithms/search.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Aug 10 13:58:23 +0200 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+ <div id="description">
72
+ <p>
73
+ This module implements search algorithms. Documentation is provided for
74
+ each algorithm.
75
+ </p>
76
+
77
+ </div>
78
+
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+
86
+ <!-- if includes -->
87
+
88
+ <div id="section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <!-- if method_list -->
98
+
99
+
100
+ </div>
101
+
102
+
103
+ <div id="validator-badges">
104
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
+ </div>
106
+
107
+ </body>
108
+ </html>
@@ -0,0 +1,108 @@
1
+ <?xml version="1.0" encoding="iso-8859-1"?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+
6
+ <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
7
+ <head>
8
+ <title>File: sort.rb</title>
9
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
10
+ <meta http-equiv="Content-Script-Type" content="text/javascript" />
11
+ <link rel="stylesheet" href="../../.././rdoc-style.css" type="text/css" media="screen" />
12
+ <script type="text/javascript">
13
+ // <![CDATA[
14
+
15
+ function popupCode( url ) {
16
+ window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
17
+ }
18
+
19
+ function toggleCode( id ) {
20
+ if ( document.getElementById )
21
+ elem = document.getElementById( id );
22
+ else if ( document.all )
23
+ elem = eval( "document.all." + id );
24
+ else
25
+ return false;
26
+
27
+ elemStyle = elem.style;
28
+
29
+ if ( elemStyle.display != "block" ) {
30
+ elemStyle.display = "block"
31
+ } else {
32
+ elemStyle.display = "none"
33
+ }
34
+
35
+ return true;
36
+ }
37
+
38
+ // Make codeblocks hidden by default
39
+ document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
40
+
41
+ // ]]>
42
+ </script>
43
+
44
+ </head>
45
+ <body>
46
+
47
+
48
+
49
+ <div id="fileHeader">
50
+ <h1>sort.rb</h1>
51
+ <table class="header-table">
52
+ <tr class="top-aligned-row">
53
+ <td><strong>Path:</strong></td>
54
+ <td>lib/algorithms/sort.rb
55
+ </td>
56
+ </tr>
57
+ <tr class="top-aligned-row">
58
+ <td><strong>Last Update:</strong></td>
59
+ <td>Tue Aug 10 13:58:23 +0200 2010</td>
60
+ </tr>
61
+ </table>
62
+ </div>
63
+ <!-- banner header -->
64
+
65
+ <div id="bodyContent">
66
+
67
+
68
+
69
+ <div id="contextContent">
70
+
71
+
72
+ <div id="requires-list">
73
+ <h3 class="section-bar">Required files</h3>
74
+
75
+ <div class="name-list">
76
+ containers/heap&nbsp;&nbsp;
77
+ </div>
78
+ </div>
79
+
80
+ </div>
81
+
82
+
83
+ </div>
84
+
85
+
86
+ <!-- if includes -->
87
+
88
+ <div id="section">
89
+
90
+
91
+
92
+
93
+
94
+
95
+
96
+
97
+ <!-- if method_list -->
98
+
99
+
100
+ </div>
101
+
102
+
103
+ <div id="validator-badges">
104
+ <p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
105
+ </div>
106
+
107
+ </body>
108
+ </html>