Presentation is loading. Please wait.

Presentation is loading. Please wait.

Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From

Similar presentations


Presentation on theme: "Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From"— Presentation transcript:

1 onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From http://onlinedeeneislam.blogspot.com

2 onlinedeeneislam.blogspot.com2 What is an Algorithm? An algorithm is a set of rules for carrying out calculation either by hand or on a machine. An algorithm is a finite step-by-step procedure to achieve a required result. An algorithm is a sequence of computational steps that transform the input into the output. An algorithm is a sequence of operations performed on data that have to be organized in data structures. An algorithm is an abstraction of a program to be executed on a physical machine (model of Computation).

3 onlinedeeneislam.blogspot.com3 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 input in a finite amount of time.

4 onlinedeeneislam.blogspot.com4 What is an Algorithm? Problem algorithm “computer” inputoutput

5 onlinedeeneislam.blogspot.com5 Important Problem Types Sorting Searching String Processing Graph Problems Combinatorial Problems Geometric Problems Numerical Problems

6 onlinedeeneislam.blogspot.com6 Important Problem Types Sorting The sorting problem asks us to rearrange the items of a given list in ascending order. Why would we want a sorted list? It makes many questions about the list easier to answer. It is used as an auxiliary step in several important algorithms in other areas, e.g., greedy algorithms, geometric algorithms. There is no sorting algorithm that would be the best solution in all situations.

7 onlinedeeneislam.blogspot.com7 Important Problem Types Sorting Two special properties of sorting algorithms – Stable – In place A sorting algorithm is called stable it it preserves the relative order of any two equal elements in its input. An algorithm is said to be in place if it dos not require extra memory, except possibly, for a few memory units.

8 onlinedeeneislam.blogspot.com8 Important Problem Types Searching The Searching Problem deals with finding a given value, called a search key, in a given set. There is no single algorithm that fits all situations best.

9 onlinedeeneislam.blogspot.com9 Important Problem Types String Processing A string is a sequence of characters from an alphabet. Strings of particular interest are – Text strings – Bit strings – Gene sequences String Matching I.e. searching of a given word in a text get a special attention from researchers.

10 onlinedeeneislam.blogspot.com10 Important Problem Types Graph Problems A graph is a collection of points called vertices, some of which are connected by line segments called edges. Graphs can be used for modeling a wide variety of real-life applications, like – Transportation and communication networks – Project Scheduling – Games

11 onlinedeeneislam.blogspot.com11 Important Problem Types Graph Problems Basic graph algorithms include – Graph traversal algorithms – Shortest path algorithms – Topological sorting for graphs with directed edges Some graph problems are computationally very hard like – Traveling salesperson problem – Graph coloring problem

12 onlinedeeneislam.blogspot.com12 Important Problem Types Combinatorial Problems These are problems that ask (explicitly or implicitly) to find a combinatorial object-such as – A permutation – A combination – Or a subset That satisfies certain constraints and has some desired property. E.g. – Traveling Salesperson problem – Graph Coloring problem

13 onlinedeeneislam.blogspot.com13 Important Problem Types Combinatorial Problems Most difficult problems in computing both theoretically and the practically. Because 1.The number of combinatorial objects typically grows extremely fast with a problem’s size. 2.There are no known algorithms for solving most such problems exactly in an acceptable amount of time. Some exceptional combinatorial problems can be solved by efficient algorithms like shortest-path problem

14 onlinedeeneislam.blogspot.com14 Important Problem Types Geometric Problems Geometric algorithms deal with geometric objects. Geometric algorithms are helpful in the applications like – Computer graphics – Robotics – Tomography

15 onlinedeeneislam.blogspot.com15 Important Problem Types Numerical Problems Numerical Problems are problems that involve mathematical objects of continuous nature: – Solving equations and systems of equations – Computing definite integrals – Evaluating functions and so on: The majority of such problems can be solved approximately

16 onlinedeeneislam.blogspot.com16 Fundamental Data Structures Review Data Structure can be defined as a particular scheme of organizing related data items. Linear Data Structures 1.Arrays 2.Linked List

17 onlinedeeneislam.blogspot.com17 Fundamental Data Structures Review (Linear Data Structures) 1.Arrays – Sequence of n items of same data type – Stored contiguously in computer memory – Each item is made accessible by specifying the value of the array’s index. Each and every array element can be accessed in the same constant amount of time.

18 onlinedeeneislam.blogspot.com18 Fundamental Data Structures Review (Linear Data Structures) 2.Linked List – Sequence of zero or more elements called nodes. – Each node contains Some data and One or more links called pointers to other nodes of the linked list. Singly Linked List – a node has a pointer only to its successor node Doubly Linked List – a node has a pointer to both its successor and its predecessor.

19 onlinedeeneislam.blogspot.com19 Fundamental Data Structures Review (Linear Data Structures) List – A finite sequence of data items – Implement by using Arrays or Linked lists Special kinds of lists – Stack & – Queue

20 onlinedeeneislam.blogspot.com20 Fundamental Data Structures Review (Linear Data Structures) Stack – Only one end is used both for insertion and deletion – Operates in LIFO fashion Queue – One end is used for insertion and other end is used for deletion – Operates in FIFO fashion

21 onlinedeeneislam.blogspot.com21 Algorithms Analysis Framework Introduction How to analyze an algorithm? Predicting the resources that the algorithm requires. – Memory – Communications Bandwidth – Logic gates etc – Computational time

22 onlinedeeneislam.blogspot.com22 Algorithms Analysis Framework Introduction Two parameters of measuring algorithm’s efficiency 1.Time Efficiency How fast an algorithm in question runs 2.Space Efficiency It deals with the extra space the algorithm requires

23 onlinedeeneislam.blogspot.com23 Algorithms Analysis Framework Introduction Important thing before analysis – Model of the machine upon which the algorithms is executed. – Random Access Machine (RAM) (Sequential)

24 onlinedeeneislam.blogspot.com24 Algorithms Analysis Framework Time Complexity Analysis We do not Determine the actual number of CPU cycles Want to count every instruction executed We want a measure that is independent of the Computer Programming language Programmer and The Compiler used in generating the machine code

25 onlinedeeneislam.blogspot.com25 Algorithms Analysis Framework Time Complexity Analysis We do not Determine the actual number of CPU cycles Want to count every instruction executed We want a measure that is independent of the Computer Programming language Programmer and The Compiler used in generating the machine code

26 onlinedeeneislam.blogspot.com26 Algorithms Analysis Framework Time Complexity Analysis For time complexity analysis – Identify the basic operation and – Compute the number of times the basic operation is executed Running Time:No. of primitive operations or “steps executed”. The running time of an algorithm increases with the size of the input. We can express running time T(n) as the function of the input size. T(n) is defined as the number of times the algorithm does the basic operation for an instance of size n.

27 onlinedeeneislam.blogspot.com27 Algorithms Analysis Framework Time Complexity Analysis Let c op be the time of execution of an algorithm’s basic operation on a particular computer, Let C(n) be the number of times this operation needs to be executed for this algorithm, The running time T(n) can be estimated as T(n)  c op C(n)


Download ppt "Onlinedeeneislam.blogspot.com1 Design and Analysis of Algorithms Slide # 1 Download From"

Similar presentations


Ads by Google