|
This page documents what we do in class. It contains programs that we will discuss in class, reading assignments from our textbook, links to other sources of information, etc.
The reading assignments are listed by the date on which they were assigned. The sample program files are listed by the date on which they were used. When you are viewing a source code page, you can use your browser's "File -> Save As..." menu item to save a copy of the code on your computer. It is a good idea for you to "play" with these example programs; compile them, run them, make simple changes to them and compile and run them again.
|
- Thursday, May 5.
- Here is Exam 2 as a PDF file. This is due Thursday, May 12. If you have questions about the problems, either send me an email, or arrange an appointment to see me in my office.
- Here is a zip file containing a number of Internet shortcuts to web pages with animations of many different algorithms.
- Here are a few animations about graphs.
- Tuesday, May 3.
- Thursday, April 28.
- See the homework page for your last homework assignment.
- Here is a brief demonstration of some of the things that you can do in Maple with graphs.
- Thursday, April 21.
- Here is code for various tree and graph traversal algorithms.
- From the CLR book, read Chapter 24 (pages 498-510) about minimum spanning trees.
- Tuesday, April 19.
- From the CLR book, read Chapter 8, Sections 8.1 to 8.3 (pages 151-162) about quicksort.
- From the Sedgewick book, read Chapter 7, Sections 7.1 and 7.2 (pages 315-324) about quicksort. (Sedgewick's book goes into quite a bit of detail about quicksort. We will not go over all of these details, but they are interesting and important, since quicksort is used a lot.)
- Here is the code for various versions of quicksort.
- Thursday we will return to graphs.
- Thursday, April 14.
- See the homework page for your sixth homework assignment.
- Here is a link to a very interesting and useful Java library of generic containers and algorithms. This library was specially written for use in data structures and algorithms courses.
This library has some nice tutorials on its documentation page. In addition, the Javadocs for the library are very readable and informative. You may want to look at their PriorityQueue, ArrayHeap, and HeapSort, and compare them to homework assignment 6.
- Tuesday, April 12.
- From the Sedgewick book, reread Sections 5.6, and 5.8 (pages 240-245 and 251-257) about tree and graph traversals. (You also may want to review Sections 5.4, 5.5, and 5.7)
- From the Sedgewick book, read Chapter 9, Sections 9.1 to 9.4 (pages 373-395) about heaps and heapsort.
- From the CLR book, read Chapter 7, Sections 7.1 to 7.4 (pages 140-149) about heaps and heapsort.
- Tuesday, April 5.
- Here is a link to a very interesting library of generic graph algorithms.
Their documentation includes a nice review of graph theory.
- Tuesday, March 29.
- Read Sections 23.1, 23.2, and 23.3 (pages 463-483) on graphs from the CLR textbook.
- From the Sedgewick book, read Sections 5.4, 5.5, 5.6, and 5.7 (pages 227-257) on trees and graphs.
- Tuesday, March 22.
- Read Sections 17.3 (pages 337-343) on Huffman codes from the CLR textbook.
- Tuesday, March 8.
- See the homework page for your fifth homework assignment.
- Read Sections 17.1 and 17.2 (pages 329-336) on greedy algorithms from the CLR textbook.
- Tuesday, March 1.
- See the homework page for your fourth homework assignment.
- The Syllabus states that the first exam is next Tuesday, March 8. But I think that it would be better if we finish the material on dynamic programming first. So the exam is postponed until after spring break. I'll say more about this in class.
- Tuesday, February 22.
- Here are three implementations of the Fibonacci numbers.
- Thursday, February 17.
- Here is a link to a page from which you can download books about PostScript.
- These two recursive algorithms both have O(n) run time, but one has O(n) depth of recursion and the other has O(ln(n)) depth of recursion.
- Tuesday, February 15.
- See the homework page for your third homework assignment.
- From the Sedgewick book, read Section 2.5 (pages 49-52) about recurrence relations. Also see the section "Time Analysis of Recursion" in Chapter 6 of the "Algorithmics" book (pages 139-142 in the 2nd edition). (If you like, you can also look at Sections 4.1-4.3 from CLR (pages 53-64) but it is much more mathematical.)
- From the Sedgewick book, read Section 5.3 (pages 219-225). From the CLR book read Sections 16.2 and 16.3 (pages 309-319).
- Thursday, February 10.
- As a mental exercise, find the recursive pattern in this image.
- Here are a few web pages with nice examples of recursive PostScript programs.
- If you want to program in PostScript at home, you need to download and install gs850w32.exe and gsv46w32.exe from this page.
- You should also read A First Guide to PostScrip.
- Here is an introductory programming course, CS 126, that Robert Sedgewick developed at Princeton that uses C programs that generate (small) PostScript programs in order to do computer graphics in C.
- Tuesday, February 8.
- Here are some simple geometric recursions.
- Thursday, February 3.
- From the Sedgewick book, read Sections 5.4, 5.5, and 5.6 (pages 227-251).
- From the Sedgewick book, do the following Exercises as practice problems for a future exam:
- Exercises 5.3, 5.6, 5.8, 5.9 (page 204),
- Exercises 5.16, 5.19, 5.22, 5.28 (pages 217-218),
- If you want to try something fun, try Exercise 5.30, page 218.
- The following file contains an outline of how iteration can be converted into recursion.
- If you want to read more about the 3x+1 problem, here is a reference, The 3x+1 Problem and its Generalizations (note: this link will only work on campus, unless you use a proxy server).
- Here is a solution to homework assignment 1.
- Tuesday, February 1.
- See the homework page for your second homework assignment.
- From the Sedgewick book, read Sections 5.1 and 5.2 (pages 197-218).
- Thursday, January 27.
- From the CLR book, read Section 2.2.
- From the Sedgewick book, reread Sections 2.3 and 2.4.
- From the Sedgewick book, do the following Exercises as practice problems for a future exam: Exercises 2.5, 2.6, 2.8, 2.10, 2.14, 2.15, 2.16 (pages 43-44).
- From the Sedgewick book, do the following Exercises as practice problems for a future exam: Exercises 2.20, 2.23, 2.28-2.31 (page 48).
- Tuesday, January 25.
- From the Sedgewick book, read Sections 2.1-2.4 and Sections 2.6-2.7.
- From the CLR book, read Section 2.1.
- Chapter 6 of the "Algorithmics" book covers much of the same ideas as the above two reading assignments. Read this chapter as we continue to discus "big-O" notation and see if it helps make what's in the other two books clearer.
- The following file contains implementations of insertion, selection, and bubble sort. These implementations come form the Sedgewick book, pages 283-294.
- Thursday, January 20.
- See the homework page for your first homework assignment.
- If you have an introductory programming book at home (either Java or C++) look to see if it has a section (or sections) about sorting. In particular, the three most elementary ways to sort an array are insertion sort, selection sort, and bubble sort. If the book explains these, read the explanations.
- Tuesday, January 18.
- From the "Algorithmics" book, read Chapter 1, "Introduction and historical review".
- From the Cormen, Leiserson, Rivest (CLR) book, read Sections 1.1 and 1.2.
- From the Sedgewick book, read Section 1.1.
- Here is a short list that demonstrates some elementary examples of the kinds of problems we will work with in this course.
|
|
|
|