instruction
stringlengths
35
29.1k
I am trying to describe the above automaton in English. The pattern that I can see is that it accepts any input that starts with $1$ or $0$ with an exact one occurrence of $00$ and ends with 1 or 10. How can I also phrase that it also may end with 00?
The following question is from the MIT 6.034 2006 Final Exam paper. In answering part 6.5, I wasn't certain why the radial basis kernel would produce the same decision boundary as a linear kernel (when considering the data set shown in part 6.4). I've searched the internet for some pointers, but no dice. I was wonderin...
Given $R$=($A,B,C,D,E,G$), And $F_c$={$A$$\rightarrow$$E$ ,$E$$\rightarrow$$ACD$ ,$BD$$\rightarrow$$E$, $CD$$\rightarrow$$B$} Candidate keys are: $GA, GE, GDB, GCD$ Lets say I pick the FD $A$$\rightarrow$$E$ that violates BCNF (1) should the decomposition looks like that: $R_2$=$(A,G)$, $R_1$=$(A,E,C,D,B)$ // [$R_1$...
I'm trying to solve this but I'm confused with different answers. I'm getting 4 but the answer written is 7. Please guide me.
I'm implementing the toy fb-lang from the principles of programming language book. It's a small interpreted language that uses eval(uate) expression function and sub(stitute) variable with value function to process expressions. The most challenging construct is the let rec in construct which makes it possible to define...
I remember in high school we did this thing where we were given a bunch of numbers in a row that had a pattern. We were asked to work out what the next number in the pattern would be. It was very easy stuff and they taught as a formula that i can't remember. Basically the patterns looked like this: 2 4 6 8 _ They form...
Suppose I have a graph's chromatic number. Give a faster-than-brute-force polynomial-space algorithm for finding an optimal coloring. If such an algorithm isn't known, please tell me so. This question is not a duplicate, contrary to what the title may suggest: Using the chromatic number to compute an optimal coloring T...
I would want to start learning reverse engineering (Software and Hardware Projects), but I don't know from where to start. Will be grateful for online resources and/or books. Thanks.
How can I efficiently find all lattice points in the cubic lattice $Z^3$ (that is to say, all integer points in a 3-space) that lay in a closed ball of radius $R$ centred at the origin? Essentially, Let $dist(p)$ be a function denoting the euclidean distance between a point in n-space and the origin point of that space...
These would be problems known to be in exp where there could hypothetically be a P or NP algorithm, but none have been discovered yet if one is possible.
In one of my undergrad theory or algorithms classes, I remember a professor sharing a quip that went something like In practice, $\log(\log(N))$ is at most 9. ...the idea being that even though the function $f(N) = \log(\log(N))$ technically grows without bound, it's tiny for any value of $N$ that's remotely plausibl...
I have two images of two objects that are suppose to be exactly the same. I use one for reference and one as my model. I want to find an algorithm that will help me find on which areas these images vary? and return a binary map (the size of the image), that indicates of the variation. Its an easy task when we don't tak...
What are the time complexities of finding kth element from beginning and kth element from end in a doubly linked list? Assume n > k, where k is a constant and n is a total number of nodes in the linked list. O(1) and O(n) O(1) and O(1) O(n) and O(1) O(n) and O(n)
We're Given a directed graph $G = (V, E)$ and a weight function $\omega : E \rightarrow \mathbb{Z}$. Each edge is colored with one of these colors: Red, Green, Blue. Given two vertices $s,t \in V$, Find an efficient algorithm that gives the weight of the lightest path from $s$ to $t$ that satisfies these conditions: I...
We say that a non-deterministic Turing machine is nice if for every input x the following holds: • Every computation path returns either ’accept’, ’reject’ or ’quit’. • There is at least one non-quit path. • All non-quit paths have the same value. Let NICE be the class of all languages L that are accepted by some nice ...
The following question is taken from the book titled "Probability models for Computer Science" written by Sheldon M. Ross. Question: A particle moves along n + 1 vertices that are situated on a circle in the following manner. At each stage the particle moves one step that is either in the clockwise direction with prob...
I am trying to understand if NL is closed under complement or not. By NL i mean the non-deterministic-logspace complexity. I suppose that the answer is linked to the fact that we don't even know if L = NL so scientifically speaking we cannot determinate if NL is closed or not on complement, for now. I've searched on th...
Given a directed tree $T = (V, E)$, we need to find a set of vertices $A \subseteq V$ such that for every two vertices $v,u \in A$ either there is no path between them or the path between them is of length at least 3. Furthermore, $A$ should contain the maximum number of vertices. The above is an exercise in my homewor...
As I am currently teaching regular languages and pumping lemma, I was searching for nice examples of languages, regular or not, for exercises. $L_1 = \{vv\mid v\in \Sigma^*\}$ is a classic example, as it can be proven to be non regular for $|\Sigma|\geqslant 2$ using the pumping lemma; $L_2 = \{ uvv\mid u,v\in\Sigma^*...
Let's just say that some person discovered that $P = NP$ implies $P \neq NP$ and $P \neq NP$ implies $P = NP$, and we don't know what is causing this contradiction, And this was a valid proof that was accepted. What would the consequences of this be? This would probably be the least likely outcome of the P vs NP questi...
Problem statement There is a number of towns $\{T_1 \dots T_n\}$, a number of items $\{I_1 \dots I_n\}$ and a number of lorries $\{L_1 \dots L_n\}$. Each town $T_n$ has a market which offers a quantity $Q_{i}$ of items $\{I_{m < n}\}$ for buying (always a subset of $I_n$), but any item $I_n$ can be sold there at the ...
Question The convolution $a*b=\left(c_{0},c_{1},\ldots,c_{n+m-2}\right)$ of two vectors $\left(a_{0},\ldots,a_{n-1}\right)$ and $\left(b_{0},\ldots,b_{m-1}\right)$ is defined as follows: $$ \left(a*b\right)_{i}=c_{i}=\sum_{j=0}^{i}a_{j}b_{i-j} $$ Given that by using the $FFT$ algorithm the convolution can be calculated...
I was trying to solve a problem "Write a function bestSum(targetSum, numbers)` that takes in a targetSum and an array of numbers as arguments. The function should return an array containing the shortest combination of numbers that add up to exactly the targetSum." import java.util.ArrayList; import java.util.HashMap; ...
Let $x_1,x_2,x_3,\dots,x_n$ be n points on the unit segment $[0,1]$.Mathematically it can be shown that there always exists a point $\in[0,1]$ such that $$ \frac1n \sum_1^n|x-x_i|=\frac12$$. Given $x_1,x_2,x_3,\dots,x_n$, how do we find(numerically) $x$ satisfying the above relation to given level of accuracy?In othe...
Take, for example: $$S=\{1,2,3\}\to k=3$$ $$n=4$$ The desired output for this would be: [1 1 2 3] [1 1 3 2] [1 2 1 3] [1 2 2 3] [1 2 3 1] [1 2 3 2] [1 2 3 3] [1 3 1 2] [1 3 2 1] [1 3 2 2] [1 3 2 3] [1 3 3 2] [2 1 1 3] [2 1 2 3] [2 1 3 1] [2 1 3 2] [2 1 3 3] [2 2 1 3] [2 2 3 1] [2 3 1 1] [2 3 1 2] [2 3 1 3] [2 3 2 1] [2...
I got a two points A and B with their respective x and y coordinates. Point B determines the direction of the vector AB, and I know that -10^9 <= x,y <= 10^9. My goal is to scale that vector until the x or y coordinate of B hit either bound. Basically I need the vector AB, where B is moved to the edge without changing ...
I have following inputs: $X$, where each $x_j$ is float and $1 \le j \le n$ $Y$, where each $y_j$ is int and $1 \le j \le n$ $a$ is a float scalar I want to allocate/split $a$ in $n$ parts towards each $x_j$ in $X$ where $1 \le j \le n$. The allocation from $a$ should be proportional to both $X$ and $Y$ (see example ...
It is my belief that addition in one's complement is done the same way as unsigned addition except that if there is a carry out in the most significant bit then that carry is added to the last significant bit of the answer. If I am wrong about this, please tell me. I am going to work in 4 bits. My claim is that $-1$ is...
I am trying to build a min-max heap tree, here's an example of the tree structure: The tree is a complete binary tree The index in the array of the tree root is 0 and it contains no element. The left subtree is a min-heap and the right subtree is a max-heap. When I am trying to implement the insertion, I meet a prob...
I recently studied about this construction of a spanning graph for a set of points in $\mathbb{R}^2$ and I feel like I'm not really understanding why this construction should work. First there are some required definitions: Two sets $A,B$ are said to be well seperated w.r.t to $s>0$, if there exists some $r\in \mathbb...
Here is a very bad algorithm that computes $4n$ for an integer input. # Original algorithm function fourtimes(n) two = 1 + 1 res = 0 for i in 1:n res += two res += two end return res end Here is one way of improving the algorithm (speedup A). # Speedup A function fourtimes(n) ...
How to multiply in CBN strategy? mul = \m.\n.\f. m(n f) two = \f.\x. f (f x) mul two two = (\m.\n.\f. m(n f)) (\f.\x. f (f x)) (\f.\x. f (f x)) = = \f. (\f0.\x0. f0 (f0 x0)) ((\f1.\x1. f1 (f1 x1)) f) As I understand, after that, calculations in the CBN strategy stop, because in CBN no reduce under abstractions. is i...
The optimization variant of TSP is NP-hard, hence, finding an optimal tour takes $2^n$ steps for $n$ cities. According to Wikipedia, the largest instance solved so far consists of $n=85,900$ cities and that it only took 1.5 years in 2006 to solve it. How can that be? In complexity text books, it usually motivates the t...
The problem of Orthogonality: gives $n$ vectors of dimension $k$ and another set of same, can a pair be found with inner product = $0$? The problem of max product: likewise two sets each $n$ vectors (I forgot to mention in both cases values are binary). We want to find maximal inner product (one vector from set $A$ and...
Suppose given $n$ pair of points $P=\{(p_1,q_1),\dots,(p_n,q_n)\}$ in the plane that each pair $(p_i,q_i)\in \mathbb{R}^2$ can't belong to the same group. We want to partition points into $K$ groups such that we minimize function $f:x\rightarrow \mathbb{R}$. So we try to find an efficient algorithm. We want a running t...
I'm confused about the figures in a Berkeley tutorial on Fibonacci trees, which depicts fibtree(2) as and fibtree(3) as I thought fibtree(3) looks like the following (the figure is adapted from another StackOverflow post). Do I misunderstand something? Or is the Berkeley tutorial misusing the figures?
I'm looking for a way to help my users more easily compare the output of a fingerprinting algorithm (which is a very large number/byte array). So instead of showing something like "8c0db1f40b6e4c1e268a5f3e2405278f" as the fingerprint, I'd rather show something like 'AT-BAD-HONEY-CAR-MOUSE' (obviously the underlying num...
What are common primary mechanisms to "re-map" between physical memory in RAM, and the addresses used in a program before it is loaded into RAM? In image below for example, the LOAD 12 operation at address 01, must when program is running be loading the address 12 addresses from the "0 address" of the program (that in ...
Suppose I have a directed graph, where one of the nodes is selected to be the "initial" node. What algorithms should I consider using to to find all the nodes that have a path from the initial node to itself have a path from itself to the initial node For example, in the below graph with node A as the initial node,...
From Introduction to Algorithms by CLRS: 15.2-4 Describe the subproblem graph for matrix-chain multiplication with an input chain of length n. How many vertices does it have? How many edges does it have, and which edges are they? I've figured out everything except for the number of edges. I've looked at several solut...
Many years ago someone told me about a historical SMP operating system (or program?) that had been all but proven to be bug free (or something close to this). But yet turned out to have bugs that were discovered as CPUs with more cores, than initially tested/developed on, came out. Can anyone provide a source of this?
I am working through "Understanding Machine Learning Theory" by Shai Shalev-Schwartz. In the chapter "Online learning" I came across the halving algorithm, the author uses the following algorithmic pseudo-code for the algorithm I am having difficulty understanding authors intention from the highlighted portion. Here $...
Consider $\Sigma = \{a,b\}$. Now $\Sigma^*$ represents the collection of all possible strings over alphabet $\Sigma = \{a,b\}$. As there exists an enumeration procedure for $\Sigma^*$, it is countably infinite. As $\Sigma^*$ consists of strings of all lengths, it also consists of strings of infinite length. Let us cons...
So I have a point cloud, of a 3D object, as an input which I received from a 3D scanner. I would like to generate a path which covers the entire object, meaning I would like to come up with a complete area coverage of the point cloud. When I say path, I mean an array of points which according to a given dimension of a ...
Consider the grammar $$S →Aa∣b$$ $$A →Ac∣Sd∣ϵ$$ Construct an equivalent grammar with no left recursion and with minimum number of production rules. $\tag {GATE-CS-1998}$ While solving this question, based on the term "minimum number of production rules", I tried as follows: First removed indirect left recursion and ...
I haven't thought about how to go about proving it or finding a counterexample (I probably don't have the right background), but it seems intuitive to me that, given some representation of a Boolean function, say sum of products, the minimal SOP expression is somehow related to the Kolmogorov Complexity of the binary s...
I want to know how I can calculate/find out which SPACE a language has, because I don't get it. I have this definition Definition: Fix a function $f: \mathbb N → \mathbb N$. We say that a language $A$ is contained in $\text{SPACE}(f(n))$ if there is a Turing Machine (TM) that decides $x\in A$ vs $x\not\in A$ based on ...
A complete binary tree is defined as a tree where each node has either 2 or 0 children. For a complete binary tree with $n$ leaves, there can be different arrangements of nodes, let's define the maximum depth of such a tree as $d$, it's clear that $d \ge \log_2n$. The quantity I'm interested in is, the sum of depth of ...
A hash map that maps keys of type $K$ into values of type $V$, is essentially equivalent to "extending" this type $K$ to also contain an Option<V> field. Implementing this in practice (apart from the bad habits of adding more fields that are irrelevant most of the time), shouldn't the "extension" of $K$ be faster in pr...
For a $\Sigma$ with characters $0,1,$#$,\sigma_1,...,\sigma_m$. I have any $M$ that is a deterministic turing machine. Fix a $n$ (natural). i look at the following graph constructed from the turing machine $M$ (and the graph denoted by $G(M)$): $V$ is all possible (binary) strings of length $n$ from characters $0,1$. S...
I apologize in advance, as I don't have a clue to which stackexchange to post this question! I beg you to not delete this question, as I have chronic pain and it is very important to me!!! I actually written this hours, a lot of effort went into this question... How does one determine runtime of a theoretical program?...
Show that if $L$ is CFL and $R$ is a regular language such that they both share the same input alphabet $\Sigma$, then $C = \{w \in \Sigma^*\mid xw \in L$ for some $x \in R\}$ is context free. Hi I've been struggling quite a lot with this question. There's a similar quesion already answered here (Closure of CFL agains...
I've been trying to search for a problem which I think could be similar to Subset Sum. The definition of the problem would be as follows: Given k $\in$ $\mathbb{Z}$ and S = {$s_1$,...,$s_n$} s.t. $s_i \in \mathbb{Z}$, how many subsets $S' \subseteq S$ exist s.t. $\sum S' \geq k$. I don't know if this problem has been s...
Let f(P,Q,R) be the truth-function defined as follows. f(P,Q,R)=1 if and only if Q and R have different truth-values; or P and R have the same truth-values. Choose all formulas that are in conjunctive normal form (CNF) and represent the truth-function f. (P ∨ ¬Q ∨ ¬R) ∧ (¬P ∨ Q ∨ R) (¬P ∨ Q) ∧ (¬Q ∨ R) (Q ∧ R) ∨ (¬Q ∧ ...
I have been researching Ståmarck's method 1. In the paper cited here, some rules are given. Rules are made of triplets (x, y, z) such that: y $\to$ z $\equiv$ x where x, y and z are booleans which values are either 0 (false) or 1 (true). And rules then infer a consequence (bottom part of the rule). For example: $$ \fra...
I am looking for a way of efficiently partitionning a set of consecutive integers in to a set where the number $K$ of parts is given. For instance, for the set {1, 2, 3, 4}, I would like the best way of generating the list of $K=2$ parts. The result should be the list of partitions, for instance : {{1},{2, 3, 4}} {{1, ...
We have been given task to write a 8-bit binary to bcd converter Verilog code, using structural code NOT behavioural, is it possible to guide us how can we create 8-bit binary to bcd converter using two 4-bit converter instances ?
This is a query regarding the definition of Circuit Family and Language (in the same Context). The textbook definitions of each are: Language: A function whose inputs and outputs are a finite bit of boolean strings (i.e. members of $\{0,1\}^*$) is a Boolean Function. A Boolean Function f whose output is a single bit is...
This is possibly a very trivial question for this site. If I have a 64-bit laptop that means 2^64 combinations in total are possible. But I can even get $2^{(x>>>64)}$ on my laptop. Now, it is got to do something with the integer representation but I do not have enough background to understand it. If let's say I had a ...
I read: NVRAM is the updated Mac terminology for PRAM and is short for Non-Volatile RAM. Plus, I know that there are 2 types of main memory RAM and ROM while the first is Volatile the second isn't. So, my question is, why it was called NVRAM/PRAM and not NVROM/PROM?
My understanding of Recursively Enumerable Functions is that they're recursive functions, but for some values of the arguments you put into the function they will stop and give an answer, and for others, they will go on forever and they will never ever stop. What are some easy-to-understand examples of Recursively Enum...
The easy way is by looking at the $\{0,1\}$-table and construct the corresponding DNF formula from that, but this will take $2^n$ time. I want to do it much more efficiently. My idea is based upon the following idea: lets take $2$ clausers $C_1 = ( l_{1,1} \vee l_{1,2} \vee ... \vee l_{1,k})$ and $C_2 = ( l_{2,1} \vee...
====TLDR============================================================= Curious about the behaviour of logical and bitwise logical operations on integers, i.e with and := logical and & := bitwise and not := logical not ~ := bitwise not Can anyone explain why (2 and not 5) = False, (2 and 5) = 5, (2 & 5) = 0, (2 & ~5) = 2...
I have the following function: $f : N \to N $ and $f(n)= \max_{i \leq w(n)} g_{i}(n)$ with $g_1, g_2,...g_{w(n)}$ being an enumeration of all computable functions $g_i$, and $w : N \to N$ being any non-decreasing function. Please correct me if I am wrong: I don't think this is computable as the enumeration of all tota...
The 3SUM problem is defined as follows. Given an array A[1...n] of numbers, determine whether there exist $i,j,k\in \{1,\cdots, n\}$ so that $A[i] + A[j]+A[k] = 0$. The 3ARR-ARITH problem is defined as follows. Given three arrays $A[1..n], B[1..n], C[1...n]$ of numbers, determine whether there exist $i,j,k \in \{1,\...
Given a set that is infinite but still countable, does a TM exist that goes over every element in the set and finds the maximum? Is this a computable function?
I would like to create a tool to split a group of persons into multiple teams "randomly". Here is a mockup that shows the UI: https://ibb.co/jDHFkdH Inputs To generate the teams, the tool takes as input: dataset of persons (firstname, lastname, any other fields as gender, level, year,...) number of team to generate co...
I'm wondering if a mathematical set definition has a computational complexity. For example, assume I have some kind of problem where the solution is given by the positive integers smaller than a given integer $n$: $M = \{ x | x < n, x \in \mathbb{N} \}$ Could I say this problem can be solved in $\mathcal{O}(n)$ because...
When reading about ADT's and data structures it is common that the ADT Stack is implemented in at least two ways. Either based on an Array or Linked List. From these examples I tend to think that the way in which the data is organised determines the efficiency of the behaviors that work on that data. So if someone was ...
As I was going through my online lectures, it is stated that python is interpreted with Cpython, a software written in C. Similarly, they have Jython (written in Java) and PyPy (written in Python). My question is is these interpreters break down the language into low level code like Assembly and machine code, then who ...
So, I've just begun dabbling in complexity theory and I'm somewhat confused as to the relationship between NP-hardness and function computation. As far as I've understood, NP-hardness is defined for decision and search problem but I've also seen mention of functions whose values are considered NP-hard to compute. My qu...
I've faced this question and I hope that someone can help with it. Question: We're given an undirected graph $G=(V,E,w)$ where $w\colon E\rightarrow \mathbb{Q}$ and vertex $v$. We want to find if there's an MST of $G$ such that $\deg(v)=2$, in other words there's 2 edges connected to $v$ in the MST. Complexity requirem...
The double bridge move is a specific type of swap between 4 edges of a graph, also called 4-opt. It consists of removing 2 pairs of edges. Let`s call them (I, I+1), (J, J+1) and (P, P+1), (Q, Q+1). The edges are removed and reconnected in this way (I, J+1), (J, I+1), (P, Q+1) and (Q, P+1), like in the first image belo...
I've been reading through Garey & Johnson's "Computers and intractability", and a problem SP4 caught my attention. It is stated as following: Given a collection $C$ of subsets of a finite set $S$, state if there's a partition into two subsets $S_1$ and $S_2$ such that no subset in $C$ is entirely contained in either $S...
Let $k>1$ be an integer, let $n = 2^k$. Let $s: \{0, \ldots, n-1\} \to \{0,1\}$ be any binary sequence of length $n = 2^k$. There are $n - k$ coherent subsequences of $s$ having length $k$, and the total number of binary sequence of length $k$ is $n=2^k$, so there are some binary sequences of length $k$ that are not a ...
Okay so , I know how bellman -ford can detect a negative circle. My question is : how to actually find the edges participating in this circle. I searched and found some stuff that seem to work in the direction I was thinking of but non - fully adressed my concerns. (https://stackoverflow.com/questions/36482398/how-to-...
Let's suppose we have a weighted and connected graph. We can easily find the minimum spanning tree for this graph. But let's say we want to "force" a certain edge $e$ to be in the MST. For doing so, we are allowed to remove some edges from the graph. But I don't want to remove too many edges. Is there an efficient algo...
Problem: We have $p$ different families with $1 \leq i \leq p$ members for the $i$-th family. We also have $q$ tables where table $t_j$ has a capacity of $1 \leq j \leq q$. We want no two members of a family sitting on the same table. I need to reduce this to a maximum flow problem and came up with the following idea: ...
In the classic bin-packing problem, we have to pack some positive integers into bins, such that the sum in each bin is at most some constant $B$, and subjet to this, the number of bins is minimum. Suppose now that we relax the capacity constraint: we only require that the sum in each pair of bins is at most $2 B$. For ...
I am trying to understand Earley parsing algorithm using an example. The grammar I use produces all the palindromes over $\Sigma=\{a,b,c\}$: \begin{align*} Z & \to S\\ S & \to a\,|\,b\,|\,c\,|\,aa\,|\,bb\,|\,cc\,|\,aSa\,|\,bSb\,|\,cSc \end{align*} For instance, the string abcba is derived as: $$ Z\to S\to aSa\to abSba\...
Suppose that $f$ and $g$ are functions and $f \circ g$ is polynomial computable. a) is it true that $f$ is also polynomial computable b) is it true that $g$ is also polynomial computable c) if we replace "polynomial" by "logarithmic" would the previous questions be true?
These would be problems solvable in Polynomial time with and only with pseudo-polynomial or Exponential Space. Do such problems exist? if so which complexity class are they? If not can you prove that every problem solvable in polynomial time is also solvable in polynomial space?
I was asked the following question: Given a number num - write a function (in python) that counts the number of ones in its binary representation. This is the answer i provided def count_bits(num): res = 0 while num > 0: res += num & 1 num = num >> 1 return res When asked about the complexi...
This would be a computational model that would have unbounded space. But with a jump command that can access and do operations on any finite number of cells at once. Actual calculations would take time, but space could be accessed instantly. If it is not can it at-least solve some problems faster then a Turing machin...
I read somewhere that you can compute range queries in O(1) with O(N log N) preprocessing for any associative operation (but not necessarily invertible or idempotent). How do you do this? I know this is possible for range min and range sum. But both of these are special because min is idempotent and sum is invertible.
I would define a software program as at least one line of code stored in at least one computer system's memory cell. Can a software program be stored in just one memory cell or rather (due to binary computation) must it always be stored in two or more memory cells?
Consider the following setting: There are tasks $T = \{T_i\}_{i=1}^n$ with priorities $p_i$, and locations $x_i \in \mathbb{R}^2$. Given a location $y \in \mathbb{R}^2$, I would like to find and pop the task with the highest $p_i$ in an $L_\infty$ ball of radius $r$ centered at $y$. What are some data structures that m...
The question was to convert this recursive code with intermediate variables to a functional program code without any intermediate variables. product(p,q){ r=0 if(q==1) return r else{ if(q%2!=0){ r=r+p q-- product(p,q) } else{ r=r+2p ...
Given the following simple grammar for a language that contains all strings with matched parentheses: \begin{align} &s \to ss \\ &s \to (s) \\ &s \to () \end{align} Examples: $(), ()(), (()), \ldots$ Is it possible and how to disambiguate this grammar?
A recursive algorithm has the following computation tree. The label on the node indicates the number of outgoing edges. This algorithm takes an input of length $n$ and at each processing, it results in $n - 1$ recursive calls. For each these calls/nodes, the size of the input decreases by $1$ from left to right. This p...
I am currently studying the paper "Abstract Interpretation Frameworks" by Cousot and Cousot from 1992 (https://doi.org/10.1093/logcom/2.4.511) to gain an understanding of the theory behind abstract interpretation. One concept in abstract interpretation is the "soundness relation" (local page 6 in above paper). As I und...
Consider an NP-hard graph problem, like the maximum independent set problem. Let us say I restrict my inputs to only be graphs that have $n$ vertices and at least $n^{c}$ edges, for some $c > 1$. In other words, the graphs are very connected. Is the maximum independent set problem still hard for these graphs?
I've faced a problem and I don't know what approach I must follow, dynamic programming or greedy method, so here is the question. Question: Given a directed tree $T=(V,\ E)$. We're required to find a set of vertices $A\subseteq V$ as big as we can such that for every two vertices $v,u\in A$ there isn't a path of length...
Suppose we want to construct a queue with the following properties: The priority of each member of the queue must be known. For example, for the head node, their priority is 1, for the next node, their priority is 2, etc. Then given a node, we must be able to determine its priority efficiently. It must support deletio...
Good Evening, I am trying to solve an exercise related to my algorithm designing course. I have understood the question and what it asks. I am required to formulate an ILP and then relax it to according LP. So I have n goods which I have to ship using three cargo companies. the Paths P i,j is composed of segments of ro...
Having two equivalence relations, both as a union find data structure with the same number of elements, what is the most efficient way to find the equivalence relation that is the intersection of both relations? For example, lets have $R_1=\{\{1,2,3\},\{4\}\}$ and $R_2=\{\{1\},\{2,3,4\}\}$. Then the intersection would ...
Here is a greedy algorithm for maximum bipartite matching: Iteratively select an edge that is not incident to previously selected edges. This algorithm returns a 2-approximation, and runs in linear time. My question is, how can I find a graph for which the greedy algorithm returns a matching which is half as big as t...
I am doing some exercises on proving NP Complete problems and the first problem was directed bipartite graphs with a Hamiltonian cycle and the second one was undirected bipartite graphs with a Hamiltonian cycle. For the first problem I managed to find a reduction from $DHC$ where for a given graph $G$, we duplicate eac...
The Bowyer-Watson Algorithm for creating Delaunay Triangulations works iteratively. Let's say that we have a Delaunay triangulation of $n-1$ points. Now we add the $n$-th point. In order to update the edges, we first need to find the nearest neighbour to that new point. They propose to start at the vertex nearest to th...
In this question post, one of the answers is: You can even store a software program in 0 memory cells! All you need to do is to define a programming language in which the empty program has a defined meaning. For example, you can define a programming language that is just like Python, except the empty program prints t...