CS1050605b - Computer Science Foundation Exam May 6 2005...

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

Computer Science Foundation Exam May 6, 2005 Computer Science Section 1B No Calculators! Name: SSN: Score: 50 In this section of the exam, there are four (4) problems. You must do all of them. The weight of each problem in this section is indicated with the problem. Partial credit cannot be given unless all work is shown and is readable. Be complete, yet concise, and above all be neat . KEY

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

View Full Document
2 1. [15 points] Given the binary tree shown below, answer questions (a) and (b). (a – 3 points) Is the binary tree shown above a valid binary search tree? YES NO Circle the correct answer. (b – 12 points) Determine the order in which the nodes of the binary tree shown above are visited assuming the function A(root) is invoked. Assume that the tree nodes and pointers are defined as shown. Assume that root is a pointer to the node containing 60. struct treeNode{ int data; struct treeNode *left, *right: } struct treeNode *tree_ptr; void A(struct tree_ptr *node_ptr){ if (node_ptr != NULL){ printf(“%d ,”,node_ptr->data); B(node_ptr->left); B(node_ptr->right); } }
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