Docsity

Data Structures and Algorithms: Efficiency Analysis, Slides of Data Structures and Algorithms

Partial preview of the text

Download Data Structures and Algorithms: Efficiency Analysis and more Slides Data Structures and Algorithms in PDF only on Docsity!

Data Structures and Algorithms

( ESO207 )

RECAP OF THE 1 ST LECTURE

Motivation

  • (^) for Efficient algorithms
    • (^) Subset sum problem
    • (^) Sorting
  • (^) for Efficient Data Structures
    • (^) Telephone Directory
    • (^) Range Minima

Homework 1

  • Time Taken 1 minute 10 minutes 60 minutes Here are the values obtained by executing the program on a typical computer. 48 53 58 Processor: 2.7 GH

Current-state-of-the-art Computer A model of computation Simple Close to real world computer

word RAM : a model of computation

How is an instruction executed?

  1. Decoding instruction
  2. fetching the operands
  3. performing arithmetic/logical operation
  4. storing the result back into RAM  Each instruction takes a few cycles (clock ticks) to get executed. (^10) RAM Processor

word RAM model of computation: Characteristics

  • (^) Word (can be a number, name) is the basic storage unit of RAM. Word is a collection of few bytes.
  • (^) Each word is stored in binary format.
  • (^) RAM can be viewed as a huge array of words.
  • (^) Any arbitrary location of RAM can be accessed in the same time irrespective of the location.
  • (^) Data as well as Program reside fully in RAM.
  • (^) Each arithmetic or logical operation (+,-,*,/,or, xor,…) involving a constant number of words takes a constant number of cycles (steps) by the CPU.

Homework 1 from

Lecture 1

  • 4 instructions n-1 iterations 3 instructions per iteration the final instruction

… need some better insight …

  • 4 instructions excluding the Recursive call