Choosing a structure
1.[3p] Why is polynomial time taken as the definition of efficient, despite being polynomial?
Why is polynomial time taken as the definition of efficient, despite being polynomial?
The answer is: Polynomials are closed under composition, so a polynomial algorithm calling a polynomial subroutine stays polynomial
The answer is: Polynomials are closed under composition, so a polynomial algorithm calling a polynomial subroutine stays polynomial
The answer is: Polynomials are closed under composition, so a polynomial algorithm calling a polynomial subroutine stays polynomial
2.[3p] A algorithm runs at operations per second. How many seconds does take, in units of ?
A algorithm runs at operations per second. How many seconds does take, in units of ?
3.[3p] What defines the class NP?
What defines the class NP?
The answer is: Every yes-instance has a short certificate that can be checked in polynomial time
The answer is: Every yes-instance has a short certificate that can be checked in polynomial time
The answer is: Every yes-instance has a short certificate that can be checked in polynomial time
4.[2p] Every problem in P is also in NP.
Every problem in P is also in NP.
The answer is: True
5.[3p] A problem is NP-complete when
A problem is NP-complete when
The answer is: it is in NP and every problem in NP reduces to it in polynomial time
The answer is: it is in NP and every problem in NP reduces to it in polynomial time
The answer is: it is in NP and every problem in NP reduces to it in polynomial time
6.[3p] Which of these are real routes to solving an NP-complete problem in practice?
Which of these are real routes to solving an NP-complete problem in practice?
Select all that apply
The answer is: An approximation algorithm with a guaranteed factor, such as 1.5 for metric travelling salesman, Confining the exponential blow-up to a parameter that is small in practice, Exploiting structure in the instances that actually arrive, as SAT solvers do
7.[2p] A workload asks only "is this exact key present", millions of times per second. The right structure is
A workload asks only "is this exact key present", millions of times per second. The right structure is
The answer is: a hash table
The answer is: a hash table
The answer is: a hash table
8.[3p] A leaderboard must report a player's rank among ten million. Which structure answers it in ?
A leaderboard must report a player's rank among ten million. Which structure answers it in ?
The answer is: A balanced search tree whose nodes store their subtree sizes
The answer is: A balanced search tree whose nodes store their subtree sizes
The answer is: A balanced search tree whose nodes store their subtree sizes
9.[3p] Match each workload to the structure it calls for.
Match each workload to the structure it calls for.
Repeatedly take the smallest pending item
Look up by exact key and nothing else
List every key between two bounds
Find routes through a network of links
a hash table
a binary heap
a graph with adjacency lists
a balanced search tree
Show the answer
Repeatedly take the smallest pending item: a binary heap Look up by exact key and nothing else: a hash table List every key between two bounds: a balanced search tree Find routes through a network of links: a graph with adjacency lists