Docsity

Questions for Exam - Data Structures - Fall 2007 | CS 225, Exams of Data Structures and Algorithms

Toggle sidebar
bg1
Second Extra Credit Quiz
CS 225 Data Structures and Software Principles
Fall 2007
Friday, November 2
Name:
NetID:
Lab Section (Day/Time):
MC1 (1pt)
In an array-based implementation of a Heap, the left-child of the right-child of the node at index i, if
it exists, can be found at what array location?
1. 4i+ 3
2. 2i+ 1
3. 4i+ 1
4. 2i+ 2
5. 4i+ 2
MC2 (1pt)
Suppose you are asked to implement a heap class member function called find whose purpose is to
return the location of a particular key in the heap. Which of the following best reflects the worst case
running time of the function?
1. O(1)
2. O(log n)
3. O(n)
4. O(nlog n)
5. find cannot be implemented in a heap.
pf2

Partial preview of the text

Download Questions for Exam - Data Structures - Fall 2007 | CS 225 and more Exams Data Structures and Algorithms in PDF only on Docsity!

Second Extra Credit Quiz

CS 225 Data Structures and Software Principles

Fall 2007

Friday, November 2

Name:

NetID:

Lab Section (Day/Time):

MC1 (1pt)

In an array-based implementation of a Heap, the left-child of the right-child of the node at index i, if it exists, can be found at what array location?

  1. 4i + 3
  2. 2i + 1
  3. 4i + 1
  4. 2i + 2
  5. 4i + 2

MC2 (1pt)

Suppose you are asked to implement a heap class member function called find whose purpose is to return the location of a particular key in the heap. Which of the following best reflects the worst case running time of the function?

  1. O(1)
  2. O(log n)
  3. O(n)
  4. O(n log n)
  5. find cannot be implemented in a heap.

MC3 (1pt)

True or false: The Huffman Encoding algorithm employs a Priority Queue of Binary Search Trees.

  1. True
  2. False

MC4 (1pt)

Given this set of symbols and frequencies: a 1k d 3k e 4.5k n 5k t 6k which of the following is a valid Huffman encoding of the message “attend”?

  1. 000100100010011001
  2. 00011110110001
  3. 100000010111
  4. None of these.

MC5 (1pt)

A hash function is a reasonable alternative to which of the following data structures?

  1. A priority queue
  2. A heap
  3. A stack
  4. An AVL tree
  5. None of these.