14DesignAnalysisLarge

14DesignAnalysisLarge - Lecture Set #14: Algorithms and...

This preview shows pages 1–4. Sign up to view the full content.

1 CMSC 131 Spring 2008 Jan Plane (Adapted from Bonnie Dorr) Lecture Set #14: Algorithms and Design 1. Algorithmic Design 2. Algorithmic Analysis 3. System Design CMSC 131 Spring 2008 Jan Plane (Adapted from Bonnie Dorr) 1 What is an algorithm? c The method used to solve a particular problem is called an algorithm . c Example : Make a peanut butter and jelly sandwich: c Get a loaf of bread c Remove two slices c Get a jar of peanut butter c Get a knife c Open the jar c Using the knife, get some peanut butter and spread it on one slice c …blah, blah, blah c There is essentially one sequential process being described.

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

View Full Document
2 CMSC 131 Spring 2008 Jan Plane (Adapted from Bonnie Dorr) 2 Low-Level Design: Pseudo-Code and Algorithms c We have already talked about pseudo-code as a design technique c NOT English c NOT a program c Something in-between c Captures the logic, flow of desired code c Note that pseudo-code could be translated into any programming language (not just Java) c Pseudo-code is used to represent algorithms = step- by-step solutions to problems c Algorithms are often coded as single methods CMSC 131 Spring 2008 Jan Plane (Adapted from Bonnie Dorr) 3 Concerns at the Algorithmic Level of Design c Correctness Does my algorithm correctly solve the problem? c Efficiency Is my algorithm fast enough for the job? c Clarity Is my algorithm understandable? and is it implementable?
3 CMSC 131 Spring 2008 Jan Plane (Adapted from Bonnie Dorr) 4 Putting all your eggs in one basket c Problem: I have 16 baskets full of 12 eggs each; I want to “put all of my eggs in one basket”. c Algorithm #1 ?? c Combine #1 and #2 c Combine result with #3 c Combine result with #4; etc. c Algorithm #2 ?? c Combine #1, #2; combine #3, #4; combine #5, #6… c Combine <1,2> with <3,4>; Combine <5,6> with <7,8>… c Combine <1,2,3,4> with <5,6,7,8> c Combine last two … CMSC 131 Spring 2008 Jan Plane (Adapted from Bonnie Dorr) 5 Algorithmic Efficiency Analysis

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 02/05/2009 for the course CMSC 131 taught by Professor Plane during the Fall '08 term at Maryland.

Page1 / 8

14DesignAnalysisLarge - Lecture Set #14: Algorithms and...

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

View Full Document
Ask a homework question - tutors are online