P is the class of decision problems that can be solved in polynomial time, and NP is the class of decision problems whose yes answers can be checked in polynomial time given a suitable certificate. Is P equal to NP? Equivalently, does some NP-complete problem, such as Boolean satisfiability, have a…
#algorithms
Post a problemLet be the infimum of all real such that two matrices can be multiplied using arithmetic operations. The schoolbook method shows , and because the output has entries. Is ?
Given an integer with bits, find its prime factorization. Is there a classical (non-quantum) algorithm that does this in time polynomial in ?
Given integers, decide whether some three of them sum to zero. A simple algorithm takes time. Is there an algorithm that runs in time for some fixed ?
For a sequence of accesses to keys in a binary search tree with keys, let be the minimum total cost of serving by any binary search tree algorithm that may rotate the tree, even one that knows in advance. Prove or disprove that splay trees serve every access…
A sorting network on wires is a fixed sequence of comparators, each of which swaps the values on two wires if they are out of order, such that every possible input comes out sorted. What is the minimum number of comparators in a sorting network for inputs?
Given a real matrix and a vector , decide whether there is with . Is there an algorithm whose number of arithmetic operations is bounded by a polynomial in and alone, independent of the size of the numbers in and ?
Give a deterministic algorithm that decides whether an integer is prime in time polynomial in the number of digits of , without relying on any unproved conjecture.
There are men and women, and each person ranks all members of the other group. A perfect matching is unstable if some man and woman both prefer each other to their assigned partners. Prove that a stable matching always exists, and give an algorithm that finds one in time.
You have 2 identical eggs and a building with 100 floors. There is an unknown threshold floor such that an egg breaks when dropped from that floor or above and survives from any floor below, and an egg that survives can be reused. What is the smallest number of drops that guarantees finding the…
A stream of items is read once, from left to right. Using only a constant number of memory words, find an item that occurs more than times, assuming such an item exists. Then explain how a second pass can check whether a majority exists at all.
A singly linked list either ends in a null pointer or eventually loops back into itself. Using extra memory and time linear in the number of nodes, decide whether it has a cycle, and if it does, find the first node on the cycle and the cycle length.
Given an array of integers, some possibly negative, find a contiguous subarray with the largest sum. For example, in the best subarray is with sum 6. Give an algorithm and prove it correct.
A closed knight's tour on an board is a sequence of knight moves that visits every square exactly once and ends a knight's move away from the starting square. For which does a closed tour exist? As a first step, prove that none exists when and are both odd.
disks of different sizes are stacked on one of three pegs, largest at the bottom. A move takes the top disk from one peg and places it on another peg, never on top of a smaller disk. What is the minimum number of moves needed to transfer the whole stack to another peg? Prove your answer.