lecture_01

lecture_01 - Introduction to Algorithms 6.046J/18.401J...

Info iconThis preview shows pages 1–14. Sign up to view the full content.

View Full Document Right Arrow Icon
Introduction to Algorithms 6.046J/18.401J Prof. Charles E. Leiserson L ECTURE 1 Analysis of Algorithms Insertion sort Merge sort
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
September 8, 2004 Introduction to Algorithms L1.2 Course information 1. Staff 2. Prerequisites 3. Lectures 4. Recitations 5. Handouts 6. Textbook (CLRS) 7 . Extra help 8 . Registration 9 .Problem sets 1 0 .Describing algorithms 1 1 .Grading policy 1 2 .Collaboration policy ¾ Course information handout © 2001–4 by Charles E. Leiserson
Background image of page 2
September 8, 2004 Introduction to Algorithms L1.3 Analysis of algorithms The theoretical study of computer-program performance and resource usage. What’s more important than performance? modularity correctness maintainability functionality robustness user-friendliness programmer time simplicity extensibility reliability © 2001–4 by Charles E. Leiserson
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
September 8, 2004 Introduction to Algorithms L1.4 Why study algorithms and performance? Algorithms help us to understand scalability . Performance often draws the line between what is feasible and what is impossible. Algorithmic mathematics provides a language for talking about program behavior. Performance is the currency of computing. The lessons of program performance generalize to other computing resources. Speed is fun! © 2001–4 by Charles E. Leiserson
Background image of page 4
September 8, 2004 Introduction to Algorithms L1.5 The problem of sorting Input: sequence a 1 , a 2 , …, a n of numbers. Example: Input: 8 2 4 9 3 6 Output: 2 3 4 6 8 9 Output: permutation a' 1 , a' 2 , , a' n such that a' 1 a' 2 a' n . © 2001–4 by Charles E. Leiserson
Background image of page 5

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
September 8, 2004 Introduction to Algorithms L1.6 Insertion sort I NSERTION -S ORT ( A , n ) A [1 . . n ] for j 2 to n do key A [ j ] i j – 1 while i > 0 and A [ i ] > key do A [ i+ 1] A [ i ] i i – 1 A [ i+ 1] = key “pseudocode” © 2001–4 by Charles E. Leiserson
Background image of page 6
September 8, 2004 Introduction to Algorithms L1.7 Insertion sort I NSERTION -S ORT ( A , n ) A [1 . . n ] for j 2 to n do key A [ j ] i j – 1 while i > 0 and A [ i ] > key do A [ i+ 1] A [ i ] i i – 1 A [ i+ 1] = key “pseudocode” sorted ij key A : 1 n © 2001–4 by Charles E. Leiserson
Background image of page 7

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
September 8, 2004 Introduction to Algorithms L1.8 Example of insertion sort 824936 © 2001–4 by Charles E. Leiserson
Background image of page 8
September 8, 2004 Introduction to Algorithms L1.9 Example of insertion sort 824936 © 2001–4 by Charles E. Leiserson
Background image of page 9

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
September 8, 2004 Introduction to Algorithms L1.8 Example of insertion sort 824936 © 2001–4 by Charles E. Leiserson
Background image of page 10
September 8, 2004 Introduction to Algorithms L1.11 Example of insertion sort 824936 284936 © 2001–4 by Charles E. Leiserson
Background image of page 11

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
September 8, 2004 Introduction to Algorithms L1.12 Example of insertion sort 824936 284936 248936 © 2001–4 by Charles E. Leiserson
Background image of page 12
September 8, 2004 Introduction to Algorithms L1.13 Example of insertion sort 824936 284936 248936 © 2001–4 by Charles E. Leiserson
Background image of page 13

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full Document Right Arrow Icon
Image of page 14
This is the end of the preview. Sign up to access the rest of the document.

{[ snackBarMessage ]}

Page1 / 52

lecture_01 - Introduction to Algorithms 6.046J/18.401J...

This preview shows document pages 1 - 14. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online