Problem Detail: I’m trying to understand context-sensitive grammars. I understand why languages like ${ww mid w in A^*}$ ${a^n b^n c^n mid ninmathbb{N}}$ are not context free, but what I’d like to know if a language similar to the untyped lambda Read More …
Category: Uncategorized
Average Time Complexity of Two Nested Loops
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 …
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 …
Solutions to synchronization problem need to be executed in critical section
Problem Detail: I was reading about synchronization problems for cooperating processes and i learned that only hardware solutions like test_and_wait() and compare_and_set() are performed atomically at the hardware level and in all other software solutions like mutex, semaphore the code needs Read More …