Chapter 1:

Introduction



Elementary Data organisation

In computers - the information is generally representated by the states of '0' or '1',
'1' being the 'ON' state and
'0' being the 'OFF' state.


Information = Instruction + Data
Data is part of an information and a value of set of values if temporarily stored in the program data or stored permanently on a file in storage devices.

Values are generally either character or numeric

The different data values in the record are inter related to each other.
In orderto make use of these relationships by the program , It is necessary to represent the data values in the organizes form.

This oranization of data is known as data structures.
Data Structures = Oraganized data + operations
So it can also be defined as logical or mathematical model of a particular organization of data.



Applications of Data Structure


  1. Retrieve the individual data element
  2. To solve the relationship between the data elements that are relevant to the solution of the problem
  3. Describe the operations that must be performed on the logically relateddata elements,
    The operations such as Creating, Displaying , Inserting , Deleting , Retrieving etc.
  4. Devise methos of representing the data elements in the memroy of the computers,
    that will reduce the loss of fragmentation and also allows to select the memory configuration or storage structures
  5. Unambiguours-gives freedom to the programmer to choice any type of language that best suits for a particular program
  6. Improve the efficiency of the algorithm


There are two main types of data structure -


Primitive Data Structure

int , float , char , double , long , boolean

Non primitive data structure

Linear Data Structure

A data structure that establishes adjacency between the elements, where all the elements are stored in the memeory linearly or sequentially
Arrays, linked list, Stack, Queues, Heap

Non Linear Data Structure

Any data structure that establishes a relation ship other than adjacency relationship is called non-linear relationship
In trees children , parent , grandparent relationship can be established.


Arrays:
  • are a finite ordered set of homogeneous elements, which are stored in adjacent cells in memeory.
  • The data is represented by a single name identified by a subscript
  • Arrays can be two dimensional that is 2-D,3-D,4-D and N-D
  • Stacks:
  • are a linear data structures where the data is inserted and deleted from one end which is called as the top
  • Data is stores and retrieved in last in first out order
  • Linked list:
  • A list is a linear sequence of data objects of the same type.
  • The list maybe singly,doubly,circular
  • The linked list is a linear collection of data items called as nodes
  • A node is divided into two parts - (1)Information / data field (2) Link field [a pointer to the next node of the list]
  • Trees:
  • A tree is a finite set of vertices that has a vertex called as root and remaining vertices are called as sub-trees

  • Operations on data structures


    Some of the common operations on data structures are :
    1. Insertion
    2. Deletion
    3. Traversing: accessing each element exactly once is called traversing
    4. Sorting
    5. Merging



    Abstract Data Type [ADT]


    Examples



    Private functions are accessible to the public functions and public functions are accessible by the application programs




    Algorithm


    An algorithm is a step by step procedure for performing some task in a finite amount of time
    COMPLEXITY: of an algorithm is the measure ofthe amount of time and/or space requried by an algorithm for an input of a given size(n).
    Space complexity:It indicates the amount of storage [ memory ] required for running the algorithm
    Time complexity:of an algorithm is the amount of time it needs in order to run to completion


    Keeping this in mind - there are two thing to consider in computer prgramming :
    1. Appropriate Data Structure
    2. Appropriate [efficient] Algorithm
    Use space-time tradeoff to increase the efficiency of whatever attribute is required.
    Math