Chris Pollett > Old Classes > PIC10B Lec 1&2 ( Print View ) Lecture Notes-PDF. Enrollment info. Course Info:
Practice Exams: PIC: |
PIC 10b Fall 2000 HW #5Due date: Nov. 29. Lecture 1's due time is: noon ========= Lecture 2's due time is: 5:30pm. Reading Assignment: Reading in Sedgewick. Finish 5.3-5.7 =================== Files to submit: pic10bhw5file1.cpp - Sedgewick 5.55 ================= pic10bhw5file2.txt - Sedgewick 5.63, 5.69, 5.71 pic10bhw5file3.cpp - tree program described below HW5 Purpose: To gain practice with recursion, memoization, and trees. ============ General Instructions ==================== For problem 5.55 you should include in your file both your recursive function which should have prototype int choose (int n, int k); as well as a driver program which asks the user for two integers n,k then computes choose(n,k) then allows the user to compute choose(n,k) for two other numbers if the user so desires. pic10bhw5file3.cpp ================== Using the struct on page 234 of Sedgewick you should write a small driver program which first creates the following tree: 12 (The item stored in the root is the integer 12) /\ 9 16 / /\ 7 13 18 It then calls the functions void PreOrder(link h, void visit(link)); //does preorder traversal of tree void InOrder(link h, void visit(link)); //does inorder traversal of tree void PostOrder(link h, void visit(link));//does postorder traversal of tree on the above tree using the functions void vis1(link l); which just prints out the item stored in the l. void vis2(link l); which prints out (l->item)%5. HW5 Point Breakdown ======================= If the submit program didn't collect your file because you misnamed it or you did not follow the required formatting instructions in the syllabus you will get a 0 without an opportunity for a regrade. How well your code is commented.........1pt. choose function works and uses recursion and uses memoization..........1pt. Driver program for choose works as described above.........................1pt. 5.63, 5.69, 5.71 .......................3pt. (1pt each) file3 traversal code correct............1pt. has two different visit functions as described above that work correctly.1pt. ============================================ Total...................................8pts |