0
1.5kviews
Explain the types of data structures.
1 Answer
0
25views

i) Stack:

  • Data structure with series of elements with its last element waiting for operation.
  • Operation can be done only in LIFO mode
  • It is used when an element is not directly accessed by index or pointer.
  • An element can be pushed only at the top in the series of elements.
  • Only one pointer used for pop (deleting) and push (inserting)
  • Stack pointer SP increases or decreases after operation.
  • Uses: • Pushing of variables and context on interrupt. • Retrieving popping the pushed data from the stack.

ii) Queue:

  • Series of elements with a header element waiting for read operation called deletion operation.
  • The operation can be done in FIFO mode.
  • It is used when an element is not directly accessed by index or pointer but through FIFO.
  • Element can be inserted only at the end in the series of elements.
  • There are 2 pointers, one for deleting after operation and other for inserting. Both increase after operation.
  • Uses: • Print buffer: Each character is printed in FIFO mode. • Frames on network: Each byte has to be sent as a FIFO. • Image frames in a sequence.

iii) Circular Queue:

  • Queue is called a circular queue, when a pointer on reaching its limit *Qlimit, and returns to its starting value *Qstart.
  • A bounded memory block is allotted to a queue such that its pointer on incrementing never exceeds the set limit and returns to start on increasing beyond limit.
  • The data element is retrieved in the FIFO mode.
  • There is no exception on exceeding the limit of memory block.

iv) Array:

1-D Vector Array Multidimensional Array
It is a series of elements. It is a series of elements each having another sub-series of elements.
It can be accessed by identifier name + index It can be accessed by Identifier name + 2 or more indexes
It is used when each element is to be given a distinct identity by an index. It is used when each element is to be given a distinct identity by 2 or more indices.
It is a one dimensional array, therefore 1 index. The number of indices is equal to number of dimensions.
Index starts from 0 and is a positive integer. Indices start from 0 and are positive integers.

v) List:

  • Each element has pointer to next element.
  • Only first element is identifiable and header identifies it.
  • No other element is identifiable, therefore not accessed directly.
  • By going through first element and consequently through other elements, an element can be read, read and deleted, added or replaced by another element.
  • Uses: • A series of task which are active. Each task has pointer of next task. • Menu that points to a sub-menu.

vi) Pipe:

  • It is a device, which uses device driver function.
  • The insertions are from source end and deletions at sink-end.
  • The deletions are at destination end like queue.
  • Insertion source identity is different from destination identity.
  • Source and destination are connected by some function pipe_connect().

vii) Table:

  • It is a 2-D structure (matrix).
  • A memory block is allocated.
  • There is always a base pointer for table that points to first element in first row and first column.
  • 2 indices: 1 column, 1 row.
  • Any element can be retrieved using a 3 bit address containing table base, column index, row index.
  • A look-up table is a 2-D structure having only rows and each row has a key. When this key is read, address data is traced.
Please log in to add an answer.