Top Banner

of 31

What is a Data Structure

Apr 04, 2018

Download

Documents

narwanimonish
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
  • 7/30/2019 What is a Data Structure

    1/31

    INTRODUCTION TODATA STRUCTURE

    CHAPTER

    1

  • 7/30/2019 What is a Data Structure

    2/31

    ROAD MAP Data representation

    Abstract data type

    Need of data structure

    Data type

    Difference between ADT, DT andDS

    Classification of data structure

  • 7/30/2019 What is a Data Structure

    3/31

    Data Data is collection of numbers, alphabets

    & symbols combined to represent

    information.Atomic data: it is non-decomposable

    entity. Example: integer or char

    Composite data: it is a composition ofatomic data.

    Example: date

    day

    month

    year

  • 7/30/2019 What is a Data Structure

    4/31

    DATA REPRESENTATIONData is represented using differentmethods like hierarchical method.

    The basic unit is bit.

    Eight bits together form one byte whichrepresents a character.

    one or more than one characters areused to form a string.

  • 7/30/2019 What is a Data Structure

    5/31

    let us discuss how the primitive or basic datatypes of any language are internally

    represented in memory.

    Integer Representation The positive data is represented using

    binary number system.8 4 2 1

    2^3 2^2 2^1 2^0

    For negative binary numbers themethods of representation used areones complement and twoscomplement.

  • 7/30/2019 What is a Data Structure

    6/31

    Real Number Representation The method used to represent real numbers in

    computers is floating-point notation. Realnumber is represented by a mantissa andexponent.

    For example, if the base is fixed as 10, 209.52 could be represented as 20952 x 10-2. The mantissa is 20952 and exponent is 2.

    Both the mantissa and exponents are twoscomplement binary integers. For example,20952 can be represented as 1 0 1 0 0 0 111 0 11 in binary form.

  • 7/30/2019 What is a Data Structure

    7/31

    Character Representation

    It is used to store character as well asnumeric information i.e. alpha-numeric data.

    1 1 0 0 0 0 0 0 -> A and 1 1 0 0 0 0 0 1 -> B.

    Then, finally AB -> 11 0 0 0 0 0 0 11 0 0 0 0 0 1.

  • 7/30/2019 What is a Data Structure

    8/31

  • 7/30/2019 What is a Data Structure

    9/31

    Abstract Data Types

    Abstract Data Type (ADT): a definitionfor a data type solely in terms of a set

    of values and a set of operations onthat data type.

    Each ADT operation is defined by its

    inputs and outputs.

    Encapsulation: Hide implementationdetails.

  • 7/30/2019 What is a Data Structure

    10/31

    ADT An ADT is defined as a

    mathematical model of the data

    objects that make up a data typeas well as the functions thatoperate on these objects.

    ADT acts as a useful guideline toimplement a data type correctly.

  • 7/30/2019 What is a Data Structure

    11/31

  • 7/30/2019 What is a Data Structure

    12/31

    EXAMPLES: INTEGER ADT1>INTEGER-ADT -

    set of numbers (-1, -2, 3....-} &set of whole numbers {O. 1,2.. +}.

    2>INTEGER-ADT operations i.eaddition

    subtraction

    multiplication, etc.

  • 7/30/2019 What is a Data Structure

    13/31

  • 7/30/2019 What is a Data Structure

    14/31

  • 7/30/2019 What is a Data Structure

    15/31

  • 7/30/2019 What is a Data Structure

    16/31

    NEED OF A DATA STRUCTURE

    Data structure is needed:

    Give knowledge about how to organize

    data. How to control flow of data.

    How to design structure of data.

    How to implement structure to reducecomplexity & increases efficiency ofalgorithm.

  • 7/30/2019 What is a Data Structure

    17/31

    Organizing Data

    Any organization for a collection of records

    can be searched, processed in any order,or modified.

    The choice of data structure and algorithm

    can make the difference between aprogram running in a few seconds or manydays.

  • 7/30/2019 What is a Data Structure

    18/31

    ROAD MAP

    Data representation

    Abstract data type

    Need of data structure

    Data type

    Difference between ADT, DT andDS

    Classification of data structure

  • 7/30/2019 What is a Data Structure

    19/31

  • 7/30/2019 What is a Data Structure

    20/31

    NEED OF DATA TYPE

    Think of a universal data type - has twodisadvantages:

    Large volume of memory will be occupiedby even a small size of data. Different interpretations for different types

    of data would become very difficult.

    Data type - optimum use of memory

    - defined way to interpretthe bit strings.

  • 7/30/2019 What is a Data Structure

    21/31

    PRIMITIVE DATA TYPE

    Primitive data types are basic data typeof any language that forms the basic

    unit for the data structure defined bythe user.

    A primitive type defines how the data

    will be internally represented in, stored,and retrieved from the memory

  • 7/30/2019 What is a Data Structure

    22/31

  • 7/30/2019 What is a Data Structure

    23/31

    Derived Data Type

    These are non-primitive data typewhich are derived from primitive data

    type. Examples:

    array

    structure

    union

  • 7/30/2019 What is a Data Structure

    24/31

  • 7/30/2019 What is a Data Structure

    25/31

  • 7/30/2019 What is a Data Structure

    26/31

  • 7/30/2019 What is a Data Structure

    27/31

    ROAD MAP

    Need of data structure

    Data representation

    Abstract data type

    Data type

    Difference between ADT, DT andDS

    Classification of data structure

  • 7/30/2019 What is a Data Structure

    28/31

    Classification of data structureData structure

    Linear Datastructure

    Non-primitive

    Trees

    Stacks

    Graph

    Array Linked

    ListQueue

    Non-linear Datastructure

    Primitive

    integer float pointerchar

  • 7/30/2019 What is a Data Structure

    29/31

  • 7/30/2019 What is a Data Structure

    30/31

  • 7/30/2019 What is a Data Structure

    31/31