Ans: Data Structure: Data may be organized in many different ways; the logical or  mathematical model of a particular organization of data is called a data  structure.
  Different types of data structure:
- Arrays: The simplest type of data structure is a linear array. A linear array is  a list of a finite number n of homogeneous data elements such that:
 
- The elements of the array are referenced respectively by an index set consisting of n consecutive numbers.
 - The elements of the array are stored  respectively in successive memory locations.
 
Linear arrays are called one  dimensional array. A two dimensional array is a collection of similar data  elements where each elements is referenced by two subscripts and  multidimensional arrays are defined analogously.
- Records:A record is a  collection of related data items,  each of which is called a field or attribute and a file is a collection of  similar records.
 
Example: A hospital record on each new born baby:
- New born
 - Name
 - Sex
 - Birthday
 - Month
 - Day
 - Year
 - Father  
 
- Name
 - Age
 - Mother
 
- Name
 - Age
 - Link lists:A linked list or one way list is a linear collection of data elements, called nodes, where the linear order is given by means of pointers. Each node is divided into two parts: the first part contains the information of the element, and the second part called the link field or next pointer field contains the address of the next node in the list.
 
- Stacks: A stack is a list of elements in which an element may be inserted or  deleted only at one end, called the top of the stack. This means that elements  are removed from a stack in the reverse order of that in which they were  inserted into the stack. Stacks are called last in first – out (LIFO) system.                                                            Special terminology is used for two  basic operations associated with stacks:
 - “Push” is the term used to insert an element into a stack.
 - “Pop” is the term used to delete an  element from a stack.
 - Queues: A queue is a linear list of elements in which deletion can take place only at one end, called the front and insertions can take place only at the other end, called the rear. The terms “front” and “rear” are used in describing a linear list only when it is implemented as a queue. Queues are called first in first out (FIFO) lists.
 - Trees: Tree is a non linear data structure. Tree is used to represent data  containing a hierarchical relationship between elements, e.g. records, family  trees and table of contents. Binary tree is a special kind of tree, which can  be sassily maintained in the computer.

 
Graphs: Data sometimes contain a relationship between pairs of elements which is  not necessarily hierarchical in nature. The data structure which reflects this  type of relationship is called a graph.
Q. 2: Define different types of data structure operations.
  Ans: Data structure operations: The following four operations play a major role in  data structure operation:
- Traversing: Accessing each record exactly once, so that certain items in the record may be processed.
 - Searching:Finding the location of the record with a given key value, or finding the locations of all records which satisfy one or more conditions.
 - Inserting:Adding a new record to the structure.
 - Deleting: Removing a record from the structure.
 
The following two operations, which  are used in special situations:
- Sorting: Arranging the records in some logical order.
 - Merging: Combining the records in two different sorted files into a single sorted file.
 
Q.3: What is time space trade off?
  Ans: Time space trade off: The time space trade off refers to a choice between algorithmic solutions  of a data processing problem that allows one to decrease the running time of an  algorithm solution by increasing the space to store the data and vice versa.  
  Q.4: What is algorithm complexity?
  Ans: Algorithm complexity: The complexity of an algorithm M is the function f(n) which gives the  running time and / or storage space requirement of the algorithm in terms of  the size n of the input data.    


No comments:
Post a Comment