Design & Analysis of Algorithms Lecture 1 Introduction.

Slides:



Advertisements
Similar presentations
1 ICS102: Introduction To Computing King Fahd University of Petroleum & Minerals College of Computer Science & Engineering Information & Computer Science.
Advertisements

CMSC 104, Version 8/061L04Algorithms1.ppt Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
Algorithms + L. Grewe.
Algorithm –History Muhammad ibn Musa Al-Khwarizmi www -groups.dcs.st-andrews.ac.uk/~history/Mathematicians/Al- Khwarizmi.html Book on arithmetic:
COEN 352 Data structures and Algorithms R. Dssouli.
Computer science is a field of study that deals with solving a variety of problems by using computers. To solve a given problem by using computers, you.
I Advanced Algorithms Analysis. What is Algorithm?  A computer algorithm is a detailed step-by-step method for solving a problem by using a computer.
© Janice Regan Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.
Algorithms and Problem Solving-1 Algorithms and Problem Solving.
Algorithms and Problem Solving. Learn about problem solving skills Explore the algorithmic approach for problem solving Learn about algorithm development.
What is an algorithm? An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any legitimate.
Chapter 1 Program Design
UNIVERSITY OF SOUTH CAROLINA Department of Computer Science and Engineering Design and Analysis of Algorithms - Chapter 11 Algorithm An algorithm is a.
TK3043 Analysis and Design of Algorithms Introduction to Algorithms.
1 Chapter 2 Problem Solving Techniques INTRODUCTION 2.2 PROBLEM SOLVING 2.3 USING COMPUTERS IN PROBLEM SOLVING : THE SOFTWARE DEVELOPMENT METHOD.
Design & Analysis of Algorithms Introduction. Introduction Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the.
DCT 1123 PROBLEM SOLVING & ALGORITHMS INTRODUCTION TO PROGRAMMING.
HOW TO SOLVE IT? Algorithms. An Algorithm An algorithm is any well-defined (computational) procedure that takes some value, or set of values, as input.
1 CS101 Introduction to Computing Lecture 16 Algorithms I.
Simple Program Design Third Edition A Step-by-Step Approach
Analysis of algorithms Analysis of algorithms is the branch of computer science that studies the performance of algorithms, especially their run time.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
Problem Solving using the Science of Computing MSE 2400 EaLiCaRA Spring 2015 Dr. Tom Way.
Algorithms, Part 1 of 3 Topics  Definition of an Algorithm  Algorithm Examples  Syntax versus Semantics Reading  Sections
Algorithms & FlowchartsLecture 10. Algorithm’s CONCEPT.
Design and Analysis of Algorithms - Chapter 11 Algorithm b An algorithm is a sequence of unambiguous instructions for solving a problem, i.e., for obtaining.
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
8.1 8 Algorithms Foundations of Computer Science  Cengage Learning.
Algorithms Emerging IT Fall 2015 Team 1 Avenbaum, Hamilton, Mirilla, Pisano.
1 UMBC CMSC 104, Section Fall 2002 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Algorithm Examples Syntax versus Semantics Reading.
Chapter 1: Introduction to Visual Basic.NET: Background and Perspective Visual Basic.NET Programming: From Problem Analysis to Program Design.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Program Design. Simple Program Design, Fourth Edition Chapter 1 2 Objectives In this chapter you will be able to: Describe the steps in the program development.
How Computers Solve Problems Computers also use Algorithms to solve problems, and change data into information Computers can only perform one simple step.
1.  A step by step process to solve any problem is called algorithm.  Algorithm is a process which take some values as input and provide us output.
Introduction to Computer Programming Concepts M. Uyguroğlu R. Uyguroğlu.
Computer Systems Architecture Edited by Original lecture by Ian Sunley Areas: Computer users Basic topics What is a computer?
Systems in the Small: An Introduction to Algorithms David Millard
 Problem Analysis  Coding  Debugging  Testing.
