Problem Detail: I want to write an algorithm to find the closest pair of points among n points in an XY-plane. I have the following approach in my mind: Find the minimum x co-ordinate(minX) and minimum y(minY) co-ordinate. Name the point Read More …
Category: Uncategorized
[Solved]: Algorithm for a list of best solutions to the Assignment problem
Problem Detail: I am trying to brute force a classical substitution cipher. The problem is that there are $26!$ possible keys. So, I’d like to do frequency analysis to try likely keys first. Then, on the first $n$ tries I will Read More …
[Solved]: Shortest paths in weighted graphs, and minimum spanning trees
Problem Detail: I stuck in one challenging question, I read on my notes. An undirected, weighted, connected graph $G$, (with no negative weights and with all weights distinct) is given. We know that, in this graph, the shortest path between any Read More …
[Solved]: Fast implementation of basic addition algorithm
Problem Detail: Write code for a modified version of the Grade School addition algorithm that adds the integer one to an m-digit integer. Thus, this modified algorithm does not even need a second number being added. Design the algorithm to Read More …
[Solved]: Travelling with the most efficient path
Problem Detail: A friend of mine actually asked me a very interesting computer science related question, and I have been stuck on it for a long time. The problem is: you have to travel $1000$ km. The only gas station is Read More …
[Solved]: Proving that the language of TMs with finite left head moves is undecidable
Problem Detail: I’m trying to prove that the following language is undecidable:$$ { langle M, w rangle ~|~ M text{ is a TM where its head moves left a finite number of times on } w } $$ But I’m having Read More …
[Solved]: Are there languages generated by linear grammar which aren’t regular?
Problem Detail: Are there languages generated by linear grammer which aren’t regular? Asked By : Iancovici Answered By : Shaull Of course. Look at the first example on Wikipedia: $qquad S to aSb mid varepsilon$ is linear and generates ${a^nb^n mid n in Read More …
[Solved]: Is this language defined using twin primes regular?
Problem Detail: Let $qquad L = {a^n mid exists_{p geq n} p,, p+2 text{ are prime}}.$ Is $L$ regular? This question looked suspicious at the first glance and I’ve realized that it is connected with the twin prime conjecture. My problem Read More …
[Solved]: Why does merging two sorted arrays take 2N – 1 comparisons?
Problem Detail: A friend of mine asked me a question on how to prove that merging two sorted arrays requires at least 2N – 1 comparisons Prove that merging two sorted arrays of N items requires at least 2N-1 comparisons. /* Read More …
[Solved]: Number of possible programs in a language
Problem Detail: Is the number of possible programs usually finite or infinite? I’m playing with the idea of generating all possible programs for a language – is that even a finite number or must we be more specific, finite RAM etc? Read More …