Finished Exercise 2.3-2, 2.3-3.
2.3-3 is trivial. 2.3-2 though, I just translate my C-code back to CLRS style of pseudocode. It is long, just the MERGE function takes 22 lines. I bet there is a better way to do it.
Browse Read: 236/1144
Exercises Up To: 2.3-4
Exercises which are finished but not on paper: 2.3-7, 6.1-7, 6.2-3, 6.2-4, 10.1-6 and 10.1-7.
Finishing merge sort gives me a boost. The basic form is not tough but it's quite involved. Young me could have used more than a day to program it without knowing what goes wrong. In any case, probably data structure should be learnt when one is proficient in one particular programming language. (Or as I suspect, one should learn another language to appreciate what "language" means.)
This is my self-study page for the book, "Introduction to Algorithm", or commonly known as CLRS. This is also my diary page of how I struggle and grow in the programming world. I hope this blog can help amateurs or professionals, to improve their skills in programming, learning and living. As of Sep 12, 2011, I finished the "exercise read" of Chapter 2 (20110518) and 3 (20110608) and half of Chapter 4.
Shortcut for chapter specific information
Chapter4
(62)
chapter3
(41)
Chapter2
(22)
chapter6
(10)
chapter12
(9)
chapter15
(8)
chapter13
(7)
chapter7
(7)
Chapter10
(5)
chapter5
(5)
Appendix A
(4)
chapter8
(4)
Chapter19
(3)
Chapter22
(3)
Chapter34
(3)
Chapter35
(3)
chapter11
(3)
chapter16
(3)
chapter18
(3)
Appendix C
(2)
Chapter21
(2)
Chapter25
(2)
Chapter26
(2)
Chapter27
(2)
Chapter28
(2)
Chapter29
(2)
Chapter9
(2)
chapter14
(2)
chapter20
(2)
chapter23
(2)
chapter24
(2)
chapter30
(2)
chapter31
(2)
chapter32
(2)
Appendix D
(1)
Chapter1
(1)
Chapter33
(1)
chapter17
(1)
Showing posts with label merge sort CLRS pseudocode. Show all posts
Showing posts with label merge sort CLRS pseudocode. Show all posts
Thursday, May 5, 2011
Thursday, April 28, 2011
Merge sort 1 (CLRS pseudocode)
Wrote the first CLRS pseudo. After some thought, it is clear to me my first real implementation in merge sort should be in perl or python first. Because writing in C will require me to get the memory allocation correct. Technique exists to just use one working memory to solve the problem. But they are certainly not the same as the style from CLRS.
Also read through 5.2.4 by DEK, I don't thoroughly understand it.
Also read through 5.2.4 by DEK, I don't thoroughly understand it.
Subscribe to:
Posts (Atom)