






































































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!







































































For Reference ●
2 0 = 2 2 2 1 = 4 2 2 2 = 16 2 2 3 = 256 2 2 4 = 65536 2 2 5 = 18446744073709551616 2 2 6 = 340282366920938463463374607431768211456
The Limits of Decidability ●
●
●
●
The Setup ●
● What is “computation?” ● What is a “problem?” ● What does it mean to “solve” a problem? ●
● What does “complexity” even mean? ● What is an “efficient” solution to a problem?
Measuring Complexity ● (^) Suppose that we have a decider D for some language L. ● How might we measure the complexity of D? Number of states. Size of tape alphabet. Size of input alphabet. Amount of tape required. ● (^) Amount of time required. Number of times a given state is entered. Number of times a given symbol is printed. Number of times a given transition is taken. (Plus a whole lot more...)
Searching Finite Spaces ●
●
●
●
A Sample Problem 4 3 11 9 7 13 5 6 1 12 2 8 0 10 Goal: Find the length of the longest increasing subsequence of this sequence. Goal: Find the length of the longest increasing subsequence of this sequence.
Longest Increasing Subsequences ● One possible algorithm: try all subsequences, find the longest one that's increasing, and return that. ● There are 2 n^ subsequences of an array of length n. ● (Each subset of the elements gives back a subsequence.) ● Checking all of them to find the longest increasing subsequence will take time O( n · 2 n ). ● Nifty fact: the age of the universe is about 4.3 × 10^26 nanoseconds old. That's about 2^85 nanoseconds. ● Practically speaking, this algorithm doesn't terminate if you give it an input of size 100 or more.
Longest Increasing Subsequences ● Theorem: There is an algorithm that can find the longest increasing subsequence of an array in time O( n log n ). ● The algorithm is beautiful and surprisingly elegant. Look up patience sorting if you're curious. ● This algorithm works by exploiting particular aspects of how longest increasing subsequences are constructed. It's not immediately obvious that it works correctly.
Shortest Paths ●
●
●
Shortest Paths ● Theorem: It's possible to find the shortest path between two nodes in an n -node, m - edge graph in time O( m + n ). ● This is the breadth-first search algorithm. Take CS106B/X or CS161 for more details! ● The algorithm is a bit nuanced. It uses some specific properties of shortest paths and the proof of correctness is nontrivial.