HOMEWORK 1

CMSC 420, Section 0101, Spring 2002

Due: Feb. 7, 2002

 

 

 

You are required to manage insertions and deletions into a set of K queues Q1,..,QK using a fixed length array A[1,..,K]. 

 

  1. (4 points) Describe the data structures you would use for this problem. Explain how these data structures are initialized and what your conventions are for a FULL queue and an EMPTY queue.
  2. (10 points) Write, in pseudocode, an algorithm called insert(value,I) which inserts a value into queue QI. Your algorithm should handle overflows, and where appropriate, it should reorganize the location of queues in A.
  3. (6 points) Write, in pseudocode, an algorithm called delete(I) which deletes the element at the front of queue QI. Your algorithm should report an underflow error if QI is emty.

Web Accessibility