Problem Detail: Given a complete binary tree with $n$ nodes. I’m trying to prove that a complete binary tree has exactly $lceil n/2 rceil$ leaves. I think I can do this by induction. For $h(t)=0$, the tree is empty. So there Read More …
Category: Uncategorized
Is there a way to test “Turing completeness”?
Problem Detail: I asked my algorithms teacher today the very same question that is stated in the title, but he seemed a bit unsure, either on the question or on the concept, so I thought I’d try here too. Is there Read More …
Circuit Satisfiability problem is NP-Hard?
Problem Detail: $newcommand{np}{mathsf{NP}}newcommand{cc}{textrm{Circuit-SAT}}$I am having difficulty understanding the $np$-hardness proof for $cc$ in CLRS. $cc = {langle C rangle : C text{ is a satisfiable combinatorial boolean circuit} }$ Lemma: The $cc$ problem is $mathsf{NP}$-hard. Can anyone provide an easy-to-understand proof? Read More …
How to find a superstar in linear time?
Problem Detail: Consider directed graphs. We call a node $v$ superstar if and only if no other node can be reached from it, but all other nodes have an edge to $v$. Formally: $qquad displaystyle $v$ text{ superstar } :Longleftrightarrow mathrm{outdeg}(v) Read More …
Average number of slots needed in slotted-Aloha
Problem Detail: Consider 2 stations that share the same bus. Both stations are perfect synchronized each other and when they have packets to transmit, they are starting the transmission in the beginning of a same slot. Transmission is as follows: when Read More …
Potential method for dynamic binary search
Problem Detail: I’m trying to solve 17-2(b) problem from Cormen(CLRS) using potential method. Problem from Cormen: 17-2 Making binary search dynamic Binary search of a sorted array takes logarithmic search time, but the time to insert a new element is linear Read More …
Decide whether a context-free languages can be accepted by a deterministic pushdown automaton
Problem Detail: Given a context-free grammar G, there exists a Nondeterministic Pushdown Automaton N that accepts exactly the language G accepts. (and visa versa) There may also exist a Deterministic Pushdown Automaton D that accepts exactly the language G accepts too. Read More …
Dynamic programming table for finding similar substrings is too large
Problem Detail: Substring Diff Given two strings of length $n$, $P = p_1dots p_n$ and $Q = q_1 dots q_n$, we define $M(i, j, L)$ as the number of mismatches between $p_i dots p_{i+L-1}$ and $q_j dots q_{j+L-1}$. In set Read More …
Does cooperative scheduling suspend processes when they perform an I/O operation?
Problem Detail: Many operating systems references say that with cooperative (as opposed to preemptive) multitasking, a process keeps the CPU until it explicitly voluntarily suspends itself. If a running process performs an I/O request that cannot be immediately satisfied (e.g., requests Read More …
Automaton for substring matching
Problem Detail: Given $s$ as a string over some alphabet, what is the best known algorithm to compute a corresponding deterministic finite-state automaton (DFA) that accepts any string that contains $s$? I am mostly interested of the lowest time complexity so Read More …