Test 2, CSCI 385, Fall 2006
- Use as much paper as you wish, but please label each question.
- Please write legibly.
- [5 points] Give the definition of the term algorithm
- [3 points] Define the ADT list.
- [5 points] Compare and contrast lists and arrays. Discuss when
it is better to use each.
- [5 points] Describe the ADT Stack.
- [5 points] State operations and performance expectations for this ADT.
- [10 points] Describe how a stack can be implemented using an array.
Give pseudo code for the operations of an array based queue.
- [5 points] Describe the ADT Queue.
- [5 points] State operations and performance expectations for this ADT.
- [10 points] Describe how a stack can be implemented using a
linked list.
Give psedudo code for the operations on a list based queue.
- [5 points] Discuss when/why one may wish to use an array based implementation for a stack or queue.
- [5 points] Give the definition for a tree.
- [5 points] Give an algorithm to compute the height of a tree. What
is the performance of your algorithm.
- [2 points] Define a binary tree.a
- [10 points] Given a binary tree, give an algorithm that will print
the tree in a breadth first order. Discuss the performance of your
algorithm.
- [10 points] Given a singly linked list, give a non-recursive algorithm
that will print the list in reverse order. Discuss the performance
of your algorithm.
- [10 points] Give an O(n) algorithm that will evaluate a polynomial
stored in an array.