Published on

Published in: Technology
1 Like
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide
  • Slide1

    1. 1. <ul><li>Name: Sachin Sharma Bhandari </li></ul><ul><li>Qualification: </li></ul><ul><li>MTech. In Information Technology,Kathmandu University,Nepal </li></ul><ul><li>Bachelor of Electrical and Electronics Engineering, Kathmandu University,Nepal </li></ul><ul><li>Experience: </li></ul><ul><li>Lecturer, Software Engineering Department,2007, </li></ul><ul><li>CAMT, ChiangMai University, Thailand </li></ul><ul><li>Senior Lecturer & Head of Department, 2000, </li></ul><ul><li>Computer & Electronics Engineering Department, </li></ul><ul><li>Kantipur Engineering College, Tribhuvan University,Nepal </li></ul><ul><li>Email:, </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    2. 2. Introduction to The Design & Analysis of Algorithms 05/28/09 By:Mr. Sachin S. Bhandari
    3. 3. Aims of the Module <ul><li>Fundamentals about basic and useful algorithms. </li></ul><ul><li>How to design algorithms. </li></ul><ul><li>How to prove their correctness. </li></ul><ul><li>How to measure their performance (in terms of time and space), and </li></ul><ul><li>How to improve their performance if possible. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    4. 4. Indicative Content <ul><li>Introduction to Algorithm </li></ul><ul><li>Fundamentals of the analysis of algorithm efficiency </li></ul><ul><li>Design of algorithm </li></ul><ul><li>Number-theoretic algorithms </li></ul><ul><li>Limitations of algorithms and NP-completeness </li></ul><ul><li>Space and time trade offs </li></ul><ul><li>Approximation algorithms </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    5. 5. Why do you need to study Algorithms? <ul><li>For being a computer professional. </li></ul><ul><li>To know a standard set of important algorithms from different areas of computing. </li></ul><ul><li>To design new algorithms and analyze their efficiency. </li></ul><ul><li>Usefulness in developing analytical skills. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    6. 6. Algorithms <ul><li>Informally, it is a step- by- step method of solving some problem. </li></ul><ul><li>It is any well-defined computational procedure that takes some value, or set of values, as input and produces some value, or set of values, as output . </li></ul><ul><li>An algorithm is thus a sequence of computational steps that transforms the input into the output. </li></ul><ul><li>An algorithm can be specified in English, as a computer program, or even as hardware design. </li></ul><ul><li>Derived from the name of the ninth-century Persian mathematician al-Khowarizmi. </li></ul><ul><li>Today, “algorithm” typically refers to a solution that can be executed by a computer. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    7. 7. Fundamentals of Algorithmic Problem Solving 05/28/09 By:Mr. Sachin S. Bhandari
    8. 8. Analyzing an Algorithm <ul><li>Time Efficiency </li></ul><ul><li>How fast the algorithm runs. </li></ul><ul><li>Space Efficiency </li></ul><ul><li>How much extra memory the algorithm needs. </li></ul><ul><li>Simplicity </li></ul><ul><li>Generality </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    9. 9. Concept of Algorithms <ul><li>Input: </li></ul><ul><li>Output: </li></ul><ul><li>Precision: The steps are preciously stated. </li></ul><ul><li>Determinism: The intermediate results of each step of execution are unique and are determined only by the inputs and results of the preceding steps </li></ul><ul><li>Finiteness: The algorithm terminates; that is, it stops after finitely many instructions have been executed. </li></ul><ul><li>Correctness: The output produced by the algorithm is correct. </li></ul><ul><li>Generality: The algorithm applies to a set of inputs. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    10. 10. Example <ul><li>Example: 1 Finding the Maximum of three numbers. </li></ul><ul><ul><ul><li>x=a </li></ul></ul></ul><ul><ul><ul><li>If b>x, then x=b. </li></ul></ul></ul><ul><ul><ul><li>If c>x, then x=c. </li></ul></ul></ul>05/28/09 By:Mr. Sachin S. Bhandari
    11. 11. What kinds of problems are solved by algorithms? <ul><li>Sorting is by no means the only computational problem for which algorithms have been developed. Practical applications of algorithms are ubiquitous (everywhere) and include the following examples. </li></ul><ul><li>The Human Genome Project has the goals of identifying all the 100,000 genes in human DNA, determining the sequences of the 3 billion chemical base pairs that make up human DNA, storing this information in databases, and developing tools for data analysis. Each of these steps requires sophisticated algorithms. </li></ul><ul><li>The internet enables people all around the world to quickly access and retrieve large amounts of information. For this, clever algorithms are employed to manage and manipulate this large volume of data. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    12. 12. (contd.) <ul><li>Electronic commerce enables goods and services to be negotiated and exchanged electronically. The ability to keep information such as credit card numbers, passwords,, and bank statements private is essential if electronic commerce is to be used widely. Public-key cryptography and digital signatures are among the core technologies used and are based on numerical algorithms and number theory. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    13. 13. Algorithms as a Technology <ul><li>Computers may be fast, but they are not infinitely fast. And memory may be cheap, but it is not free. Computing time is therefore a bounded resource, and so is space in memory. These resources should be used wisely, and algorithms that are efficient in terms of time or space will help you do so. </li></ul><ul><li>Algorithms devised to solve the same problems often differ dramatically in their efficiency. For example: Two algorithms for sorting (Insertion and Merge Sort). </li></ul><ul><li>Total system performance depends on choosing efficient algorithms as much as on choosing fast hardware. Like Intuitive graphical user interfaces (GUIs), object-oriented systems and local area and wide area networking etc. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    14. 14. Pseudo code for Algorithms <ul><li>Pseudo code is so named because it resembles the actual code of computer language such as C++ and Java. </li></ul><ul><li>Many versions of Pseudo code. </li></ul><ul><li>It consists of a title, a brief description of the algorithm, the input and output parameters, and the functions containing the instructions of the algorithm. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    15. 15. Review of Data Structures <ul><li>Data Structure </li></ul><ul><li>It is data together with structural relations on the data to promote efficient processing of the data. </li></ul><ul><li>For example: an array structures data provides sequentially and random (i.e. constant time) access to the data. </li></ul><ul><li>Abstract Data Types </li></ul><ul><li>ADT consists of data together with functions that operate on data. </li></ul><ul><li>It is abstract in the sense that how the data are represented and how the functions are implemented are not specified. Only the behavior of the functions is specified. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    16. 16. (contd.) <ul><li>For example: Stack is an ABT with functions </li></ul><ul><li>Stack_init ( ): make the stack empty. </li></ul><ul><li>Empty ( ): Return true if the stack is empty otherwise false. </li></ul><ul><li>Push ( val ): Add the item val to the stack. </li></ul><ul><li>Pop ( ): Remove the item most recently added to the stack. </li></ul><ul><li>Top ( ): Return the item most recently added to the stack, but don’t remove it. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari Explanation: The preceding function specifications define a stack but do not tell how to implement the stack. In a specific implementation, as long as the functions have the properties specified, the ADT is a stack.
    17. 17. (contd.) <ul><li>Queues </li></ul><ul><li>It is similar to stack but the difference is that when an item is deleted from a queue, the least recently item is deleted. </li></ul><ul><li>Enqueue (for add) and Dequeue (for delete) </li></ul><ul><li>Adding an element at the rear of a queue and deleting an element form the front of a queue. </li></ul><ul><li>For example: Waiting in line for tickets to a rocket concert. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    18. 18. (contd.) <ul><li>Linked Lists </li></ul><ul><li>However, inserting at the beginning of an array of n elements takes time Θ (n) because all n items must move over one cell to make room for the added element. </li></ul><ul><li>Deleting the first element form an array of n elements also take time Θ (n). </li></ul><ul><li>A linked list provides constant time insertions and deletions anywhere in the list, but accessing an element takes time Θ (n) in the worst case. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    19. 19. (contd.) <ul><li>Binary Trees </li></ul><ul><li>Rooted tree in which each node has either no children, one child, or two children. If a node has one child, that child is designated as either a left child or a right child (but not both) and If a node has two children, one child is designated a left child and other a right child. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    20. 20. Assignment <ul><li>1.0 Write a pseudo code for an algorithm for finding real roots of quadratic equation. </li></ul><ul><li>( you may assume the availability of the square root function sqrt(x).) </li></ul><ul><li>2.0 Describe the algorithm used by your favorite ATM machine in dispensing cash. </li></ul><ul><li>3.0 Design a simple algorithm for the string-matching problem. </li></ul><ul><li>4.0 Indicate how the ADT priority queue can be implemented as </li></ul><ul><li>a. an sorted array. </li></ul><ul><li>b. an (unsorted) array. </li></ul><ul><li>c. a binary search tree. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    21. 21. Assignment (contd..) <ul><li>5.0) For each of the following applications, indicate the most appropriate data structure: </li></ul><ul><li>a. answering telephone calls in the order of their known priorities </li></ul><ul><li>b. sending backlog orders to customers in order they have been received </li></ul><ul><li>c. implementing a calculator for computing simple arithmetical expressions. </li></ul>05/28/09 By:Mr. Sachin S. Bhandari
    22. 22. <ul><li>Thank You ! </li></ul>05/28/09 By:Mr. Sachin S. Bhandari