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.

Slides:



Advertisements
Similar presentations
Analysis of Computer Algorithms
Advertisements

Analysis of Algorithms: time & space Dr. Jeyakesavan Veerasamy The University of Texas at Dallas, USA.
MATH 224 – Discrete Mathematics
Chapter 5 Fundamental Algorithm Design Techniques.
Algorithms + L. Grewe.
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.
1 Data Structures Performance Analysis. 2 Fundamental Concepts Some fundamental concepts that you should know: –Dynamic memory allocation. –Recursion.
© Janice Regan Problem-Solving Process 1. State the Problem (Problem Specification) 2. Analyze the problem: outline solution requirements and design.
Fall 2006CENG 7071 Algorithm Analysis. Fall 2006CENG 7072 Algorithmic Performance There are two aspects of algorithmic performance: Time Instructions.
LEARNING FROM OBSERVATIONS Yılmaz KILIÇASLAN. Definition Learning takes place as the agent observes its interactions with the world and its own decision-making.
Lecture 14 Go over midterm results Algorithms Efficiency More on prime numbers.
CISC220 Spring 2010 James Atlas Lecture 06: Linked Lists (2), Big O Notation.
1 Data Structures A program solves a problem. A program solves a problem. A solution consists of: A solution consists of:  a way to organize the data.
Data Structures Performance Analysis.
Fundamental Techniques
TK3043 Analysis and Design of Algorithms Introduction to Algorithms.
Design & Analysis of Algorithms Introduction. Introduction Algorithms are the ideas behind computer programs. An algorithm is the thing which stays the.
COMP s1 Computing 2 Complexity
Chapter 5 Algorithm Analysis 1CSCI 3333 Data Structures.
High level & Low level language High level programming languages are more structured, are closer to spoken language and are more intuitive than low level.
CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a CSC 201 Analysis and Design of Algorithms Lecture 03: Introduction to a lgorithms.
หลักการโปรแกรม เพื่อแก้ปัญหาโดยใช้คอมพิวเตอร์
Fundamentals of Algorithms MCS - 2 Lecture # 1
Analysis of Algorithms
© 2011 Pearson Addison-Wesley. All rights reserved 10 A-1 Chapter 10 Algorithm Efficiency and Sorting.
Analysis of algorithms Analysis of algorithms is the branch of computer science that studies the performance of algorithms, especially their run time.
Complexity of Algorithms
Analysis of Algorithms CSCI Previous Evaluations of Programs Correctness – does the algorithm do what it is supposed to do? Generality – does it.
Major objective of this course is: Design and analysis of modern algorithms Different variants Accuracy Efficiency Comparing efficiencies Motivation thinking.
Design & Analysis of Algorithms Lecture 1 Introduction.
Program Efficiency & Complexity Analysis. Algorithm Review An algorithm is a definite procedure for solving a problem in finite number of steps Algorithm.
Algorithms & Flowchart
Algorithm Efficiency and Sorting Data Structure & Algorithm.
Greedy Algorithms. What is “Greedy Algorithm” Optimization problem usually goes through a sequence of steps A greedy algorithm makes the choice looks.
Algorithms and data structures: basic definitions An algorithm is a precise set of instructions for solving a particular task. A data structure is any.
3.3 Complexity of Algorithms
Data Structures and Algorithms Dr. Tehseen Zia Assistant Professor Dept. Computer Science and IT University of Sargodha Lecture 1.
Data Structures Using C++ 2E
CS404 Design and Analysis of Algorithms BBy DDr. M V S Peri Sastry BB.E, PhD(BITS-Pilani)
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.
CISC220 Spring 2010 James Atlas Lecture 07: Big O Notation.
Intro to Analysis of Algorithms. Algorithm “A sequence of unambiguous instructions for solving a problem, i.e., for obtaining a required output for any.
Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From
 FUNDAMENTALS OF ALGORITHMS.  FUNDAMENTALS OF DATA STRUCTURES.  TREES.  GRAPHS AND THEIR APPLICATIONS.  STORAGE MANAGEMENT.
