1 / 17

Data Structure and Algorithm

Lecture # 02. Data Structure and Algorithm. Basic Data Types. Numeric Integer Numbers 0,10,15,4563 etc. Fractional Number 10.5, 78.67, 20.0 Character A, X, U, o, r etc. Integer Numbers Binary Number System positive integers only Maximum decimal Value 2 n – 1

hova
Télécharger la présentation

Data Structure and Algorithm

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Dr. Muhammad Umair Lecture # 02 Data Structure and Algorithm

  2. Dr. Muhammad Umair Basic Data Types • Numeric • Integer Numbers • 0,10,15,4563 etc. • Fractional Number • 10.5, 78.67, 20.0 • Character • A, X, U, o, r etc.

  3. Integer Numbers • Binary Number System • positive integers only • Maximum decimal Value • 2 n – 1 • Minimum decimal Value • 0 • No of values • 2n Dr. Muhammad Umair Memory Representation (numeric)

  4. Integer Numbers • Ones Compliment • negative numbers • Minimum Value • -2 n-1 + 1 • Maximum Value • 2 n-1 -1 • No. of Values • 2n - 1 Dr. Muhammad Umair Memory Representation (numeric)

  5. Integer Numbers • Two’s Compliment • negative number • Minimum Value • -2 n-1 • Maximum Value • 2 n-1 -1 • No. of Values • 2n • Binary Coded Decimal Dr. Muhammad Umair Memory Representation (numeric)

  6. Fractional Number • Mantissa • Base • Exponent • 57.78 • 5778 x 10-2 • Mantissa • 5778 • Base • 10 • Exponent • -2 Dr. Muhammad Umair Memory Representation(Numeric)

  7. Character • byte size • Minimum no. of bits required to represent a character value • Byte • No. of bits used to represent one character in the system • Hardware & Software Implementation Dr. Muhammad Umair Memory representation (character)

  8. Data Type • is the collection of objects and the set of operations that act on those objects. • Abstract Data Type • is a data type that is organized in such a way that the specification of the objects and the specification of the operations on the objects is separated from the representation of the objects and the implementation of the operations. Dr. Muhammad Umair Introduction to ADT

  9. Storage Representation of User Data • Understandable for computer • Retrieval of Stored Data • Understandable for user • Transformation of User Data • Operations to transform data from one to another Dr. Muhammad Umair Concept of Data structure

  10. Domain (D) • Range of values • Function (F) • Set of operations • Axioms (A) • Set of rules Dr. Muhammad Umair Concept of Data structure (continued)

  11. Dr. Muhammad Umair Data Structure • Logical or mathematical model of a particular organization of data • Arrays • String • Link List • Tree • Graph • Stacks & Queues

  12. Dr. Muhammad Umair Operation on Data Structure • Traversing • Searching • Inserting • Deleting • Sorting • Merging

  13. Dr. Muhammad Umair Classification of data structure (Implementation)

  14. Dr. Muhammad Umair Classification of data structure (structure)

  15. Dr. Muhammad Umair Array & Its Memory Representation • Identifier keeps the base address • Length = UB - LB - 1 • Address of particular element • Base = B, • Size of element = W, • Lower Bound = LB, • Index = I • Loc (A[ I ]) = B + W * ( I - LB)

  16. Dr. Muhammad Umair Two Dimensional Array (Memory Representation • No. of Rows = M, No. of Columns= N • Row Major • Loc (A[I][J]) = B + W * [N (I-RLB) + (J-CLB)] • Column Major • Loc (A[I][J]) = B + W * [M (J-CLB) + (I-RLB)]

  17. Dr. Muhammad Umair Three Dimensions • Row Major • A[I][J][K] = BA + W * [ ( I – 1LB) * M * N + ( J - 2LB ) * N + ( K - 3LB)] • Column Major • A[I][J][K] = BA + W * [ ( K – 3LB) * L * M + ( J - 2LB ) * M + ( I - 1LB)]

More Related