


Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
The importance of correctness and efficiency in algorithm design. How the correctness of an algorithm ensures it solves the problem and produces a correct answer, while efficiency focuses on how quickly the problem can be solved. The document also introduces the concept of big-o notation and its role in describing algorithmic efficiency. Students of computer science, particularly those in algorithms or data structures courses, will find this document useful for understanding the fundamental concepts of algorithm design.
Typology: Study notes
1 / 4
This page cannot be seen from the preview
Don't miss anything!



On the Board Homework due today Reading — Chapters 5 & 6 Important Properties of Algorithms In Chapter 4, we saw a number of approaches to algorithm design — graph traversals, divide and conquer, greedy, dynamic planning. Speaking in broad terms, two properties of an algorithm should be critical concerns (in this order)
Both the bubblesort algorithm and the mergesort algorithm that we derived in class perform use a number of comparisons that is roughly equivalent to the square of the number of elements being sorted. The mergesort uses about half as many comparisons as bubblesort, but both are still proportional to N^2 for a set of N names. A good queue implementation (remember the homework that is due today) has the property that Add , Remove , and Empty all perform a constant amount of work each time that they are used. Efficiency: What’s the Big Deal? Computer scientists are always concerned about the efficiency of algorithms. Why? Computers have finite resources—including memory, disk, screen resolution, and computational capacity. (What’s the difference between a 1 GHZ Pentium and a 2.8GHZ Pentium? Why would you want one over the other? Same question about a 20GB iPod versus a 40GB iPod.) In choosing between two algorithms, you might well consider their relative efficiency.
operations. That notwithstanding, its worst case behavior is O (number of intersections). If the function, f(N) , in the inequality can be expressed as a polynomial, we say that the algorithm has polynomial complexity. In general, problems that have polynomial complexities are considered tractable problems. Many important problems have this property — in fact, most of the problems that we solve with computers are tractable. Low-order polynomial algorithms are considered to have efficient solutions. Multiplying two matrices — a common subtask in many scientific applications — takes O ( N^3 ) time.