Quiz with Solution - Data Structures and Software Principles | CS 225, Quizzes of Data Structures and Algorithms

Material Type: Quiz; Professor: Heeren; Class: Data Structures; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Fall 2007;

Typology: Quizzes

Pre 2010

Uploaded on 03/10/2009

koofers-user-i8y-1
koofers-user-i8y-1 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
First Extra Credit Quiz
CS 225 Data Structures and Software Principles
Fall 2007
Friday, October 26
Name:
NetID:
Lab Section (Day/Time):
1. [Multiple Choice Questions 5 points].
MC1 (1pt)
In an n node AVL tree, the insertion and removal operations require how many rotations to
rebalance the tree in the worst case?
(a) O(log n) for both
(b) O(log n) for insertion and O(n) for removal
(c) O(log n) for insertion and exactly 1 rotation for removal
(d) O(1) for insertion and O(log n) for removal
MC2 (1pt)
A non-root internal node in an order mB-tree has how many children?
(a) m
(b) m1
(c) between m
2and m
(d) between 2 and m
MC3 (1pt)
True or False: An AVL Tree is a minimal height Binary Search Tree.
(a) True
(b) False
MC4 (1pt)
A right-left rotation is used to rebalance the following AVL tree. Four potential solutions are
shown below. Which solution acurately portrays the result of applying the right-left rotation to
node M?
pf2

Partial preview of the text

Download Quiz with Solution - Data Structures and Software Principles | CS 225 and more Quizzes Data Structures and Algorithms in PDF only on Docsity!

First Extra Credit Quiz

CS 225 Data Structures and Software Principles

Fall 2007

Friday, October 26

Name:

NetID:

Lab Section (Day/Time):

  1. [Multiple Choice Questions – 5 points].

MC1 (1pt)

In an n node AVL tree, the insertion and removal operations require how many rotations to rebalance the tree in the worst case? (a) O(log n) for both (b) O(log n) for insertion and O(n) for removal (c) O(log n) for insertion and exactly 1 rotation for removal (d) O(1) for insertion and O(log n) for removal

MC2 (1pt)

A non-root internal node in an order m B-tree has how many children? (a) m (b) m − 1 (c) between ⌈ m 2 ⌉ and m (d) between 2 and m

MC3 (1pt)

True or False: An AVL Tree is a minimal height Binary Search Tree. (a) True (b) False

MC4 (1pt)

A right-left rotation is used to rebalance the following AVL tree. Four potential solutions are shown below. Which solution acurately portrays the result of applying the right-left rotation to node M?

Initial Tree:

Solution 1: Solution 2:

Solution 3: Solution 4:

(a) solution 1 (b) solution 2 (c) solution 3 (d) solution 4

MC5 (1pt)

Keeping a parent pointer in every node of an AVL tree would result in:

(a) O(n) time removals in the worst case and using O(n) more space (b) O(log n) time removals and insertions in the worst case and using O(n) more space (c) O(log n) time rotations on insertions in the worst case and using O(n) more space (d) Asymptotically faster traversals