Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 4

7. Explain the concepts of following data structures.

(a) Stacks- Defined as a linear list in which are accessed, created, and deleted in a last-in-out order. The concept of the stack is composed of several sections such as: 1. Push-down lists which it describes about operations like adding to and removing form stack are done from only one end referred to as TOP. It also is dynamic in nature as it constantly keeps changing its size due to addition and deletion from stack. When we add an item, we term the operation PUSH and when we delete an item, we term the operation POP. We can also see that the item (refer figure 1.1), which is added last, is the one, which will be removed first. This property of the stack called Last-in-First-out. 2. Example: a stack of papers.

Figure 1.1

REFERENCE: NIIT book pages 8.3

(b) Queues- A particular kind of collection in which the entities in the collection are kept in order and the principal (or only) operations on the collection are the addition of entities to the rear terminal position and removal of entities from the front terminal position. This makes the queue a First-In-First-Out (FIFO) data structure. In a FIFO data structure, the first element added to the queue will be the first one to be removed. It provides services in computer science, transport, and operations research where various entities such as data, objects, persons, or events are stored and held to be processed later. It also are common in computer programs, where they are implemented as data structures coupled with access routines, as an abstract data structure or in object-oriented languages as classes.(refer figure 1.2). It can be categorized into different types such as: 1. Priority is an abstract data type in computer programming. 2. Circular is a data structure that uses a single, fixed-size buffer as if it were connected end-toend. This structure lends itself easily to buffering data streams. 3. Simulation application is one can imagine a priority queue as a modified queue, but when one would get the next element off the queue, the highest-priority one is retrieved first. 4. Example: a line in a cafeteria

Figure 1.2

REFERENCE: http://en.wikipedia.org/wiki/Queue_data_structure
: NIIT book pages 8.3-8.4

(c) Trees- Defined in computer science, a Tree is a widely-used data structure that emulates a hierarchical tree structure with a set of linked nodes (refer figure 1.3). A type of data structure in which each element is attached to one or more elements directly beneath it. The connections between elements are called branches. It is very useful for search like search, and dictionary. It also has various types of trees such as: 1. Unbalanced binary trees each node can have a maximum of two successors, left and right, also called sub trees. 2. Balanced binary trees is the height of two sub trees of every node differ by more than one. 3. Example:

Figure 1.3

REFERENCE: http://www.webopedia.com/TERM/T/tree_structure.html : NIIT book pages 9.4

(d) Graphs- Defined in computer science, a graph is an abstract data structure that is meant to
implement the graph and hyper graph concepts from mathematics. A graph data structure consists of a finite (and possibly mutable) set of ordered pairs, called edges or arcs, of certain entities called nodes or vertices (refer figure 1.4). Graphs can be of the following types such as complete graphs, multi graphs, directed graphs, and undirected graphs. It also can be represented using matrices or Linked lists. Some common applications of graphs are finding the shortest route, project planning, electrical circuit analysis.

1. Example:

Figure 1.4

REFERENCE: NIIT book pages 9.4

You might also like