Class 2- Abstract Datatypes

Embed Size (px)

Citation preview

  • 7/30/2019 Class 2- Abstract Datatypes

    1/8

    Data Structures&

    Algorithms

    Dr Ravi Prakash Gorthi

    Aug-Dec, 2010

  • 7/30/2019 Class 2- Abstract Datatypes

    2/8

    Data Structures & Algorithms

    Topics

    Why Study DS & Algorithms?

    Abstract Data Types

    Arrays and Linked Lists

    Stacks & Queues

    Trees & Graphs Sorting and Searching

    Complexity of Algorithms

  • 7/30/2019 Class 2- Abstract Datatypes

    3/8

    Data Structures & Algorithms

    Text Books:

    1. Data structures and Algorithms in C by Mark Allen Weiss

    2. Fundamentals of Data Structures in C by E. Horowitz, S. Sahni,S. Anderson-Freed

    Reference Books:

    1. Data Structures and Algorithms by A. V. Aho, J. E. Hopcroft,and J. D. Ullman

    2. Introductions to algorithms by T.H Cormen, C.E. Leiserson, R.L

    Rivest, C. Stein

    3. Algorithm Design, Foundation Analysis and Internet Examples

    by Michael T. Goodrich, Roberto Tamassia

    4. The Art of Computer Programming: Sorting and searching,

    volume 3 by D. E. Knuth

  • 7/30/2019 Class 2- Abstract Datatypes

    4/8

    Data Structures & AlgorithmsEvaluation:

    40%Final Exam

    20%Mid-Term

    20%Surprise / Announced

    Quiz

    20%Class Assignments (*)

    WeightageType of Test

    (*): To be submitted within 6 days after the class; evaluated for 10 marks if

    submitted within 6 days, for 7 if submitted between 6 to 10 days and NO marksafter that; bonus marks if submitted within 3 days.

  • 7/30/2019 Class 2- Abstract Datatypes

    5/8

    Data Types

    Def: A data-type is a collection of homogeneous entities

    and a set of operations on these entities.

    E.g. Consider a data-type integer with the collection of

    integers: {int_min, int-min+1, . . . -1, 0, +1, 2, . . .

    Int_max} and the following set of operations:Binary operators: +, -, *, /;

    There are two categories of data-types:

    Built-in Data-types (char, integer, . . . )

    Abstract Data types (stack, tree, . . . )

  • 7/30/2019 Class 2- Abstract Datatypes

    6/8

    Abstract Data TypesDef: An Abstract Data Type (ADT) is a data-type,

    Which is a user-defined (not built-in or pre-defined)

    data-type

    which is organized in such a way that the specificationof the entities, the operations on these entities is

    separated from the internal representation andimplementation details.

    Example:

    Stack and ItsOperations

    Stack and ItsOperations

    CreateAStack ()

    Push (entity, A_Stack)

    Pop (entity, A_Stack)

    A Stack

    Whether the

    stack is

    implemented asan array or asa linked-list isNOT known tothe main / other

    programs!!!

  • 7/30/2019 Class 2- Abstract Datatypes

    7/8

    Abstract Data Types

    Other Examples:

    ADT Tree

    R

    S1 S2

    S11 S12 S21 S22

    Tree and ItsOperations

    Tree and Its

    Operations

    CreateATree ()

    AddSons (list, Parent, A_Tree)

    DeleteSon (entity, Parent, A_Tree)

    SearchTree (entity, Flag, A_Tree)

    How the Tree is

    internallyimplemented isNOT knwn to the

    main / otherprograms; they onlymake use of theoperations;

  • 7/30/2019 Class 2- Abstract Datatypes

    8/8

    Assignments of Class # 2

    1. Come up with an ADT of your own choice, describe the ADT

    and the operations to be implemented on the ADT;

    2. Who is Edsger W Dijkstra? What are his main contributions to

    the field of Computer Programming (which is a part of

    Computer Science)?