1 / 15

CS 150: Computing - From Ada to the Web

CS 150: Computing - From Ada to the Web. Complexity and Computability Professor Greg Humphreys. Think back…. What sort of things have we programmed so far? We’ve generated poetry (and other things) from grammars We’ve recursively solved numeric problems

nau
Download Presentation

CS 150: Computing - From Ada to the Web

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. CS 150: Computing - From Ada to the Web Complexity and Computability Professor Greg Humphreys

  2. Think back… • What sort of things have we programmed so far? • We’ve generated poetry (and other things) from grammars • We’ve recursively solved numeric problems • We’ve generated Mandelbrot and Julia fractal • We’ve tested some aspects of the web • Now you’re building a web application that links together PHP, MySQL, and Google Maps • Surely there is nothing that a computer cannot do!

  3. Well, hold on there… • That can’t be right. There must be some limits. • What type of limits are we referring to though? • We’ve already discussed complexity limits a little bit. • How long did it take to run your Mandelbrot program? • How “bad” was the recursive Fibonacci algorithm?

  4. Complexity Limits • Computers are not infinite • Limited memory • Limited disk space • Limited time to run the program • We can define algorithms for many, many different problems… • … however sometimes our algorithms just aren’t good enough. • Would you like to use the recursive Fibonacci algorithm to calculate Fib(945493)?

  5. P • P: Polynomial algorithms • Includes the algorithms we've seen so far • Mergesort • Binary search • Mandelbrot generation • Anything with running times on the order of nlgn and n^2. Running times like n^3 and n^4, though considerably slower, are also polynomial time.

  6. Intractable Problems • Problems that are solvable in theory, but cannot be solved in practice, are called intractable. • In general, anything that is more complex than polynomial time (O(n^x)) would be considered intractable. • What algorithms have we seen so far that qualify? • What characterizes an algorithm that is intractable? What might we see in the algorithm itself?

  7. Intractable Problems • Another term you’ll here for intractable problems is NP-Complete • NP stands for “non-deterministic polynomial time” • One of the greatest challenges in computer science is to determine whether NP-Complete problems can (or definitely cannot) be solved in polynomial time

  8. Classic NP-Complete Problems • The Knapsack Problem • Given a set of items, each with a cost and a value, determine the number of each item to include in a collection so that the total cost is less than a given limit and the total value is as large as possible. • Thanks to Wikipedia for the image

  9. The Knapsack Problem • How would you solve it? • What is your algorithm? • What is the critical section? What are you “counting?” • What do you think the complexity would be? • Talk to the people around you and figure out what you would do here.

  10. Classic NP-Complete Problems • Given a number of cities and the costs of traveling from any city to any other city, what is the least-cost round-trip route that visits each city exactly once and then returns to the starting city? • Technically, this problem is NP-Hard, but it’s still intractable… • Thanks to Wikipedia for the image!

  11. The Traveling Salesman Problem • How would you solve it? • What is your algorithm? • What is the critical section? What are you “counting?” • What do you think the complexity would be? • Talk to the people around you and figure out what you would do here.

  12. Technically, though… • Even though we call these problems intractable, they are still technically solvable • (Even if the time to take to solve it takes longer than it would take for the sun to stop burning…) • There is another level of problems that we can’t solve

  13. Computability • Definition: The property of being computable by purely mechanical means • You’ve had practice writing algorithms • A key aspect of all your algorithms is that at some point it will stop what it’s doing and give you an answer. • So, what happens if it doesn’t?

  14. Computability • Is there an algorithm that solves a particular problem? • Computable (decidable) problems: • There is an algorithm that solves the problem. • Make a fractal, sorting, winning chess (it doesn’t mean we know the algorithm, but there is one) • Uncomputable (undecidable) problems: • There is no algorithm that solves the problem. There might be a procedure, but it doesn’t always terminate.

  15. Computability • Your challenge for Wednesday: • What problem can you not solve with a computer? What problem could be considered undecidable? • Consider this: • If I tell you that I will always tell you the truth and then the next phrase I say is “this is a lie,” what would that make you do?

More Related