Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

10 Questions Final Exam - Data Structures | CSC 503, Exams of Data Structures and Algorithms

Material Type: Exam; Class: Data Structures; Subject: Computer Science; University: SUNY Institute of Technology at Utica-Rome; Term: Unknown 1989;

Typology: Exams

Pre 2010

Uploaded on 08/09/2009

koofers-user-k1x
koofers-user-k1x 🇺🇸

10 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Final Exam
CSC-340 & CSC-503
Data structures
Fall '00
Answer only five questions!
1. Create an AVL tree with the following nodes inserting them in the order they are
presented.
Dan, Arv, Brett, Joseph, Seth, Tim, Deborah, Daryle, Matthew,
Justin, and, David.
Now answer the following multiple choice questions.
A. Which nodes are at level two?
(a) Dan, Joseph, Matthew, Seth
(b) Daryl, Justin, Seth, Tim
(c) Brett, Deborah, Matthew, Tim
(d) Arv, Dan, Justin
(e) Brett, Deborah, Seth, Tim
(f) None of the above
B. Which are the leaf nodes of the balanced trees?
(a) Arv, deborah, Tim
(b) Arv, David, Justin, Matthew, Tim
(c) Brett, Deborah, Matthew, Tim
(d) Brett, deborah, Seth, Tim
(e) All of the above
(f) None of the above
C. Which are the single child parents?
(a) Dan, Deborah
(b) David, Deborah, Justin
(c) Matthew, Tim, Deborah, Justin
(d) None of the above
2. Draw the appropriate binary tree from the two given traversals appearing below. The
traversals are in inorder and postorder, respectively.
INORDER: c a f h g i e b d
POSTORDER: c h i g f e d b a
pf3

Partial preview of the text

Download 10 Questions Final Exam - Data Structures | CSC 503 and more Exams Data Structures and Algorithms in PDF only on Docsity!

Final Exam CSC-340 & CSC- Data structures Fall ' Answer only five questions!

  1. Create an AVL tree with the following nodes inserting them in the order they are presented. Dan, Arv, Brett, Joseph, Seth, Tim, Deborah, Daryle, Matthew, Justin, and, David. Now answer the following multiple choice questions. A. Which nodes are at level two? (a) Dan, Joseph, Matthew, Seth (b) Daryl, Justin, Seth, Tim (c) Brett, Deborah, Matthew, Tim (d) Arv, Dan, Justin (e) Brett, Deborah, Seth, Tim (f) None of the above B. Which are the leaf nodes of the balanced trees? (a) Arv, deborah, Tim (b) Arv, David, Justin, Matthew, Tim (c) Brett, Deborah, Matthew, Tim (d) Brett, deborah, Seth, Tim (e) All of the above (f) None of the above C. Which are the single child parents? (a) Dan, Deborah (b) David, Deborah, Justin (c) Matthew, Tim, Deborah, Justin (d) None of the above
  2. Draw the appropriate binary tree from the two given traversals appearing below. The traversals are in inorder and postorder, respectively. INORDER: c a f h g i e b d POSTORDER: c h i g f e d b a
  1. In the following problem we consider relations appearing as follows. If x is the left child of y, we would indicate this as x = left(y). Similarly, p = right(q) would imply that p is the right child of q. Assume a binary tree given through the following set of relations: n = left(m), p= right(m), q=left(p), s=right(q), r=right(p), t=left(r), v=right(t), u=left(t) Given this tree, traverse it using the following two traversals as shown below. We assume that to invoke the traversal we would first call traverse_A(p) for the node p. void traverse_A(node* root) void traverse_B(node* root) { { if (root) if (root) { { print(root.item); traverse_A(root.left); traverse_B(root.right); print(root.item); traverse_B(root.left); traverse_A(root.right); } } } }
  2. Write a function that will obtain a mirror image of a given binary tree. The new tree will interchange all left and right subtrees in the given binary tree.
  3. True, or False? (Caution! For every wrong answer for assertions below you might lose 4 points) a. Every graph can be portrayed as a general tree. b. Insertion sort is always faster than a Selection sort. c. A Quicksort's performance is always O(nlgn) d. For an acyclic directed graph there is one and only one path from a node to another node. e. An adjacent list representation of a graph is more efficient when implemented as a set of linked linear lists than as a two-dimensional array.
  4. Indicate, with rationale, which of the sorting methods would be a good choice for the following applications. a. You wish to sort 10,000 data-items once. After you finish you will not keep the program. b. You wish to sort 50 data-items once. After that you will never use the sort program. c. You are told that 5000 item list is already in order, but you want to check it to make sure, and sort any item found out of order.