Friday 23 January 2015

Introduction to Data Structure

Syllabus :
Ø Introduction to Data Structures
Ø    Algorithm and Complexity 
Ø    Array
Ø    Searching And Sorting Algorithms
Ø    Stack
Ø    Queue
Ø    Linked List
Ø    Graph and Tree


Text Books:
1.Seymour Lipschutz, “Data Structure”,  Schaum’s Outlines, Tata McGraw Hill
2.Sartaj Sahni, “Data Structures, Algorithms”, Tata Mc Graw Hill, New York
3.Preiss, Bruno R., “Data Structures and Algorithms: With Object-Oriented Design Patterns in C++ “, John Wiley & Sons, New York
4.R.S. Salaria, “Data structure and algorithms using C”
Reference Books:
1.Kruse, Tonso, Leung, “Data Structures and Program Design in C”
2.Langsam, Augestein, Tanenbaum, “Data Structures using C and C++”
3.Weiss, “Data Structures and Algorithm Analysis in C/C++”
4.Carrano and Prichard, “Data Abstraction and Problem solving with C++”
5.Corman at el, “Introduction to Algorithms”

Why This Course:
You will be able  to evaluate the quality of a program (Analysis of Algorithms: Running time and memory space )
You will be able to write fast programs
You will be able to solve new problems
You will be able to give non-trivial methods to solve problems.
     (Your algorithm (program) will be faster than others.)

Preface of Data structure

Even though computers can perform literally millions of mathematical computations per second, when a problem gets large and complicated, performance can nonetheless be an important consideration.
One of the most crucial aspects to how quickly a problem can be solved is how the data is stored in memory. 
Data Structure :
data structure is a particular way of organizing data in a computer so that it can be used efficiently.

Operations on Data Structures:
Basic operation –
    Traversing – Accessing and processing record exactly once
    Insertion – Adding new record to data structure
    Deletion – Removing particular record from the data structure
    Searching – Finding the location of the record in data structure
Special operation –
    Sorting – Arranging the record in some specific order
    Merging – Combining the records from different data structures to single data structure

ALGORITHM
A well-defined computational procedure that takes some value, or a set of values, as input and produces some value, or a set of values, as output.
 It can also be defined as sequence of computational steps that transform the input into the output.
An algorithm can be expressed in three ways:-
(i) in any natural language such as English, called pseudo code.
(ii) in a programming language or
(iii) in the form of a flowchart.

What is Good Algorithm?

There are so many different algorithms for solving a certain problem.
Good algorithm is an efficient algorithm.
What is efficient?
Efficient is something, which has small running time and takes less memory.
These will be the two measures of efficiency we will be working with.

Algorithm Vs Program
What is the difference between an algorithm and a program?
    à a program is an implementation of an algorithm to be run on a specific computer and operating system.
   à an algorithm is more abstract – it does not deal with machine specific details – think of it as a method to solve a problem. 

Cost of data structure or algorithm
              Cost of data structure or algorithm is always calculated in terms of following parameters –
1.Time Complexity: Time required to perform a basic operation on data
2.Space Complexity: Memory space required to store the data items of data structure
         3.Programming efforts to write code for basic operations. 

Space – Time Tradeoff
Reduction of needed space could increase the time of execution.
Example –
1.Compressed and uncompressed data –
          A space–time tradeoff can be applied to the problem of data storage. If data is stored uncompressed, it takes more space but less time than if the data were stored compressed (since compressing the data reduces the amount of space it takes, but it takes time to run the decompression algorithm).
Depending on the particular instance of the problem, either way is practical.
2.Smaller code and loop unrolling –
Ø  Larger code size can be traded for higher program speed when applying loop unrolling(A basic compiler optimization is known as 'loop unrolling. Loop unrolling means going back to some previous statement.).
Ø  This technique makes the code longer for each iteration of a loop, but saves the computation time required for jumping back to the beginning of the loop at the end of each iteration.
        
Type of data structures
1.Array  
2.Stack
3.Queue
4.Linked list
5.Tree
6.Graph
7.Heap etc.
Selection of data structure

Ø    Organization of data in memory affects the performance of algorithm
Ø    So, selection of data structure plays important role to make algorithm efficient
       But, it depends on the nature of problem and operations to be supported.
Typically, following steps are to be followed to select an efficient data structure –
1.Analyze the problem very carefully and estimate the resources so that solution must meet.
2.Determine the basic operation to be supported
3.Select the best data structure which meets the above requirements.

Abstract Data Type (ADT)  
A data type can be considered abstract when it is defined in terms of operations on it, and its implementation is hidden.
Here are some examples:
 1. stack: operations are "push an item onto the stack", "pop an item from the stack", "ask if the stack is empty"; implementation may be as array or linked list or whatever.
2. queue: operations are "add to the end of the queue", "delete from the beginning of the queue", "ask if the queue is empty"; implementation may be as array or linked list or heap.







No comments:

Post a Comment