Problem Detail: I took an algorithms class on Coursera. The professor in the video about hash tables said that What’s true is that for non-pathological data, you will get constant time operations in a properly implemented hash table. What does “non-pathological Read More …
Category: Uncategorized
NP-Completeness – Proof by Restriction
Problem Detail: I’m reading Garey & Johnsons “Computers and Intractability” and I’m at the part “Some techniques for solving NP-Completeness”. Here’s the text about Proof by Restriction: Proof by restriction is the simplest, and perhaps most frequently applicable, of our three Read More …
What are staged functions (conceptually)?
Problem Detail: In a recent CACM article [1], the authors present an implementation for staged functions. They use the term as if it was well-known, and none of the references looks like an obvious introduction. They give a short explanation (emphasis Read More …
Finding the k-shortest path between two nodes
Problem Detail: Given a weighted digraph $G=V,E$, and a weight function, $d(u,v)$, one can normally use Dijkstra’s algorithm to obtain the shortest path. What I am interested in, is how to obtain the $2^{nd}$-shortest path, the $3^{rd}$-shortest, and so on. Questions: Read More …
What is an instance of NP complete problem?
Problem Detail: I don’t understand this definition of an “instance” of a problem. Quoting from the CLRS book on page 1054 on abstract problems (Chapter 34.1): We define an abstract problem $Q$ to be a binary relation on a set $I$ Read More …
The relation between 2SAT and 3SAT
Problem Detail: Show that proving 2SAT is not NP-Complete would prove that 3SAT is not in P. Or eqivalently – Show that proving 3SAT is in P would prove that 2SAT is NP-Complete. I can see there is an easy Read More …
Good explanatory resource for algorithm techniques such as greedy, backtracking and recursive functions
Problem Detail: What would be a good book/resource that explains the basic idea behind those techniques, how to use (and maybe when to use them) and plenty of exercises with perhaps some worked examples (kind of like when for loops were Read More …
Regular languages that can’t be expressed with only 2 regex operations
Problem Detail: I thought all regular languages could be expressed with regular expressions (if a language is regular, it can be expressed with regex), but I have been told that you need all three of the regular operations (concatenation, union, and Read More …
Why did RSA encryption become popular for key exchange?
Problem Detail: This is a soft question. I don’t know a lot about cryptography or its history, but it seems like a common use for RSA is to do key exchange by encrypting a symmetric key to send a longer message Read More …
Why does introsort use heapsort rather than mergesort?
Problem Detail: As part of a homework assignment covering implementation of introsort I’m asked why heapsort is used rather than mergesort (or other $O(nlog(n))$ algorithms for that matter). Introsort is a hybrid sorting algorithm that provides both fast average performance and Read More …