-
Notifications
You must be signed in to change notification settings - Fork 6
/
Copy path12_merge_sort.html
616 lines (522 loc) · 23.4 KB
/
12_merge_sort.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width">
<title>12. Merge Sort</title>
<link rel="stylesheet" href="template/style.css">
</head>
<body>
<span style="float: right">
[
<a href="11_min_1_2.html">previous</a>,
<a href="index.html">contents</a>,
<a href="13_searching.html">next</a>
]
</span>
<a name="L12.-Merge-Sort"></a>
<h1>12. Merge Sort</h1>
<a name="The-discovery-of-generic-programming"></a>
<h2>The discovery of generic programming</h2>
<p>I have to tell you a story about fish.
I was young once.
The year was 1976.
Some of you were not even born.
I was a good programmer.
I was writing operating systems and doing a good job.
But, I aspired to greater things.
When you are young you aspire.
There was an opening in one very prestigious institute, <a href="https://en.wikipedia.org/wiki/Russian_Academy_of_Sciences">Soviet Academy of Science</a> to work
on the design of a parallel computer.
I wanted this job really badly.</p>
<p>A friend of mine who
worked at this Institute recommended me to this group.
I knew I was going to go
there for an interview and I’d have to say some wonderful things or they
would not give me a job.
Right before my interview, terrible thing happened.
I ate some raw fish and it was very tasty but within
eight hours my temperature was 103.
I was in a bad situation.</p>
<p>I’m in the hospital flying above my bed.
That happens to you when you have high fever.
But, what I’m thinking about is this upcoming interview about parallel computers.
I know nothing about parallel computers not now, nor
ever, but I really want the job.
So I need to come up with some brilliant idea.
So I’m floating above the bed in space and thinking.
Then I suddenly realize how to add four numbers in parallel I said, “oh I could add them
in parallel if I add the first two and the second two in parallel”:</p>
<pre><code> +
/ \
/ \
+ +
/ \ / \
x y z w
</code></pre>
<p>I had this vision of this huge addition tree.
When you’re sick amazing things happen in your mind.
Then I realized the second great thing, while still floating.
It could be multiplication and the same thing will work.
I started realizing more and more
functions will work <code>min</code>, <code>max</code>, but division will not work.
Then I realized it’s good to be sick.
It has to do something which I almost forgot called abstract algebra.
How is this related?
I have been teaching the whole course<sup id="fnref:1"><a href="#fn:1" rel="footnote">1</a></sup> so I remember that
there is this thing called associativity.
I realized that this idea will work as long as the operation is associative.</p>
<p>This became my central theme.
How could I talk about associative operations?
How could I write algorithms like that?
When I came to United States somewhere along the way,
maybe in Austria, I realized that merge was associative
It was a very big deal because I never even thought about merge in terms of <code>+</code> and <code>*</code>, but merge is associative.
Then I realized I could do merge sort with parallel reduction.
That’s the summary.
Alex, what have you been doing all your life? This.
You might say, “that’s not good enough”.
Probably not.</p>
<p>I never talked about that discovery, during the job interview.
I did get the job and it wasn’t particularly good.
It wasn’t good at all.
But, things happen<sup id="fnref:2"><a href="#fn:2" rel="footnote">2</a></sup>.</p>
<a name="Iterators-as-a-concept"></a>
<h2>Iterators as a concept</h2>
<p>Generic programming means
to me finding algebraic structures on which algorithms are defined and writing them
like that.
The second idea is that it will be terribly nice if using beautiful
programming at that level wouldn’t cost us anything.
Anybody can do beautiful things if it’s very slow.
This is why we design languages like <a href="https://en.wikipedia.org/wiki/Prolog">Prolog</a>.
They don’t care as long as they could write it as <a href="https://en.wikipedia.org/wiki/Horn_clause">Horn clauses</a>, or
things like that.
So it’s the combination of two things:</p>
<ol>
<li>Doing programming in mathematical theories</li>
<li>Not losing efficiency</li>
</ol>
<p>We are slowly hinting more at concepts.
How is a concept different from a class?
How is a concept different than an abstract class
or interface in Java?
One way to see this is try to think of how to specify
the concept of an iterator using them.
Consider that iterators have a <code>value_type</code>.
In an interface, every argument must have a fixed type.
Interfaces specify <em>identical interfaces</em>.
A concept defines <em>similar interfaces</em>.
The concept of a pointer doesn’t define
the same interface for every type.
The <code>*</code> operator can point to <code>int</code>, or <code>double</code>, or who knows what.
<em>Concepts have variance on the types.</em></p>
<p>Think also about <code>==</code>.
It is a binary predicate.
If you use inheritance, you can only modify the type of the first argument.
The second argument stays the same.
In Java you can kind of fix it by doing lots of casting.
But, the other problem is more serious as you can’t fix the fundamental variance on <code>value_type</code>.</p>
<p>People say, “but couldn’t there be a correct inheritance?”
Of course, yes.
But it’s not the inheritance we have in C++ or Java.</p>
<p>Because we don’t have concepts, when we write
functions which take an iterator as an argument you cannot say what
requirements it has.</p>
<a name="Kinds-of-iterators"></a>
<h3>Kinds of iterators</h3>
<p>There are several <a href="https://en.cppreference.com/w/cpp/iterator">iterator concepts</a> in STL<sup id="fnref:3"><a href="#fn:3" rel="footnote">3</a></sup>,
all of which we have mentioned before:</p>
<ul>
<li><a href="https://en.cppreference.com/w/cpp/named_req/InputIterator"><code>InputIterator</code></a>: can only advance forward and once advanced, iterators pointing to previous elements become invalid.</li>
<li><a href="https://en.cppreference.com/w/cpp/named_req/ForwardIterator"><code>ForwardIterator</code></a>: can advance forward and have iterators pointing to previous elements.</li>
<li><a href="https://en.cppreference.com/w/cpp/named_req/BidirectionalIterator"><code>BidirectionalIterator</code></a>: can move iterators forward and backward.</li>
<li><a href="https://en.cppreference.com/w/cpp/named_req/RandomAccessIterator"><code>RandomAccessIterator</code></a>: can advance iterators by arbitrary steps in constant time (like pointers).</li>
</ul>
<a name="Linked-iterator"></a>
<h2>Linked iterator</h2>
<p>There are some people who say, “concepts aren’t important because Alex already exhausted them.
there are just four kinds of iterators and that’s all.”
There is a “great” person who goes around and gives talks saying this.
I’m not going to name him<sup id="fnref:4"><a href="#fn:4" rel="footnote">4</a></sup>.</p>
<p>What I’m going to do now is introduce a new kind of iterator,
just to spite this distinguished person.
We want to extend the concept of an iterator with a new concept of a <code>LinkedIterator</code>.
It is a <code>ForwardIterator</code> which in addition to
the normal operations:</p>
<ul>
<li><code>++</code>: advance</li>
<li><code>==</code>: equality</li>
<li><code>*</code>: dereference</li>
</ul>
<p>it has one additional operation which allows
you to set the successor.
If you have an iterator and you have another one,
you can just make the second iterator the successor
of the first.
You can literally connect them.
Of course, the standard model is a linked list.</p>
<p>To make our <code>list_pool</code> iterator a <code>LinkedIterator</code>
we simply add the following function:</p>
<pre><code>void set_successor(iterator x, iterator y) {
x.pool->next(x.node) = y.node;
}
</code></pre>
<p>We want it to be a function not a member
because primitive/built-in
types don’t have member functions<sup id="fnref:5"><a href="#fn:5" rel="footnote">5</a></sup>.
Furthermore, in the case of an iterator,
it might be a pointer, not a class.
In general, I don’t like member functions.
If you have the option of:</p>
<pre><code>x.foo()
</code></pre>
<p>Or</p>
<pre><code>foo(x)
</code></pre>
<p>There is at least one provable advantage.
It has one fewer character<sup id="fnref:6"><a href="#fn:6" rel="footnote">6</a></sup>.
But, since we think generically, a better
question is whether the function could operate
on a built-in type instead of a class.</p>
<a name="Linked-iterator-is--22-unsafe-22-"></a>
<h3>Linked iterator is “unsafe”</h3>
<p>As long as you don’t do <code>set_successor</code>, the topology remains.
But, if you do, things change.
This is a very unsafe operation.
You can even make circular lists.
Some people say this is very bad.
It should not be allowed.
We have to come up with language mechanisms for not doing this evil.
These are the people who believe that there are some syntactic rules that can make programming good.</p>
<p>Are they right?
Why not in the case of circular lists?
They are very useful.
Of course, if you try to get to the end,
you will not be successful.
But, it is a legitimate data structure.</p>
<p>A long time ago when we were programming in Lisp,
there were people saying, “never use set successor (<code>rplcd</code>)”.
They were wrong.
Use whatever is given to you.
But, be wise.
You can write bad code just with <code>+</code>.</p>
<pre><code>while (true) a = a + 1;
</code></pre>
<p>That doesn’t terminate.
Well maybe just <code>while (true)</code> is bad.</p>
<pre><code>a = 1;
while (a > 0) { do stuff }
</code></pre>
<p>There are many ways of writing bad code
and syntax can’t help you.
No smart pointer or syntactic constraint
will make a bad programmer into a good programmer.
It will just replace one sort of bugs with another.
Bad programmers are very creative,
they find amazing things.</p>
<a name="Reverse-linked-ranges"></a>
<h3>Reverse linked ranges</h3>
<p>To understand how this concept works
we will look at a basic algorithm.
If I hadn’t already shown you <code>set_successor</code>
we can learn its use from this algorithm.
It takes two lists, reverses the first,
and attaches it to the second.
It’s a very important list algorithm.
In scheme <code>(append! (reverse! x) tail)</code>
or <code>(nconc (nreverse x) tail)</code>
in Common Lisp.</p>
<pre><code>template <typename I>
// requires I is LinkedIterator
I reverse_linked(I first, I last, I tail) {
while (first != last) {
I next = first;
++next;
set_successor(first, tail);
tail = first;
first = next;
}
return tail;
}
</code></pre>
<a name="Merging-sorted-lists"></a>
<h2>Merging sorted lists</h2>
<a name="Simple-merge"></a>
<h3>Simple merge</h3>
<p>The following function merges two sorted lists,
using the algorithm we just wrote.</p>
<pre><code>template <typename I, typename Compare>
// requires I is Linked Iterator
I merge_linked_simple(I first1, I last1, I first2, I last2, Compare cmp) {
I result = last1;
while (first1 != last1 && first2 != last2) {
I tmp = cmp(*first2, *first1) ? first2++ : first1++;
set_successor(tmp, result);
result = tmp;
return reverse_linked(result, last1, first1 == last1 ? first2 : first1);
}
</code></pre>
<p>Notice that a good thing about iterators
is it helps us avoid writing <code>nil</code>/<code>null</code>.</p>
<p>It’s called simple because it’s simplistic.
Why?
In terms of complexity it takes two passes.
We have to go through the lists, and merge them,
roughly <code>n</code> successors on the way there.
Then we do the same number doing the <code>reverse_linked</code>.
Also note that algorithmically there is no good reason why we evaluate</p>
<pre><code>while (first1 != last1 && first2 != last2)
</code></pre>
<p>On every single iteration, because only the one iterator
we moved in the loop could become empty.</p>
<p><strong>Exercise:</strong> Write an alternative merge which does not do this extra comparison every loop (solved just below).</p>
<a name="Merge-with-fewer-comparisons"></a>
<h3>Merge with fewer comparisons</h3>
<p>I clearly teach you all the wrong things.
I tell you not to use
inheritance, smart pointers, or read certain books.
Now I’m going to teach you to use <code>goto</code>.
The greatest authority in computer science wrote a famous letter to
communications of ACM called, <a href="papers/goto-harmful.pdf">“Go To Statement Considered Harmful”</a>.
There is nothing harmful in the computer.
The computer is good.
It has an instruction called <a href="https://en.wikipedia.org/wiki/JMP_(x86_instruction)">JMP</a> (or branch).
If it’s there, why not use it?</p>
<p>If you are going to use <code>goto</code>, it’s probably
because you have something like a finite state machine.
The state machine goes between fundamental states.
You probably learned about them in school, but they never told
you it relates to <code>goto</code>.
What are the states which we need for this algorithm?
Which list won the comparison and advanced.
Either the 1st, or the 2nd.</p>
<pre><code>template <typename I, typename Compare>
// I is a linked forward iterator
std::pair<I, std::pair<I, I> >
merge_linked_non_empty(I first1, I last1, I first2, I last2, Compare cmp) {
I head, tail;
if (cmp(*first2, *first1)) {
head = first2;
tail = first2;
++first2;
goto winner2;
} else {
head = first1;
tail = first1;
++first1;
// goto winner1;
}
winner1:
if (first1 == last1) goto empty1;
if (!cmp(*first2, *first1)) {
tail = first1;
++first1;
goto winner1;
} else {
set_successor(tail, first2);
tail = first2;
++first2;
// goto winner2;
}
winner2:
if (first2 == last2) goto empty2;
if (cmp(*first2, *first1)) {
tail = first2;
++first2;
goto winner2;
} else {
set_successor(tail, first1);
tail = first1;
++first1;
goto winner1;
}
empty1:
set_successor(tail, first2);
return std::make_pair(head, std::make_pair(first2, last2));
empty2:
set_successor(tail, first1);
return std::make_pair(head, std::make_pair(first1, last1));
}
</code></pre>
<p>Let’s go through the states.
Right away,
we need to determine who the winner is.
For performance this part doesn’t matter
because it’s not in the inner loop.
<code>winner1</code> means the smaller element
came from the 1st range, and similarly
for <code>winner2</code>.
We compare just the one that advanced.
The two states are symmetric.</p>
<p>I return 3 iterators.
Why?
It’s specific to linked lists/iterators.
If I want to take the resulting list
and attach it, I need to be able to modify
the successor of the final node.
But, if we return the end, it’s probably
<code>nil</code> so I don’t have it.
You just return all the information.
The caller can do whatever they please.
If they want to ignore it, ignore it.</p>
<p>Note that it assumes the lists are nonempty,
which is perfectly fine for our sort,
which is not going to merge empty lists<sup id="fnref:7"><a href="#fn:7" rel="footnote">7</a></sup>.</p>
<p>Can you write it without <code>goto</code>?
Not as efficiently<sup id="fnref:8"><a href="#fn:8" rel="footnote">8</a></sup>.</p>
<a name="Is-it-worth-it-3f-"></a>
<h3>Is it worth it?</h3>
<p>We now have two programs.
One of them is oh so very simple.
The other one is elegant, but long and does a minimal number of operations.
Which one should we use in practice?
We need to do a lot of experiments to establish certainty
of what we are doing<sup id="fnref:9"><a href="#fn:9" rel="footnote">9</a></sup>.</p>
<p><strong>Exercise:</strong> Measure and determine whether it’s actually faster than our simple merge.</p>
<p>Can we think of any more performance improvements?
In terms of operations we have cut it to the bare bone.
But, one thing is <a href="https://en.wikipedia.org/wiki/Branch_predictor">branch mispredictions</a>.
Modern processors try to predict which
way a condition is going to go.
If you look at our branches, the probability
of going one way or the other is 50 percent.
That’s literally the worst thing which could happen.
I’m entering the territory where I haven’t done work yet.
I haven’t tried see whether some kind of predication avoidance of <code>goto</code>
could be done.</p>
<p><strong>Exercise:</strong> Try to write a version of this algorithm which is more friendly
for branch prediction.</p>
<a name="Merge-sort"></a>
<h2>Merge sort</h2>
<p>Now that we can merge lists and we have our binary counter,
we can write merge sort.
For our machinery, we need to wrap this operation in an object.
There is no code, it’s just a way of invoking our merge function.
It has 5 arguments, and we need a binary function.</p>
<pre><code>template <typename I, typename Compare>
// I is Linked Iterator
struct mergesort_linked_operation
{
typedef I argument_type;
I nil;
Compare cmp;
mergesort_linked_operation(I nil, const Compare& cmp) : nil(nil), cmp(cmp) {}
I operator()(I x, I y) { return merge_linked_simple(x, nil, y, nil, cmp); }
};
</code></pre>
<p>The purpose of this is not to learn to sort lists.
It is of course a useful skill.
The purpose is to show you this code.
Observe it is the same machine as we had before.</p>
<pre><code>template <typename I, typename Compare>
// I is Linked Iterator
I mergesort_linked(I first, I last, Compare cmp) {
mergesort_linked_operation<I, Compare> op(last, cmp);
binary_counter<mergesort_linked_operation<I, Compare> > counter(op, last);
counter.reserve(16);
while (first != last) {
I tmp = first++;
set_successor(tmp, last);
counter.add(tmp);
}
return counter.reduce();
}
</code></pre>
<p>It is very efficient, and doesn’t do any kind of list splitting<sup id="fnref:10"><a href="#fn:10" rel="footnote">10</a></sup>.
If you don’t find it’s beautiful I have nothing to teach you.
We aren’t on the same wavelength.
In the modern world, you meet somebody and
say, “<a href="https://en.wikipedia.org/wiki/Johann_Sebastian_Bach">Bach</a> is a great composer”.
He says, “nah, <a href="https://en.wikipedia.org/wiki/Lady_Gaga">Lady Gaga</a> is much more gifted”.
It’s a free world.
People are allowed to say whatever they like.
Some people will say, “oh this is not object-oriented”, or “this is not functional”,
which it isn’t and I’m very proud of it.
But, in some sense this is literally the essence of my life’s work, this piece of
code.
That’s where it started.
That’s where it ends.
The majority of people do not get it.
The majority of computer scientists do not get it.
There is absolutely no indication that getting it will make you rich.</p>
<p><strong>Exercise:</strong> Implement a visualizer (such as console output) which shows
the contents of the counter at each step of the merge algorithm.</p>
<p><strong>Exercise:</strong> Implement merge sort with <code>std::accumulate</code> (left fold) instead of binary counter.
This is a very inefficient merge sort, but can be helpful to understand how the binary
counter works.</p>
<a name="Code"></a>
<h2>Code</h2>
<ul>
<li><a href="code/list_algorithm.h">list_algorithm.h</a></li>
<li><a href="code/test_merge_sort.cpp">test_merge_sort.cpp</a></li>
</ul>
<div class="footnotes">
<hr/>
<ol>
<li id="fn:1">
Alex studied math at
<a href="https://en.wikipedia.org/wiki/Moscow_State_University">Lomonosov Moscow State University</a> from 1967-1972.
He was a professor in the United States, so I believe this was a research
or graduate level degree (although he does not appear in Math genealogy, or perhaps his name was Americanized).
Based on my reading, I believe his area of research is number theory.
I believe he is alluding to teaching an abstract algebra course as part of
his graduate or post-graduate studies.<a href="#fnref:1" rev="footnote">↩</a></li>
<li id="fn:2">
This story can also be found in <a href="http://stepanovpapers.com/LoRusso_Interview.htm">this interview</a>.<a href="#fnref:2" rev="footnote">↩</a></li>
<li id="fn:3">
This is a subject for which the <a href="https://www.boost.org/sgi/stl/Iterators.html">SGI Documentation</a>
can be a better resource.<a href="#fnref:3" rev="footnote">↩</a></li>
<li id="fn:4">
Alex is likely referring to <a href="https://en.wikipedia.org/wiki/Andrei_Alexandrescu">Andrei Alexandrescu</a> who gave a talk
<a href="https://accu.org/conf-docs/PDFs_2009/AndreiAlexandrescu_iterators-must-go.pdf">“Iterators must Go”</a>.<a href="#fnref:4" rev="footnote">↩</a></li>
<li id="fn:5">
Other programming languages, such as Swift, allow you to extend primitive types like <code>int</code> with additional member functions.<a href="#fnref:5" rev="footnote">↩</a></li>
<li id="fn:6">
<p>This argument doesn’t hold if the function requires more than one argument.
These two forms both require 8 characters to type:</p>
<pre><code>x.foo(y) foo(x, y)
</code></pre>
<p>Perhaps the space could be dropped:</p>
<pre><code>foo(x,y)
</code></pre>
<p>However Alex doesn’t follow this convention.</p><a href="#fnref:6" rev="footnote">↩</a></li>
<li id="fn:7">
<p>In “Elements of Programming”, Alex often follows this pattern.
First he writes a function requiring many strict preconditions, for example a list must be nonempty.
Then he creates a wrapper function which does additional work to guarantee the preconditions are met.</p>
<p>Removing all the special cases allows the core algorithm to be expressed concisely.
And it also becomes more modular, as other components can often guarantee a subset of the preconditions without doing extra work.</p><a href="#fnref:7" rev="footnote">↩</a></li>
<li id="fn:8">
Alex: I have this in code going back to 1985.
I wrote it then in Scheme without <code>goto</code>,
but it had other efficiency problems.
Since then I have published the code, multiple times.
The first is in my <a href="https://en.wikipedia.org/wiki/Ada_(programming_language)">Ada</a> book on generic libraries
(“The Ada Generic Library Linear List Processing Packages”).
I got such angry letters, especially from Holland,
saying, “don’t you know that <code>goto</code> is harmful?”.
I couldn’t find another solution.<a href="#fnref:8" rev="footnote">↩</a></li>
<li id="fn:9">
In my test (Intel i5, 4 core, g++ 9.3.0)
I noticed about a 15-20% improvement
sorting one million integers.<a href="#fnref:9" rev="footnote">↩</a></li>
<li id="fn:10">
<p>Alex: If you want to see a really bad program see <a href="http://people.csail.mit.edu/phw/index.html">Patrick Henry Winston</a>’s book <a href="http://people.csail.mit.edu/phw/Books/LISPBACK.HTML">“LISP 1st Edition”</a>.
Look at his sorting algorithm for lists: <a href="code/other/radix_sort.lisp">radix_sort.lisp</a>.
It possesses many remarkable properties including using <code>n log(n)</code> extra storage.
It shouldn’t need any extra storage.
It’s also slow.
Good example of a famous person at a respectable school publishing something terrible.
Published does not mean good.</p><a href="#fnref:10" rev="footnote">↩</a></li>
</ol>
</div>
<span style="float: right">
[
<a href="11_min_1_2.html">previous</a>,
<a href="index.html">contents</a>,
<a href="13_searching.html">next</a>
]
</span>
</body>
</html>