Problem Detail: I don’t understand what is meant by: “m should not be a power of 2, since if m = 2^p, then h(k) is just the p lowest-order bits of k.” (pg. 231 of CLRS) Terms defined: m: size of Read More …
Blog
How to get expected running time of hash table?
Problem Detail: If I have a hash table of 1000 slots, and I have an array of n numbers. I want to check if there are any repeats in the array of n numbers. The best way to do this that Read More …
Visit all vertices on directed graph
Problem Detail: We are given a directed graph, the number of vertices and edges. We need to decide, whether there is a [starting] vertex where we can get started and visit all the vertices. You can revisit vertices, but can’t “use” Read More …
Non-uniform random distribution: How do I get a random between 100 and 180 that is on average close to 120? (like in a Gaussian distribution)
Problem Detail: Presume I have the following case: int value a int value b, for which a < b int value i, for which a <= i < b I need an int value x, for which a <= x < Read More …
What is the most power/energy efficient sorting algorithm?
Problem Detail: I am writing a Android phone application that needs to be very power efficient, and I would like to use the most power efficient sorting algorithm. I will implement it in C for extra power efficiency. What algorithm is Read More …
Tiling an orthogonal polygon with squares
Problem Detail: Given an orthogonal polygon (a polygon whose sides are parallel to the axes), I want to find the smallest set of interior-disjoint squares, whose union equals the polygon. I found several references to slightly different problems, such as: Covering Read More …
Bellman-Ford and zero-distance cycle
Problem Detail: Problem statement: Given a graph G(V,E) which is not acyclic and may have negative edge weights (and thus may possibly have negative-length cycles), how does one detect if the graph has a zero-length cycle, and no negative-length cycles? Background Read More …
Can languages with infinite strings be recursively enumerable?
Problem Detail: I am not 100% sure about the definition of recursively enumarable languages. Yes I know how are they defined: There has to exist a Turing machine that accepts all wrods of the language and halts but it does not Read More …
The space complexity of recognising Watson-Crick palindromes
Problem Detail: I have the following algorithmic problem: Determine the space Turing complexity of recognizing DNA strings that are Watson-Crick palindromes. Watson-Crick palindromes are strings whose reversed complement is the original string. The complement is defined letter-wise, inspired by DNA: A Read More …
tightest upper bound on binary search tree insertion?
Problem Detail: The upper bound on the runtime of binary search tree insertion algorithm is O(n) which is if it is not balanced What will be the tighter upper bound on this,will it become O(logn) I have read that tighter upper Read More …