Question Detail: To fine the median of an unsorted array, we can make a min-heap in $O(nlog n)$ time for $n$ elements, and then we can extract one by one $n/2$ elements to get the median. But this approach would take Read More …
Blog
How to prove that a language is not context-free?
Question Detail: We learned about the class of context-free languages $mathrm{CFL}$. It is characterised by both context-free grammars and pushdown automata so it is easy to show that a given language is context-free. How do I show the opposite, though? My Read More …
Distributed vs parallel computing
Question Detail: I often hear people talking about parallel computing and distributed computing, but I’m under the impression that there is no clear boundary between the 2, and people tend to confuse that pretty easily, while I believe it is very Read More …
How to prove a language is regular?
Question Detail: There are many methods to prove that a language is not regular, but what do I need to do to prove that some language is regular? For instance, if I am given that $L$ is regular, how can I Read More …
Why, really, is the Halting Problem so important?
Question Detail: I don’t understand why the Halting Problem is so often used to dismiss the possibility of determining whether a program halts. The Wikipedia article correctly explains that a deterministic machine with finite memory will either halt or repeat a Read More …
How to work out physical address corresponding to logical address?
Question Detail: I am looking to calculate the physical address corresponding to a logical address in a paging memory management scheme. I just want to make sure I am getting the calculation right, as I fear I could be wrong somewhere. Read More …
Why are there so many programming languages?
Question Detail: I’m pretty fluent in C/C++, and can make my way around the various scripting languages (awk/sed/perl). I’ve started using python a lot more because it combines some of the nifty aspects of C++ with the scripting capabilities of awk/sed/perl. Read More …
Complexity of recursive Fibonacci algorithm
Question Detail: Using the following recursive Fibonacci algorithm: def fib(n): if n==0: return 0 elif n==1 return 1 return (fib(n-1)+fib(n-2)) If I input the number 5 to find fib(5), I know this will output 5 but how do I examine the Read More …
What is most efficient for GCD?
Question Detail: I know that Euclid’s algorithm is the best algorithm for get the GCD (great common divisor) for a list the positive integer numbers. But, in the practice, you can write two codes por evaluate the gcd (for my case, Read More …
How to verify number with Bob without Eve knowing?
Question Detail: You need to check that your friend, Bob, has your correct phone number, but you cannot ask him directly. You must write the question on a card which and give it to Eve who will take the card to Read More …