CMSC 104, L041 Algorithms, Part 1 of 3 Topics Definition of an Algorithm Example: The Euclidean Algorithm Syntax versus Semantics Reading Sections 3.1.
FURQAN MAJEED ALGORITHMS. A computer algorithm is a detailed step-by-step method for solving a problem by using a computer. An algorithm is a sequence.
Advanced Algorithms Analysis and Design
Introduction to Algorithms
Algorithms and Problem Solving
Algorithms, Part 1 of 3 The First step in the programming process
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
TK3043 Analysis and Design of Algorithms
GC211Data Structure Lecture2 Sara Alhajjam.
Chapter 1 Introduction Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Algorithms I: An Introduction to Algorithms
Algorithms Furqan Majeed.
Algorithm and Ambiguity
2008/09/17: Lecture 4 CMSC 104, Section 0101 John Y. Park
Algorithm An algorithm is a finite set of steps required to solve a problem. An algorithm must have following properties: Input: An algorithm must have.
Objective of This Course
Data Structures and Algorithms CSE 465
Algorithms and Problem Solving
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Programming Fundamentals (750113) Ch1. Problem Solving
Introduction to Algorithms
Lecture 6 Architecture Algorithm Defin ition. Algorithm 1stDefinition: Sequence of steps that can be taken to solve a problem 2ndDefinition: The step.
Programming Fundamentals (750113) Ch1. Problem Solving
Algorithm: Word comes from Arabic Author Abū ‘Abdallāh Muḥammad ibn Mūsā al-Khwārizmī Algorism Algebra: Kitab al-Mukhtasar fi Hisab al-Jabr wal-Muqabala.
Basic Concepts of Algorithm
Top-Down Design & JSP Skill Area Part D
Algorithms, Part 1 of 3 Topics Definition of an Algorithm
Chapter 1 Introduction Copyright © 2007 Pearson Addison-Wesley. All rights reserved.
Advanced Analysis of Algorithms
Presentation transcript:

Design & Analysis of Algorithms Lecture 1 Introduction

Sequence of steps that can be taken to solve a problem An algorithm is a sequence of unambiguous instructions for solving a problem in a finite amount of time. An Algorithm is well defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values as output. More generally, an Algorithm is any well defined computational procedure that takes collection of elements as input and produces a collection of elements as output. Algorithm Inputoutput What is Algorithm? Mashhood's Web Family2

It must be correct. It must be composed of a series of concrete steps. The execution sequence of instructions should not be ambiguous. It must have finite number of instructions and steps. It must terminate. 3 Mashhood's Web Family3

Syntax & Semantics An algo. is “correct” if its: –Semantics are correct –Syntax is correct Semantics: The concept embedded in an algorithm (the soul!) Syntax: The actual representation of an algorithm (the body!) WARNINGS: 1. An algo. can be syntactically correct, yet semantically incorrect – very dangerous situation! 2. Syntactic correctness is easier to check as compared with semantic Mashhood's Web Family4

Solving Problems (1) When faced with a problem: 1.We first clearly define the problem 2.Think of possible solutions 3.Select the one that we think is the best under the prevailing circumstances 4.And then apply that solution 5.If the solution woks as desired, fine; else we go back to step 2 Mashhood's Web Family5

Solving Problems(2) It is quite common to first solve a problem for a particular case Then for another And, possibly another And watch for patterns and trends that emerge And to use the knowledge form those patterns and trends in coming up with a general solution And this general solution is called ……………. Mashhood's Web Family6

Early History: Search for a Generic Algorithm The study of algorithms began with mathematicians and was a significant area of work in the early years The goal of those early studies was to find a single, general algorithm that could solve all problems of a single type Mashhood's Web Family7

Origin of the Term “Algorithm” The name derives from the title of a Latin book: Algoritmi de numero Indorum That book was a translation of an Arabic book: Al-Khwarizmi Concerning the Hindu Art of Reckoning That book was written by the famous 9-th century Muslim mathematician, Muhammad ibn Musa al-Khwarizmi Mashhood's Web Family8

