Data structure and methods


Data Structure and Methods:

• Build an array structure to accomodate at least 10 elements.  Provide routines for  following:
• An initializer.
• A routine to populate (add an element) to the first accessible slot,
• A routine to delete (remove an element) from a selected slot,
• A routine to display the number of the filled slots,
• A routine to show the maximum number of slots,
• A routine to query the contents of a slot,
• A routine to update the information in a slot,
• Test for full and empty conditions of  Array.

Testing:

Write (a) program(s) which tests each of the methods employed to manipulate the data structure:

• Construction.
• Populate the accessible slots till the structure is full, then attempt to add one more.
• Query the contents of an all slots.
• Remove the contents of a given slot.
• Update the contents of a slot.
• Deplete the structure till all slots are empty, and then attempt to delete another.

When displaying the full structure use a loop which shows 1 slot and its content, at a time.
Your program must employ a simple menu that repeatedly prompts the user to perform the functions.

Example: Enter an Request Type

1.To add elements in to the Array (till ­1 or null)
2 To remove an element out of the Array
3. To display the contents of the entire Array
4. To query the count of occupied slots
5. To query the maximum number of slots
6. To update an Array slot with a new information value
7. To find the location of a given value
8. Exit

Show all inputs, outputs, explanation of return codes, and informational messages.

Request for Solution File

Ask an Expert for Answer!!
Programming Languages: Data structure and methods
Reference No:- TGS01226

Expected delivery within 24 Hours