CSCI 2720 Data Structures Spring 2004 News about test 1 --------------------------- SCORES AND GRADE SCALE ----------------------------- Class average raw score was 73 out of 100 points possible. Class averages on questions 1-10, 11, 12, 13, 14, 15, 16, and 17 as % of the possible were: 72%, 94%, 49%, 64%, 94%, 58%, 63%, and 68%, respectively. Highest score in class was 92 points. Grade scale: A >= 85%, B >= 72.5%, C >= 60%, D >= 50%. This will be the percentage-to-grade conversion mapping for all scaled scores in the course. Scaling: add 10% to the raw score to obtain the scaled score for test 1. So a raw score of 70 scales to 77, which is 77% since it is out of 100, and lies just below the middle of the B range. ---------------------------------- ANSWERS ------------------------------------- 1(a) T 1(b) F 1(c) T 2(a) F 2(b) T 3 F 4 T 5 F 6 T 7 F 8(a) F 8(b) T 8(c) F 9 F 10 T 11 O(n log n) 12(a) A binary tree is empty or else a root node with left and right subtrees which are binary trees. 12(b) A binary search tree (BST) is a binary tree with a key at every node and a linear ordering (say <) on the keys such that if nonempty then kl < key(root) < kr for all keys kl in the left subtree and kr in the right subtree. 13 template < class Ktype, class Ctype > class List { struct Node { // or class with public members; may be declared first // in a separate templated declaration Ktype Key; Node * Next; // public node functions go here }; Node * Head; // public list functions go here }; 14 20 / \ / \ 10 60 / \ / \ / \ / \ 5 15 30 70 / \ / / \ / 25 50 65 15(a) 6 15(b) 3 15(c) 45 15(d) 3 (45/15) 15(e) 75 (45 + 2*15) 16(a) 35 \ \ 40 16(b)*** See note below. *** 60 / \ / \ 10 85 / / 75 17(a) void PreOrdRec (Node* P) { if ( P ) { Visit(P-->KEY); PreOrdRec (P-->LC); PreOrdRec (P-->RC); } return; // optional } 17(b) void PreNoTail (Node* P) { while ( P ) { Visit(P-->KEY); PreNoTail (P-->LC); P = P-->RC; } return; // optional } *** Note: in class, a variant removal algorithm was presented. That variant gives that for 16(b) only two changes are needed to the original tree; root node = (85), and (60)->LC = (10). If you had this answer and points were deducted for it, please return your test paper to the instructor to have the grading corrected.