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

A recap of the first lecture on data structures and algorithms (eso207), focusing on the efficiency of algorithms and data structures. It covers the current state-of-the-art computer architecture, including cpu speed, external memory (hard disk drive) size and speed, and internal memory (ram) size and speed. The document motivates the need for efficient algorithms and data structures, using examples like the subset sum problem and sorting. It also discusses how to analyze the efficiency of an algorithm using the word ram model of computation, considering factors like the number of instructions taken. The document concludes with a warm-up example to assess programming skills and introduces three algorithms, questioning which one is the best and how close the ram model is to reality. It also touches on the influence of other parameters like multitasking, architecture, and code optimization.

Typology: Slides

2024/2025

Uploaded on 08/17/2025

pooja-payal
pooja-payal 🇮🇳

1 document

1 / 28

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
1
Data Structures and Algorithms
(ESO207)
pf3
pf4
pf5
pf8
pf9
pfa
pfd
pfe
pff
pf12
pf13
pf14
pf15
pf16
pf17
pf18
pf19
pf1a
pf1b
pf1c

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