Homework Assignment 1 - Operating System | CSCI 3753, Assignments of Operating Systems

Material Type: Assignment; Professor: Mishra; Class: OPERATING SYSTEMS; Subject: Computer Science; University: University of Colorado - Boulder; Term: Unknown 1989;

Typology: Assignments

Pre 2010

Uploaded on 02/10/2009

koofers-user-zhu
koofers-user-zhu 🇺🇸

10 documents

1 / 1

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
CSCI 3753
Spring 2006
Homework 1
Due date: 02/02/06
Delays have dangerous ends—William Shakespeare.
Goal: A C++ warmup exercise.
Grade: 5% of your total grade is allocated for this homework.
Implement a variable sized generic QueueArray class that implements an array of queues,
and exports the following functions:
1. int Enqueue(const type&item,int index): Enqueues item in the queue at array index
index. Returns 1 if item is successfully enqueued; -1, if index is out of range; 0, otherwise.
2. int Dequeue(type&item) : Dequeues an item from the first non-empty queue in the array,
i.e., from the non-empty queue at the lowest numbered index in the array. Returns the
dequeued item in reference variable item. Return 1, if there is at least one item in the
queue array; 0 otherwise.
3. int Qsize(int index)const: Returns the number of items in the queue at array index
index; -1, if index is out of range.
4. int Asize() const: Returns the size of the array.
5. int QAsize() const: Returns the total number of items stored in the array of queues.
6. type* Qstate(int index,int&numItem)const: Copies all items stored in the queue at
array index index in an array. Returns a pointer to this array; NULL, if index is out of
range. The reference parameter numItem contains the number of items in the queue on
return.
7. int PrintQueue() const: Prints all items stored in the queue array. Each item is printed
on a new line. Items of a queue are printed in the order from the beginning of the queue
to the end of the queue. Printing of each queue is preceded by “Number of items in the
queue at array index < index number > are < number of items >”. Printing of each
queue is followed by a line “————————–”. The function returns 1, if the queue
array is successfully printed; 0, otherwise.
You may use standard template library for this assignment. Implement the QueueArray class
in such a way that an example QueueArray object intqueue consisting of an array of 10 integer
queues may be constructed using the following statement:
QueueArray <int>intqueue (10);

Partial preview of the text

Download Homework Assignment 1 - Operating System | CSCI 3753 and more Assignments Operating Systems in PDF only on Docsity!

CSCI 3753

Spring 2006 Homework 1

Due date: 02/02/

Delays have dangerous ends—William Shakespeare.

Goal: A C++ warmup exercise. Grade: 5% of your total grade is allocated for this homework.

Implement a variable sized generic QueueArray class that implements an array of queues, and exports the following functions:

  1. int Enqueue(const type& item, int index): Enqueues item in the queue at array index index. Returns 1 if item is successfully enqueued; -1, if index is out of range; 0, otherwise.
  2. int Dequeue(type& item) : Dequeues an item from the first non-empty queue in the array, i.e., from the non-empty queue at the lowest numbered index in the array. Returns the dequeued item in reference variable item. Return 1, if there is at least one item in the queue array; 0 otherwise.
  3. int Qsize(int index) const: Returns the number of items in the queue at array index index; -1, if index is out of range.
  4. int Asize() const: Returns the size of the array.
  5. int QAsize() const: Returns the total number of items stored in the array of queues.
  6. type* Qstate(int index, int& numItem) const: Copies all items stored in the queue at array index index in an array. Returns a pointer to this array; NULL, if index is out of range. The reference parameter numItem contains the number of items in the queue on return.
  7. int PrintQueue() const: Prints all items stored in the queue array. Each item is printed on a new line. Items of a queue are printed in the order from the beginning of the queue to the end of the queue. Printing of each queue is preceded by “Number of items in the queue at array index < index number > are < number of items >”. Printing of each queue is followed by a line “————————–”. The function returns 1, if the queue array is successfully printed; 0, otherwise.

You may use standard template library for this assignment. Implement the QueueArray class in such a way that an example QueueArray object intqueue consisting of an array of 10 integer queues may be constructed using the following statement: QueueArray intqueue (10);