Problem Detail: Recently I have had this question in one of my interviews. You have 1 Million sorted integer, you have a value of $x$, compare each pair in this array and if the addition of two pair is less or Read More …
Author: ignougroup
Do any decision problems exist outside NP and NP-Hard?
Problem Detail: This question asks about NP-hard problems that are not NP-complete. I’m wondering if there exist any decision problems that are neither NP nor NP-hard. In order to be in NP, problems have to have a verifier that runs in Read More …
Shortest non intersecting path for a graph embedded in a euclidean plane (2D)
Problem Detail: What algorithm would you use to find the shortest path of a graph, which is embedded in an euclidean plane, such that the path should not contain any self-intersections (in the embedding)? For example, in the graph below, you Read More …
Base of logarithm in runtime of Prim’s and Kruskal’s algorithms
Problem Detail: For Prim’s and Kruskal’s Algorithm there are many implementations which will give different running times. However suppose our implementation of Prim’s algorithm has runtime $O(|E| + |V|cdot log(|V|))$ and Kruskals’s algorithm has runtime $O(|E|cdot log(|V|))$. What is the base Read More …
Dynamic Programming Solution to 0,1 KnapSack Problem
Problem Detail: I am trying to understand the DP solution to the basic knapsack problem.However even after reading through a variety of tutorials ,its still beyond my comprehension.I am taking an algorithmics course and need to solve questions based on the Read More …
Regular expression for a string not containing a set of substrings
Problem Detail: I’m trying to figure out how to build a regular expression for a language that doesn’t contain strings that contain $101$ or $001$. The alphabet is defined as ${0, 1}$. I’m stuck on trying to figure out the DFA. Read More …
Minimum spanning tree and its connected subgraph
Problem Detail: This problem is from the book [1]. In case of being closed as a duplication of that in [2], I first make a defense: The accepted answer at [2] is still in dispute. The proof given by @eh9 is Read More …
Decision problems vs “real” problems that aren’t yes-or-no
Problem Detail: I read in many places that some problems are difficult to approximate (it is NP-hard to approximate them). But approximation is not a decision problem: the answer is a real number and not Yes or No. Also for each Read More …
Example of Soundness & Completeness of Inference
Problem Detail: Is the following example correct about whether an inference algorithm is sound and complete? Suppose we have needles a, b, c in a haystack, and have also an inference algorithm that is designed to find needles. sound – Only Read More …
Choosing a subset to maximize the minimum distance between points
Problem Detail: I have a set of points $C$, and I have the distance between each point $D(P_i,P_j)$. These distances are euclidean but the points are actually in a feature space. From the $C$ points I want to choose a subset Read More …