Question Detail: Suppose that you’re given a fair coin and you would like to simulate the probability distribution of repeatedly flipping a fair (six-sided) die. My initial idea is that we need to choose appropriate integers $k,m$, such that $2^k = Read More …
Blog
Prove that every two longest paths have at least one vertex in common
Question Detail: If a graph $G$ is connected and has no path with a length greater than $k$, prove that every two paths in $G$ of length $k$ have at least one vertex in common. I think that that common vertex Read More …
Where are back edges in a DFS tree?
Question Detail: As I understand it when doing a DFS run when every new node is discovered and edge is added to the DFS tree from the parent of the new node to the new node. If that’s the case how Read More …
Proof that a randomly built binary search tree has logarithmic height
Question Detail: How do you prove that the expected height of a randomly built binary search tree with $n$ nodes is $O(log n)$? There is a proof in CLRS Introduction to Algorithms (chapter 12.4), but I don’t understand it. Asked By Read More …
Why would anyone want CISC?
Question Detail: In our computer systems lecture we were introduced to the MIPS processor. It was (re)developed over the course of the term and has in fact been quite easy to understand. It uses a RISC design, that is its elementary Read More …
Language theoretic comparison of LL and LR grammars
Question Detail: People often say that LR(k) parsers are more powerful than LL(k) parsers. These statements are vague most of the time; in particular, should we compare the classes for a fixed $k$ or the union over all $k$? So how Read More …
How to map the tapes of a "k-tape" Turing Machine into the single tape of a "1-tape" Turing Machine
Question Detail: I’m reading Sipser and I’m finding it hard to understand what the process is such that if you give me k Turing machines with k tapes, I can spit out an equivalent Turing machine with only one tape. An Read More …
How hard is counting the number of simple paths between two nodes in a directed graph?
Question Detail: There is an easy polynomial algorithm to decide whether there is a path between two nodes in a directed graph (just do a routine graph traversal with, say, depth-first-search). However it seems that, surprisingly, the problem gets much harder Read More …
Generalised 3SUM (k-SUM) problem?
Question Detail: The 3SUM problem tries to identify 3 integers $a,b,c$ from a set $S$ of size $n$ such that $a + b + c = 0$. It is conjectured that there is not better solution than quadratic, i.e. $mathcal{o}(n^2)$. Or Read More …
Visual Programming languages
Question Detail: Most of us learned programming using “textual” programming languages like Basic, C/C++, and Java. I believe it is more natural and efficient for humans to think visually. Visual programming allows developers to write programs by manipulating graphical elements. I Read More …