(no subject)

May 05, 2005 16:05

Oh my the problem they gave me was sort of insane.  It's behind the cut if anyone would like to see it.  And remember, I only had an hour and I was not supposed to attempt to compile it.


Data Structures and Programming
System Definitions

The goal of this exercise is to demonstrate programming ability by developing a simple software subsystem. Work will preferably be done in the C language.

A software subsystem of an air-traffic control system is defined to manage a queue of aircraft (AC) in an airport. The aircraft queue is managed by a process which responds to three types of requests:
·         system boot                    used to start the system.
·         enqueue aircraft             used to insert a new AC into the system.
·         dequeue aircraft             used to remove an AC from the system.

AC’s have at least (but are not limited to having) the following properties:

·         AC type:                       Passenger or Cargo
·         AC size:                        Small or Large

The process which manages the queue of AC’s satisfies the following:
·         There is no limit on the number of AC’s it can manage
·         Dequeue aircraft requests result in selection of one AC for removal such that:
1.      Passenger AC’s have removal precedence over Cargo AC’s
2.      Large AC’s of a given type have removal precedence over Small AC’s of the same type.
3.      Earlier enqueued AC’s of a given type and size have precedence over later enqueued AC’s of the same type and size.

Library Support for “Data Structures and Programming” problem

To help you implement the system described above, you are provided with a package of Linked-List management procedures.  Assume a data structure type List is defined.  A List can hold any number of pointer-referenced data structures of arbitrary type.  The following procedures are available to users of the library:

List*                    
List_Create  (void);
Allocates a new list and initializes its state.

void           
List_Insert   (List* list_ptr,  int list_pos,  void* struct_ptr);
Inserts a structure into a list at the given position.  Position 0 is the head of the list, Position 1 is the next element, and so on.

void*          
List_Access  (List* list_ptr, int list_pos);
Obtains the address of a structure at the given position in a list.

int             
List_Size  (List* list_ptr);
Returns the number of structures held in the list.

void           
List_Remove  (List* list_ptr,  int list_pos);
Removes the structure at the given position in the list.  Trailing structures slide forward.

System Implementation Tasks
  1. Develop one or more data structures to hold the state of an individual AC.
  2. Develop one or more data structures to hold the state of the AC queue.
  3. Define data structures and/or constants needed to represent requests.
  4. Develop the code for a procedure called aqm_request_process() which accepts any of the three defined requests and follows the above guidelines to implement an aircraft queue manager as efficiently as possible.  Your code may be developed as multiple procedures if necessary and may assume that the library of functions described above is available to facilitate management of the lists.  You do NOT have to implement the list package.  To the greatest extent possible, show all of the code required to implement the system.
The function signature for the function is below.  command will be “SYSTEM BOOT”, “DEQUEUE AIRCRAFT”, or “ENQUEUE AIRCRAFT ”.
void * aqm_request_process (void ** state_pptr, const char *command);

When the system is booting, create your required state and assign *state_pptr to your state. When enqueuing or dequeuing aircraft, you will get back the same state that you assigned in the boot state, so cast it to your type and use it as required.
Develop some test code that boots the system and performs several enqueues and dequeues.
  1. [Extra credit] Future programmers may want to go into the system and add different aircraft types (such as “business jet”) and sizes (such as “tiny”).  Comment your code so that future programmers will know what they need to change to support extra aircraft types and sizes.  Do not actually change your code; the current system still has only types and sizes as originally described on the first page.


Previous post Next post
Up