Problem Detail: Let $Sigma = { sigma_1 , …, sigma_t }$ and let $S$ be a string from $Sigma^*$. Denote: $n=|S|$, that is $S$ has $n$ letters. I’d like to find the shortest prefix $T$ of $S$ such that $S$ is Read More …
Blog
[Solved]: Tile Problem : Dynamic Programming
Problem Detail: Came across the following tile problem : Given a “2 x n” board and tiles of size “2 x 1″, count the number of ways to tile the given board using the 2 x 1 tiles. A tile can Read More …
[Solved]: How to iterate through all values of an array?
Problem Detail: I’m trying to implement a brute-force algorithm. If I have one variable x, I can iterate through all its values using a for loop: for x in {1,2,..,MAX}: do something with x But what if I have an array Read More …
[Solved]: Can a Turing Machine have infinite accept states?
Problem Detail: I’m still fairly new to Turing Machines, but I’ve been doing some research. I know that a Turing Machine can have an infinite tape and that it requires a finite number of states, but does it necessarily follow that Read More …
[Solved]: Correctness of the greedy algorithm
Problem Detail: I am trying to solve the following problem: Given a matrix which consists of only 0’s and 1’s. Considering the matrix as a metal sheet, we need to “cut-out” square blocks of sizes 2×2 consisting of only 0’s from Read More …
[Solved]: A partition algorithm
Problem Detail: I have encountered the following problem that I found very interesting to solve: Given an array of positive integers ${a_1, a_2, …, a_n}$ you are required to partition the array into $3$ blocks/partitions such that the maximum of sums Read More …
[Solved]: Good snapshottable data structure for an in-memory index
Problem Detail: I’m designing an in-memory object database for a very specific use case. It is single writer, but must support efficient concurrent reads. Reads must be isolated. There is no query language, the database only supports: get object/-s by attribute/set Read More …
[Solved]: ML functions from polymorphic lists to polymorphic lists
Problem Detail: I’m learning programming in ML (OCaml), and earlier I asked about ML functions of type ‘a -> ‘b. Now I’ve been experimenting a bit with functions of type ‘a list -> ‘b list. There are some obvious simple examples: Read More …
[Solved]: Algorithmic consequences of algebraic formula for partition function?
Problem Detail: Bruinier and Ono have found an algebraic formula for the partition function, which was widely reported to be a breakthrough. I am unable to understand the paper, but does it have any algorithmic consequences for fast computation of the Read More …
[Solved]: Why can’t we use a hash tables for collision resolving in hash tables?
Problem Detail: To prevent collisions, hash tables with open addressing use a methodology to chain the contents. Why can’t we use another hash table allocated to each slot of the primary hash table? Asked By : user1675999 Answered By : jbapple The method Read More …