Program to manipulate the data structure, Data Structure & Algorithms

Data Structure and Methods:

  • Build an array structure to accomodate at least 10 elements. Provide routines for the following:
  • An initializer.
  • A routine to populate (add an element) to the first available slot,
  • A routine to delete (remove an element) from a chosen slot,
  • A routine to display the number of 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 the Array.

Testing:

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

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

When displaying the full structure use a loop that shows 1 slot and its content, at a time.

Your program should 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 (until 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.

Posted Date: 3/19/2013 5:09:19 AM | Location : United States







Related Discussions:- Program to manipulate the data structure, Assignment Help, Ask Question on Program to manipulate the data structure, Get Answer, Expert's Help, Program to manipulate the data structure Discussions

Write discussion on Program to manipulate the data structure
Your posts are moderated
Related Questions
Range: A Structured Type in Ruby Ruby has a numerous structured types, comprising arrays, hashes, sets, classes, streams, and ranges. In this section we would only discuss rang

Construct G for α, n, and W given as command line parameters. Throw away edges that have an asymmetric relation between nodes. That is, if A is connected to B, but B is not connect

Write an algorithm for getting solution to the Tower's of Hanoi problem. Explain the working of your algorithm (with 4 disks) with appropriate diagrams. Ans: void Hanoi(int

Merge sort is also one of the 'divide & conquer' classes of algorithms. The fundamental idea in it is to split the list in a number of sublists, sort each of these sublists & merge

difference between recursion and iteration

Define Wire-frame Model This skeletal view is called a Wire-frame Model. Although not a realistic representation  of the object, it is still very useful in the early stages of

Determine the effect of Ruby in implementation of string Ruby has a String class whose instances are mutable sequences of Unicode characters. Symbol class instances are charact

What is Space complexity of an algorithm? Explain.

State about the Bit String Carrier set of the Bit String ADT is the set of all finite sequences of bits, including empty strings of bits, which we denote λ. This set is {λ, 0

Simulation of queues: Simulation is the process of forming an abstract model of a real world situation in order to understand the effect of modifications and the effect of introdu