Wednesday, February 27, 2019

ABSTRACT DATA TYPE

Abstract Data Type(ADT)

            ADT  is  specification of a set of data and the set of operations that can be performed on the data.
  • Abstract  Data Type is an extension of modular design.
  • The basic idea of implementing  ADT is that the operation are written once in program and can be called by any part of the program.

Uses of ADT: 

  1.  It  helps  to efficiently develop  well defined program.
  2.  Facilitates the splitting of the complex task into a number of similar sub-task and also simplifies testing and debugging.


List ADT:

              List is an ordered set of elements. the general form of the list is

    A1, A2,A3,......AN.

              A1   - First element of the list.
              AN Last element  of the list.
                    N  Size of the list.

       If the element at position 'i'  is  Athen its successor is  Ai+1   and its predecessor  is Ai-1.

Various operations performed on List:

  1. Insert(X,5)     - Insert the element X  after the position 5.
  2. Delete (X)      -The element X is deleted.
  3. Find (X)         -Return the position of X.
  4. Next(i)            - Return the position of its successor element i.
  5. Previous(i)     - Return the position of its predecessor i-1.
  6. Print List       -Content of the list is displayed.
  7. Make empty  -Make the list empty.
                                      ************






                                                                                                                     


Sunday, February 24, 2019

ALGORITHM

Algorithm

An algorithm is a sequence of unambiguous instructions for solving a problem for obtaining a required output for legitimate input in  a finite amount of time. 

Features of an algorithm

Every Algorithm must satisfy the following:

          1.    Input-Zero or more quantities are externally supplied.
          2.    Output-At least one quantity is produced.
          3.    Definiteness-Each instruction is clear and well defined.
          4.    Finiteness-The algorithm terminates after a finite number of steps.
          5.    Correctness-Every step of the algorithm must generate a correct    output.

Advantages

  •        It is not dependent on any programming language, so it is easy to   understand for anyone.
  •      It is a stepwise representation of a solution to a given problem.
  •      An algorithm uses a definite procedure.
Disadvantages
  •         It is time consuming
  •          Big task are difficult to put in algorithm.
     

Notation of an algorithm



Methods of Specifying an Algorithm

  There are two operations for specifying an algorithm,
                                                       
        i.     Using natural language
        ii.    Using Pseudo code

Using natural language

     Using a natural language make a brief and clear description of algorithms is difficult.

Using pseudocode

       A pseudocode is a mixture of a natural language and programming language.
  •  A pseudo code is more accurate than a natural language
  •  And the usage yields more succinct algorithm description.
           In earlier days flow charts were used for specifying an algorithm.Flowchart is a method of expressing an algorithm graphically.Flowchart is very complex for larger problem.

                         ***********

    


Saturday, February 23, 2019

DATA STRUCTURE


Introduction to data structures:
          
             The way information is organized in the memory of a computer is called data structure.
                                            (OR)
              A data structure is a way of organizing data that considers not only the items stored; but also their relationship to each other. Advance knowledge about the relationship between data items allows designing of efficient algorithms for the manipulation of data.


The advantages and disadvantages of data structures are listed;


Advantages:
  •         Allows easier processing of data.
  •         Using internet, we can access the data anytime from any connected machine (computer, phone, etc.)
  •         Allows safe storage of information on a computer.
  •         Data structures allow information storage on hard disks.


Disadvantages:

  •         Only advanced users can make changes to data structures.
  •         Any problem involving data structure will need an expert’s help 





 Classifications of data structure:
               


Primitive data structure:

                 It is a basic data structure which can be directly operated by the machine instruction.  (i.e. float, integer, etc..)

Non Primitive Data Structure:

                  Data structure emphasize on structuring of a group of homogeneous (or) heterogeneous data items.
  •       Homogeneous  data structure
                  In homogeneous data structure, all the elements are of same type.


  •        Heterogeneous data structure:
                                 In heterogeneous data structure, the elements may or may not be of the same type.

Linear Data Structure:

                  A data structure which contains a linear arrangement of  element in the memory. (i.e. Array)


Non Linear Data Structure:
              
                  In non_ linear data structures, the data items are not in sequence.
 (i.e. Tree, Graph)

                        ************