Al-Khwarzmi Al-Khwarizmi lived in Baghdad, where he worked at the Dar al-Hikma Dar al-Hikma acquired and translated books on science and philosophy, particularly those in Greek, as well as publishing original research The word Algebra has its origins in the title of another Latin book which was a translation of yet another book written by Al-Khwarzmi: Kitab al-Mukhtasar fi Hisab al-Jabr wa'l-Muqabala Mashhood's Web Family9

Al-Khwarizmi’s Golden Principle All complex problems can be and must be solved using the following simple steps: 1.Break down the problem into small, simple sub-problems 2.Arrange the sub-problems in such an order that each of them can be solved without effecting any other 3.Solve them separately, in the correct order 4.Combine the solutions of the sub-problems to form the solution of the original problem Mashhood's Web Family10

11 Problem High Level Language Program High Level Language Program Algorithm Algorithm : A sequence of instructions describing how to do a task Mashhood's Web Family11

Algorithm It is a method followed to solve a problem. A mapping of input to output. As mentioned on slide no. 2. A problem can have many algorithms Computer program It is a concrete representation of an algorithm in some programming language A set of instructions which the computer will follow to solve a problem 12 Mashhood's Web Family12

Why Algorithms are Useful? Once we find an algorithm for solving a problem, we do not need to re-discover it the next time we are faced with that problem Once an algorithm is known, the task of solving the problem reduces to following (almost blindly and without thinking) the instructions precisely All the knowledge required for solving the problem is present in the algorithm Mashhood's Web Family13

Why Write an Algorithm Down? For your own use in the future, so that you don’t have spend the time for rethinking it Written form is easier to modify and improve Makes it easy when explaining the process to others Mashhood's Web Family14

Problem and Instances An input sequence is called an instance of a Problem A problem has many particular instances An algorithm must work correctly on all instances of the problem it claims to solve Many interesting problems have infinitely many instances –Since computers are finite, we usually need to limit the number and/or size of possible instances in this case 15Mashhood's Web Family

Most basic and popular algorithms are –Sorting algorithms –Searching algorithms Which algorithm is best? Mainly, it depends upon various factors, for example in case of sorting –The number of items to be sorted –The extent to which the items are already sorted –Possible restrictions on the item values –The kind of storage device to be used etc. Popular Algorithms, Factors of Dependence Mashhood's Web Family16

Problem The statement of the problem specifies, in general terms, the desired input/output relationship. Algorithm The algorithm describes a specific computational procedure for achieving input/output relationship. Example One might need to sort a sequence of numbers into non-decreasing order. Algorithms Various algorithms e.g. merge sort, quick sort, heap sorts etc. One Problem, Many Algorithms Mashhood's Web Family17

Brute Force –Straightforward, naive approach –Mostly expensive Divide-and-Conquer –Divide into smaller sub-problems Iterative Improvement –Improve one change at a time Decrease-and-Conquer –Decrease instance size Transform-and-Conquer –Modify problem first and then solve it Important Designing Techniques Mashhood's Web Family18

Greedy Approach –Locally optimal decisions, can not change once made. –Efficient –Easy to implement –The solution is expected to be optimal –Every problem may not have greedy solution Dynamic programming –Decompose into sub-problems like divide and conquer –Sub-problems are dependant –Record results of smaller sub-problems –Re-use it for further occurrence –Mostly reduces complexity exponential to polynomial There is a Tradeoffs b/w Space and Time –Use more space now to save time later Important Designing Techniques Mashhood's Web Family19

Analysis –How does system work? –Breaking a system down to known components –How components (processes) relate to each other –Breaking a process down to known functions Synthesis –Building tools –Building functions with supporting tools –Composing functions to form a process –How components should be put together? –Final solution Problem Solving Phases Mashhood's Web Family20

Problem Strategy Algorithm –Input –Output –Steps Analysis –Correctness –Time & Space –Optimality Implementation Verification Problem Solving Process Mashhood's Web Family21

Our today’s lecture was on basic introduction of the Algorithms In next lecture we will talk about the Analysis of Algorithms INSHALLAH Mashhood's Web Family22