{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# COP3530OverheadsF99 - Computer Science III COP 3530 Fall...

This preview shows pages 1–5. Sign up to view the full content.

Computer Science III COP 3530 -- Fall 1999 University of Central Florida Computer Science Department Charles E. Hughes

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
WEEK # 1 (1 day) 1. Syllabus and the House Rules Grading Policy Overview of course -- read chapters 1, 2 and 3 of W as a review Self diagnostic test – answers will be available in a week. 2. Java/C++ overviews Assignment #1 : Problems 1.8a,b,c, 1.12. Be complete and neat. This is individual work. If you have problems, see me. Turn in on Thursday, August 26. © C. E. Hughes, UCF Computer Science – 2 – COP 3530 Fall ‘99
COP 3530 Fall 1999 Self Diagnostic Test 1. The algorithmic (programming) techniques of recursion and iteration can be related to the mathematical proof technique of induction in a manner that allows inductive proofs of correctness and run-time complexity . Show this relationship by proving that the first of the following two code segments correctly computes N 2 , for N 0, and that the second has run time complexity 2 N –1, N 1. In this latter case, we base complexity on the number of recursive calls made. function sq(N : integer) : integer; begin if N<=0 then sq := 0 else sq := 2*N – 1 + sq(N-1) end ; { sq } HINT : Prove S(N): sq(N) = N 2 , N 0 procedure Move (n:integer; X, Y, Z:char); begin if n = 1 then writeln('Move ', X, ' to ', Y) else begin Move (n-1, X, Z, Y); writeln('Move ', X, ' to ', Y); Move (n-1, Z, Y, X) end end ; { Move } HINT : Prove S(N): T(N) = 2 N –1, N 1, where T(1) = 1; T(N) = 2 * T(N–1) + 1, N>1. 2. There are many competing abstract implementations for a dictionary, three of which are a sorted linear list (not a linked list), a balanced binary search tree and a trie . Focusing on the lookup only, I have given informal algorithms and analyses of the costs of looking up a word. Discuss the pros and cons of each abstract implementation. Be sure to specify the complexity of the other operations (insert and delete) for each implementation. lookup sorted linear list Start in the middle of the list. If the word is found, report success. If not, and the new word is less than the one in the middle, ignore the bottom half, focusing on the top half of list only. Otherwise, ignore the top half, focusing on the bottom only. If you run out of words in the list, report failure. The search takes O(logN) operations. balanced binary search tree Traverse the tree, starting at its root. Move left any time the word being looked up is less than that in the node you’re visiting; move right if it’s greater; stop the search if it’s equal or there are no more nodes. If found, report success. If out of nodes, report failure. The search takes O(logN) operations. trie © C. E. Hughes, UCF Computer Science – 3 – COP 3530 Fall ‘99

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Traverse the tree, starting at the left child of its root. Check one character at a time, starting at the first. If the character does not match that in the current node, move to its right sibling. If no right sibling exists, report failure. If the character matches that in the current node and all characters have been checked, report success. Otherwise, move down to the left child of this node, focusing on the next letter of the word being looked up. The search takes O(K) operations, where there are K characters in the word.
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern