1 / 10

Understanding Algorithms: Problem Solving, Efficiency, and Classification

This overview provides a comprehensive introduction to algorithms, including methods for solving problems with finite steps, their efficiency, and various algorithm types. Key concepts include Big O, Θ, and Ω notation for measuring performance, and examples like Binary Search and Merge Sort to illustrate different approaches to problem-solving. The discussion on tractable versus intractable problems highlights the significance of polynomial time in algorithm classification, including the famous P vs. NP problem, which remains one of the biggest challenges in computer science.

heidi-sosa
Download Presentation

Understanding Algorithms: Problem Solving, Efficiency, and Classification

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Algorithms Matt Schierholtz

  2. Overview • Method for solving problems with finite steps • Algorithm example: • Error • Check for problem • Solve problem • Must terminate

  3. Efficiency • Algorithms vary greatly in either memory space or time required • Sorted into worst, best and average performance • Big O, Big Θ and Big Ω notation • O(f(x)) is at most f(x)

  4. Algorithm Types • Nested loop • s = 0 • for i = 1 to n • for j = 1 to i • s = s + j(i – j + 1) • next j • next i • Find the number of steps this algorithm takes • Compare efficiency of particular algorithms

  5. Algorithms and Logarithms • Logbx = a is very useful in computer calculations • For example, • Log21024 = 10 and log21048576 = 20 • ⌊a⌋ is the number of bits used to represent a number x in binary, or ternary, or any number base ya want

  6. Binary Search • Takes less time than sequential search • Trades time for organization • Example • While (top >= bot and index = 0) • Mid = ⌊(bot + top) / 2⌋ • If a[mid] = x then index = mid • If a[mid] > x • Then top = mid - 1 • Else bot = mid + 1 • End while

  7. Merge Sort • Easier to write than Binary search • But takes more time • Think recursively • Suppose: • Efficient algorithm for arrays < k known • What if you have array < k?

  8. More Merge Sort • Sort smaller parts! • Then you merge Initial number group Get sorted Merge

  9. Tractable & Intractable Problems • Algorithms with exponential order • Ex: Tower of Hanoi • If it has 64 disks • Number of moves = 264 – 1 • For a computer, moves / second = 109 • This will take 584 years

  10. P vs. NP • Polynomial algorithms are class P • These are tractable • Even if they take a very long time • Problems not solved in polynomial time are… • Intractable • Class NP (nondeterministic polynomial) • $1,000,000, to anyone who proves P=NP • NP-Complete • If one NP problem is solvable, all of them are

More Related