Assignment 7 - Algorithms and Data Structures | CS 303, Assignments of Computer Science

Material Type: Assignment; Class: Algorithms and Data Structures; Subject: Computer Science; University: University of Alabama - Birmingham; Term: Spring 2008;

Typology: Assignments

Pre 2010

Uploaded on 04/12/2010

koofers-user-u6m
koofers-user-u6m 🇺🇸

10 documents

1 / 2

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CS 303L Data Structure and Algorithm
April 10, 2008
Homework 7
(Due on April 24, 2008)
Please print this two-page assignment and write your answer in the
blank in front of each question.
1. The maximum number of elements that must be examined to complete a binary search in
an array of 200 elements is
a. 200
b. 8
c. 1
d. 13
2. In the insertion sort, after an item is inserted in the partially sorted group, it will
a. Never be moved again.
b. Never be shifted to the left.
c. Often be moved out of this group.
d. Find that its group is steadily shrinking.
3. Suppose you insert 15, 25, 35, and 45 into a queue. Then you remove three items. Which
one is left?
a. 15
b. 25
c. 35
d. 45
4. When you create a reference to a link in a lined list, it
a. Must refer to the first link
b. Must refer to the link pointed to “current node”
c. Must refer to the link pointed to “next node”
d. Can refer to any link you want
pf2

Partial preview of the text

Download Assignment 7 - Algorithms and Data Structures | CS 303 and more Assignments Computer Science in PDF only on Docsity!

CS 303L Data Structure and Algorithm

April 10, 2008

Homework 7

(Due on April 24, 2008)

Please print this two-page assignment and write your answer in the

blank in front of each question.

  1. The maximum number of elements that must be examined to complete a binary search in an array of 200 elements is a. 200 b. 8 c. 1 d. 13
  2. In the insertion sort, after an item is inserted in the partially sorted group, it will a. Never be moved again. b. Never be shifted to the left. c. Often be moved out of this group. d. Find that its group is steadily shrinking.
  3. Suppose you insert 15, 25, 35, and 45 into a queue. Then you remove three items. Which one is left? a. 15 b. 25 c. 35 d. 45
  4. When you create a reference to a link in a lined list, it a. Must refer to the first link b. Must refer to the link pointed to “current node” c. Must refer to the link pointed to “next node” d. Can refer to any link you want

CS 303L Data Structure and Algorithm

April 10, 2008

  1. The disadvantage of merge sort is that a. It is not recursive. b. It uses more memory c. Although faster than the insertion sort, it is much slower than quick sort. d. It is complicated to implement.
  2. The Shell sort works by a. Partitioning the array b. Swapping adjacent elements c. Dealing with widely separated elements d. Starting with the normal insertion sort.
  3. A sub-tree of a binary tree always has a. A root that is a child of the main tree’s root b. A root unconnected to the main tree’s root c. Fewer nodes than the main tree d. A sibling with the same number of nodes.
  4. In a balanced tree, a. The tree may need to be restructured during searches b. The paths from the root to all the leaf nodes are about the same length c. All left sub-trees are the same height as all right sub-trees d. The height of all sub-trees is closely controlled.
  5. The best technique when the amount of data is not well known is a. Linear probing b. Quadratic probing c. Double hashing d. Separate chaining
  6. A heap can be represented by an array because a heap a. Is complete b. Is weakly ordered c. Is a binary tree d. Satisfies the heap condition GDEHJIKLM