BITS Pilani Pilani Campus Data Structure and Algorithms Design Dr. Maheswari Karthikeyan Lecture1.
Algorithm Analysis Lakshmish Ramaswamy. What Constitutes Good Software? Code correctness Good design Code reusability OO design can help us in achieving.
Complexity of Algorithms Fundamental Data Structures and Algorithms Ananda Guna January 13, 2005.
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?
Maitrayee Mukerji. INPUT MEMORY PROCESS OUTPUT DATA INFO.
Introduction To Algorithm and Data Structures Course Teacher: Moona Kanwal -Algorithm Design -Algorithm Analysis -Data structures -Abstract Data Type.
Algorithm Complexity is concerned about how fast or slow particular algorithm performs.
Introduction toData structures and Algorithms
CMPT 438 Algorithms.
Advanced Algorithms Analysis and Design
Introduction to Algorithms
Algorithms and Problem Solving
TK3043 Analysis and Design of Algorithms
Introduction to complexity
Lecture 06: Linked Lists (2), Big O Notation
Algorithms Furqan Majeed.
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
Applied Discrete Mathematics Week 6: Computation
CSE 2010: Algorithms and Data Structures Algorithms
Asst. Dr.Surasak Mungsing
Introduction to Algorithms
Analysis of Algorithms
Basic Concepts of Algorithm
Algorithms and data structures: basic definitions
Presentation transcript:

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 need to design an algorithm for it. Multiple algorithms can be designed to solve a particular problem. An algorithm that provides the maximum efficiency should be used for solving the problem. The efficiency of an algorithm can be improved by using an appropriate data structure. Data structures help in creating programs that are simple, reusable, and easy to maintain. This module will enable a learner to select and implement an appropriate data structure and algorithm to solve a given programming problem. 1

Computers are widely being used to solve problems pertaining to various domains, such as, banking, commerce, medicine, manufacturing, and transport. To solve a given problem by using a computer, you need to write a program for it. A program consists of three components, programming language, data structure and algorithm. Role of Algorithms in Problem Solving 2

3

Role of Algorithms The word algorithm is derived from the name of the Al Khwarizmi. An algorithm can be defined as a step-by- step procedure for solving a problem. An algorithm helps the user arrive at the correct result in a finite number of steps. 4

Role of Algorithms (Contd.) An algorithm has five important properties: Finiteness: an algorithm terminates after a finite numbers of steps. Definiteness: each step in algorithm is clear and unambiguous Input:an algorithm accepts zero or more inputs Output: it produces at least one output. Effectiveness:all of the operations to be performed in the algorithm must be sufficiently basic. 5

Role of Algorithms (Contd.) A problem can be solved using a computer only if an algorithm can be written for it. In addition, algorithms provide the following benefits: Help in writing the corresponding program Help in dividing difficult problems into a series of small solvable problems Help make the process consistent and reliable 6

Two commonly used techniques for designing algorithms are: Divide and conquer approach Greedy approach Identifying Techniques for Designing Algorithms 7

Divide and conquer is a powerful approach for solving conceptually difficult problems. Divide and conquer approach requires you to find a way of: Breaking the problem into sub problems Solving the trivial cases Combining the solutions to the sub problems to solve the original problem Identifying Techniques for Designing Algorithms (Contd.) 8

Algorithms based on greedy approach are used for solving optimization problems, where you need to maximize profits or minimize costs under a given set of conditions. Some examples of optimization problems are: Finding the shortest distance from an originating city to a set of destination cities, given the distances between the pairs of cities. Selecting items with maximum value from a given set of items, where the total weight of the selected items cannot exceed a given value. Identifying Techniques for Designing Algorithms (Contd.) 9

Factors that affect the efficiency of a program include: Speed of the machine Compiler Operating system Programming language Size of the input In addition to these factors, the way data of a program is organized, and the algorithm used to solve the problem also has a significant impact on the efficiency of a program. Determining the Efficiency of an Algorithm 10

The efficiency of an algorithm can be computed by determining the amount of resources it consumes. The primary resources that an algorithm consumes are: Time: The CPU time required to execute the algorithm. Space: The amount of memory used by the algorithm for its execution. The lesser resources an algorithm consumes, the more efficient it is. Determining the Efficiency of an Algorithm (Contd.) 11

Time/Space Tradeoff: It refers to a situation where you can reduce the use of memory at the cost of slower program execution, or reduce the running time at the cost of increased memory usage. Example is data storage in compressed/uncompressed form. Memory is extensible, but time is not. Therefore, time considerations generally override memory considerations. Time/Space Tradeoff 12

To measure the time efficiency of an algorithm, you can write a program based on the algorithm, execute it, and measure the time it takes to run. The execution time that you measure in this case would depend on a number of factors such as: Speed of the machine Compiler Operating system Programming language Input data However, we would like to determine how the execution time is affected by the nature of the algorithm. Method for Determining Efficiency 13

The execution time of an algorithm is directly relative to the size of the input data n. The rate at which the running time of an algorithm increases as a result of an increase in the volume of input data is called the order of growth of the algorithm. The order of growth of an algorithm is defined by using the big O notation. The big O notation has been accepted as a fundamental technique for describing the efficiency of an algorithm. Method for Determining Efficiency (Contd.) 14

The different orders of growth and their corresponding big O notations are: Constant - O(1) Logarithmic - O(log n) Linear - O(n) Loglinear - O(n log n) Quadratic - O(n 2 ) Cubic - O(n 3 ) Exponential - O(2 n ), O(10 n ) Method for Determining Efficiency (Contd.) 15