instruction
stringlengths
35
11.4k
I want to reduce $L$ (stated above) to the Halting Problem in order to say that L is recursively enumerable but not recursive just like the Halting Problem, but is it enough to say that if I can solve the Halting Problem then I can solve $L$, because then I can feed into the Halting Problem the input $w_i$ twice, as bo...
To prove the blank-halt problem is undecidable (does a given Turing machine halt on the empty input), it's a case of reducing the halting problem to the blank-halt problem and since the halting problem is undecidable, the blank-halt problem is undecidable. However to prove the blank-halt problem is recursively enumerab...
If I have DFA accepting $\{w \in \{a,b\}^*$ s.t. on every odd position in $w$ there is a $b\}$ Would the empty word be accepted? Also, would the word $eb$ be accepted?
In this answer, it is told that the minimal $p$ value is $1$. One of the conditions of the pumping lemma is that $|xy| \leq p$ Now if we try to split a string $01^p$, we might do it like this: $x=\epsilon$, $y=01$, $z=01^{p-1}$ But this decomposition contradicts the above condition. If we arrive at a contradiction, the...
The following theorem (from "The Design of approximation algorithms" by Williamson & Shmoys, pg 43) states: For any $\alpha > 1$, there does not exist an $\alpha$-approximation algorithm for the traveling salesman problem on $n$ cities, provided $P \neq NP$. In fact, the existence of an $O(2^n)$-approximation algor...
I'm trying to find all the neighbors of a given cell in a voronoi diagram. For example, given the following diagram, if I want to find the neighbors of the cell 1, then I should be able to return the points 2, 3 and 4. Any hints on how to do so ? [EDIT] I didn't explained myself very well, I only have the image (pixe...
It is well-known that the Merkle–Hellman knapsack cryptosystem can be solved using the LLL algorithm. In the Merkle-Hellman knapsack cryptosystem, we're trying to find a solution $x_i \in \{0,1\}$ such that \begin{align} \sum w_i x_i &= K, \end{align} where the $w_i$ are integer weights. Is it possible to find an appr...
Ackermann's book "Solvable Cases of the Decision Problem" discusses decidable instances of first order logic, particularly monadic logic, and so called "equality formulas". However, the book is from 1954, the notation is terse, full of German letters, and presented in a very non-algorithmic way (which is unsurprising, ...
Is the following language regular? $$ \{ 0^m0^n : 0\le m\le n \}. $$ According to me, it is not regular. However, some of my friends are arguing that every string in $0^*$ can be divided into $0^m0^n$ satisfying the constrains between $m$ and $n$, hence it is regular. Although I am absolutely sure that their reason...
It is well-known that every non-trivial NFA of $k$ states (an NFA that does not accept all strings) rejects a string of length at most $2^k$. But is this upper bound asymptotically tight ? I found a rough sub-exponential bound in this strategy. Let $p_i$ be an $i$-th prime. On the singleton alphabet, $\Sigma = \{a\}$,...
Interactive Proof System : An interactive proof system for a language $L$ is a two-party game between a verifier and a prover that interact on a common input in a way satisfying the following properties: The verifier strategy is a probabilistic polynomial-time procedure (where time is measured in terms of the length o...
Question no:$1$ "Any problem whose domain is finite is always Decidable" lets take a TM,$M$ and finite domain of problem i.e. finite set of strings for eg. {$a,abaa,bba$}, Now the problem "whether $M$ accepts these set of strings or not is decidable or not?" What I think is, this is Undecidable problem because, ...
What is the minimal number of DFA states required to recognize binary numbers (encoded MSB to LSB) which are divisible by 6 and 8? For divisibility by $6$ we required $6$ states. For divisibility by $8$ we require $4$ states. So in total, we need $6 \times 4$ states = $24$ states. Am I correct? Can we do it with fewer ...
I am trying to analyse a weighted multi-graph which represents a snapshot of a rail network for a particular day. As such, the vertices of the graph can be considered stations and the weighted edges represent the time taken to travel from one station to another. For any particular vertex, there might be multiple edges ...
Given an alphabet $\Sigma = \{0, 1\}$ and a formal language $$L = \{ w \in \Sigma^* |\ |\mathrm{odd}(w)|_1, |\mathrm{even}(w)|_1 \text{are even numbers} \}$$ That means that the number of 1's in the odd and even positions of a given string are always an even number. I've tried using the Pumping-Lemma on a $1^{4n}$...
I am having hard time to proving this problem $C=\{\langle M \rangle \mid M \text{ is a Turing Machine , } L(M) \text { only contains two different strings}\}$ some ideas that i have tried are : i have to prove if $C$ is not recursively enumerable. I know if $A$ is recursively enumerable, and $co\text{-}A$ is recursiv...
I'm trying to solve the following problem: There are N notes in an array (2<=N<=105) labeled 0..N-1, all of them initially set to 1. Then there follows Q operations to perform in the array (1<=Q<=105). The task for each operation is: Find the most frequent value between the inclusive range [A,B]. Add that value to all...
I am reading RSA cryptosystem from Farouzan book on network security. The author has mentioned that RSA encryption is prone to chosen ciphertext attack. Then why is this algorithm still so popular?
I'm reading a computer science paper, this one: https://arxiv.org/abs/1608.03960. It uses certain notation in one of the illustrations (Figure 9, page 8 in the PDF version) that I don't understand how to interpret. Attaching here as well for better visibility: $$ \text{EXEC} ~ \frac{\text{cmd}_1 : \text{CMD} \quad A_p,...
Is the following problem coNP-complete? Inputs: $p=$ a possibly non-convex multivariate polynomial over $\mathbb Z$ $k\in \mathbb Z$, an integer Question: Is $\forall x\in\mathbb Z: p(x)\geq k$?
L = { x^n y^n / x,y belongs to (a+b)^* , number of a's in x = number of b's in y and n > 0} According to me it's regular because for any string $w$ belongs to $(a+b)^*$, we can divide the string into 2 parts $x$ and $y$ with $n=1$ . Is my reasoning correct?
I am stuck on a question. Lets say there is a string that can be created from three alphabets a,b,c the condition is number of a<= number of b<= number of c. I can solve if there are a and b (two alphabets) but I am not able to solve for 3. Any help will be appreciated. Thanks
I have an interval of intigers and I need to find all unique cuboids which have volume that falls within said interval. I came up with a loop that goes over all uniqe combinations of 3 numbers (size of the cuboid) (1x1x1, 1x1x2, ...; also 2x1x1 is considered the same as 1x1x2) from 1 to the upper range of the interval....
$S$ is a set of $n$ elements with some unknown strict total order. The goal is to discover the greatest $k$ elements, where each step consists of comparing $m\ge 2$ elements at once (so if we compare $a, b,$ and $c$, we might get $b > c > a$). Any strategy for achieving this will have some worst-case number of steps $t...
How do I go about designing a constant time algorithm which satisfies the following I/O requirements: Input: an array $A$ of length $3n$, containing $2n$ values of the symbol $X$ and $n$ of the symbol $Y$ Output: a number $i$, such that $A[i]=X$ It is clear that the naive linear scan approach is $O(n)$. Is there any ...
I read that pumping lemma is sufficient condition to prove non regularity of languages but not necessary condition. I know the first part that it is sufficient is true but not able to understand why is it not necessary. Can someone please help me with this statement?
I came across a modification of the classic house robber problem where the robber cannot rob from $l(i)$ houses on the left of $i$th house and $r(i)$ houses on the right of $i$th house. The modified version will now be as follows: You are a professional robber planning to rob houses along a street. Each house has a ce...
Recently, I learnt about VC-dimension and how its boundedness assures PAC learnability on uncountable range spaces (let's assume that hypothesis class is the same as the family of concepts we want to learn). My question is simple: What is/are the geometric intuition(s) behind the concept of VC dimension?
Rice's theorem: Any nontrivial property about the language recognized by a Turing machine is undecidable. I know the proof but I am not able to understand the theorem. I think trivial properties are like :language recognised by Turing machine contain at substring "aab". where as nontrivial property means is language ac...
I have a raster image with a number of arbitrary shapes (blobs). I am interested to find, for every blob, its immediate neighbors, i.e. those that are visible from it in a straight line. The search can stop after a few neighbors (say 3) have been found, by decreasing closeness. I imagine that a growing process around e...
I know it sounds a bit silly, but I got really curious. Is it possible to simulate a CPU in, let's say, Python? Some have argued that Minecraft, for instance, allows one to build turing-complete machines, but has some real research been made on this idea? Nested computers? How efficient could that be if made on assembl...
A language $L$ is said to be sparse if there exist a polynomial $p$ such that $|L \cap \{0,1\}^n| \le p(n)$. One trivial example is suppose language is over single alphabet $1$ then $$L = \{1^n | n \in Z^+\}$$ Question : What are the other non-trivial examples of sparse languages?
Consider we have an AVL tree. Its left subtree A has disbalance coefficient has value +1 (meaning the right subtree has greater depth). Its right son has disbalance coefficient -1 (meaning left subtree has greater length). If I understand correctly, we're looking for the most right vertex in the left subtree. After de...
I would like to know if there is a name for CFG grammars (or grammars in general) in which there is a fixed number of "distingushed" terminals or in which there is a terminal that appears a fixed number of times (in the generated strings). For example: $L(G) = \{ 0^a 1 0^b 1 0^c \mid a = b \text{ or } a = c \}$ In thi...
$$L = \{ \langle M \rangle \mid M \text{ takes at least 2016 steps on all input } \}$$ My approach As $M$ takes atleast 2016 steps, only tape cells 0,1,..2015 are significant. Now we have finite number of strings of length 2016. As we have finite number of strings with finite length, we can simulate $M$ on each of t...
I'm working with something that can modeled as the following type of (multi-)graph $G = (V,E)$, which I've been calling an "unlockable" graph. (There may be existing terminology for this.) Let $G$ be a graph with the following additional structure. There is a set $K$ of keys, and edges may be "unlocked" or they may be ...
I was under impression that when a Language (or problem) is not semi-decidable and not decidable then we can say it's undecidable and I think it makes sense also based on diagram. However, in my assignment the TA struck out "undecidable" and wrote "not semi-decidable". Why is "undecidable" wrong if it's both not semi...
Ternary search trees are very common in the text editing area. They could be used to implement Auto complete feature, spell checking, Partial-Match searching, Near-Neighbor Searching & many many other options. The reason behind them being famous is their space efficiency compared to tries (Although tries are faster) & ...
Given a TM M, will it ever reach any other state other than start state if it starts with blank tape ? Is the above problem decidable ? I think that if a TM really reaches any other state other than start state then we can check the transitions and find out. But if it doesn't at any point of time then we can't say that...
My gut says it's true and I have tested it on a few examples. However, I can't prove it. I thought of using contradiction; suppose there exists another tree T' with smaller weight which has m edges not shared with the first tree. We can transform the first tree to second one in m steps by adding one of the m edges whic...
Let $s = a^pb^{2p}$, now which one of those decomposition is correct: $x=a^k$, $y=a^l$, $z=a^{p-k-l}b^{2p}$, where $k+l \leq p$ $x=a^{p-k}$, $y=a^k$, $z=b^{2p}$, where $1\leq k \leq p$ $x=\epsilon$, $y=a$, $z=a^{p-1}b^{2p}$ or are they the same? I've read in multiple answers that we don't get to pick the decomposition,...
Conceptually, I know that reducing a problem $Y$ that's NP-complete to a problem $X$ implies that $X$ is at least as hard as $Y$, implying $X$ is also NP-complete. So if any NPC problem, say $Z$, can be solved in polynomial time, then that implies $P = NP$, since any other NP-complete problem can be reduced to $Z$ in p...
Triangle removal problem states that, given an undirected graph G, can you pick a subset S of vertices such that removing S will remove all triangles from the old graph and |S| <= k. I was trying to use reduce from vertex cover problem, but every construction I attempted has failed. Here's what I've done: 1) Add extra...
It is well-known that dynamic arrays have an amortized $O(1)$ time complexity for adding one item, but a worst-case $O(n)$ complexity. This is because for particular values of $n$, there is no more room in the buffer, so the dynamic array allocates a new buffer and copies over $n$ items. My question is, what would the ...
My question is a request for literature or pointers that address the following abstracted problem. If I have a finite set (ex. {1..10}) over which I'd like to maintain several "partition maps": m1 = {1..5}=1, {6..10}=2 m2 = {1..3,8..10}=3, {4..7}=4. Afterwards I'd like to merge (generalize the operation, but use addi...
I am working on pattern matching algorithm. Its working and using very less memory. For the comparison, I have to compare it with the Rete Algorithm. I have checked it in the thesis of the author, some of his paper and he has provided some complexities which are not based on then, nor does its efficiency is provided in...
Can someone please tell me if complement of halting problem(L) is Co-RE or non R.E ? I think that it is Co-RE as L' (L complement) is R.E but everywhere its given non R.E
$L = \{ \langle M \rangle \mid L(M) = \Sigma^∗ \}$ Is above problem R.E ? I found an explanation in one of the websites and I have doubt in few lines of paragraph. The explanation was Now, given a halting problem $(\langle H \rangle, w)$, we proceed as follows: We make a new TM say $A$, which on input $x$, just simulat...
What are currently the state-of-the art algorithms for this purpose? This is an area that I know absolutely nothing about. I'm basically interested in the following two things (which I assume go hand-in-hand): Source separation Locating sources I'm basically trying to build some simple Raspberry Pi based robot that w...
We are given $2n$ positive integers $a_1,a_2\ldots,a_n$ and and $$b_1,b_2,\ldots,b_n$$ as input. The question is to find a permutation $O$ on $\{1,2,\ldots,n\}$ that minimizes $$\sum_{i=1}^n \left(a_{O(i)} \cdot \sum_{j=1}^i b_{O(j)}\right).$$ For example, take $n = 3$, $a_1 = 10, a_2 = 1, a_3 = 100, b_1 = 10, b_2 = 1...
Logic in computer science (By Michael Huth,Mark Ryan, second edition, page 132) says Every φ can, in principle, be discovered to be valid or not, if you are prepared to work arbitrarily hard at it; but there is no uniform mechanical procedure for determining whether φ is valid which will work for all φ. For me,...
Do URI's, as defined in rfc3986, form a regular language? How can I tell? There's a BNF grammar provided, but I don't know how to check that it has a unique representation of every URI, or that it describes a regular language.
We have an array of $N$ positive elements. We can perform $M$ operations on this array. In each operation we have to select a subarray(contiguous) of length $W$ and increase each element by 1. Each element of the array can be increased at most $K$ times. We have to perform these operations such that the minimum element...
I have two variables $A$ and $B$, with $A$ being binary and $B$ is a real number where $B \ge 0$. My conditions are: if B > 0 A = 1 else A = 0 How to express this as a linear program? I have figured out one condition using the big-M method: $MA \gt B$ which means that if $B>0$, then $A$ must be 1 to ...
In "Towards a cubical type theory without an interval" Altenkirch and Kaposi motivate why it is hard to compute with univalence. They say: For example, we can define the equivalence (not ,...) between Bool and Bool and thus univ (not ,...) : Bool =_U Bool, and then using it, define a boolean b: coe : (A =_U B) → A → B...
We have a large file that can't fit into internal memory. How do we randomly pick one line so that each line has the same probability to be picked? And how do we randomly pick such n lines so that they all have the same probability? We don't know the number of lines beforehand. Any hint on where to start solving this,...
I want to understand if there exists an algorithm which is wait free and operates on non-shared memory, asynchronously. Finally I want to know how to derive the consensus number of this algorithm. Googling did not work.
Suppose we have a bunch of bars, which can represent anything (time slots, paths, physical items...) and each of them has a start point, an end point, and an associated value. Out of all the bars available, we want to choose the set which maximizes the total value but with no overlap between the start points and end p...
I'm trying (in vain) to get a beginner's grasp of quantum computing, so doing a lot of reading. I've started looking at IBM's QISkit Jupyter Notebooks, and came across the one on MaxCut problems. In there, they give an example of how you could use quantum computers to solve the Traveling Salesman problem, for 4 cities....
I found this link: http://theory.stanford.edu/~tim/w11/l/qsort.pdf and it kind of theoretically describes how to approach finding expectation for the number of comparisons in a Quicksort. Using this, how would I find and prove the expectation for an array of a concrete number of items, for example 5? (see the formula...
How do I solve the following problem with a recurrent neural network (RNN)? What architecture should I use for the (conv)-RNN? Let $s \in \mathbb{R}^N$ be a musical signal. We corrupt it with some white/pink noise $\omega$ to obtain $x= s+\omega$. We then create a conv-RNN with $N$ input and $N$ output neurons, we...
Okay so I've been going crazy about this problem I was given. It is as follows: Given a pile of N matches, 2 people take turns removing matches from the pile. When it is your turn you are allowed remove 1, 5 or 6 matches. If it is your turn and you are unable to make a move then the game is over and you have lost. The ...
I am curious because I took a quiz and answered false to the question: "The height of an AVL tree may be greater than the height of a binary heap with the same elements." I have been trying to think of an example, but I just cannot figure it out. Does anyone know when this is the case?
I'm attempting to solve the recurrence relation $$T_{(n)}=4T_{(n−1)}+(n+5) 3^n$$ with the conditions: $n>0$ $T(0)=0$ I know the solution must be in the form $$T_{(n)}=T_h+T_p $$ but I think I'm making a mistake since when I calculate $T_h$ it gives me 0, and also don't know how to guess the $F_{(n)} = (n+5)*3^n$ int t...
I am interested in knowing what algorithmic paradigm are the usual recursive sudoku solvers. Can I consider it a local search? or are they Dynamic programming, greedy, divide and conquer, backtracking?
Let we fix $<T>$ and $w$, where $<T>$ is its binary representation of a Turing machine and $w$ is input. We want to check if $T$ doesn't halt over $w$ before $2^{|w|}$ steps. A trivial solution is to use a universal Turing machine which simulates $T$ on $w$ and counts its steps, but this method uses exponential time. I...
Given the alphabet $\{ a,b \}$, if I want to build the regular expression for even/odd lenght strings, I can think that an even lenght string is given by some combination of $a$'s and $b$'s, and the letters can be paired, so there are four possibilities: $aa,ab,ba,bb$, the regular expression(for even lenght strings) so...
Let $\Sigma = \{0, 1\}$ and $$L = \{ w \in \Sigma^* | w = \mathrm{odd}(w) · \mathrm{even}(w) \},$$ where $\mathrm{odd}(w) = w_1, w_3, w_5 \ldots{}$ and $\mathrm{even}(w) = w_2, w_4, w_6, \ldots{}$ are the words constructed from the characters in all the odd and even positions of the string. I.e. $w = 0110110110 \in L...
From what I have read, instructions under x86 can be as long as 15 bytes. Since x86 is a 32-bit architecture (64-bit for x86-64 obviously) how does it handle these long instructions? How are they stored in memory, and how are they fetched?
I've been finding myself a bit confused with the direction of reductions used to show that certain languages are not recursive. For example, let us say we want to determine if the Halting Problem ($HALT_{TM}$)is undecidable. I know we can assume that it is decidable and then try to build a decider for the acceptance pr...
I'm currently reading Nancy Lynch book about distributed systems, chapter about IO automaton. And I have following questions related to book exercise 8.13(c). We are given some automaton A with sig(A) is empty. Traces(P) is the set of sequences over {1,2} in wich every occurance of 1 is immediatly followed by a 2. I ...
Let's assume we are to implement a Round-Robin algorithm. What will happen in a case when a process has completed it's time quantum at the same time as another process arrives. Let's say we have a time quantum of 3 CPU cycles and a process A's burst time is 5 CPU cycles. If it runs from 0 to 3 (in CPU cycle time), and ...
Find a pushdown automaton accepting the language $$L=\{A^i B^j C^k \mid 2k \le i \le 3k \text{ or } j \neq i+k \}.$$ I can't construct the automaton because I can only imagine it with multiple stacks or with set-theoretic intersections.
The rule is that an isolated lit square in a grid of squares must be paired in the x-direction (either immed. left or right of it) AND y-direction. That is, from surrounding cells, the closest lit or on square moves to the isolated square to join it in the x or y-direction, and the isolated square moves to the one mov...
I had a question for my paper last week and i tried solving but failed. Given n people, any two are either friends or enemies, and friendship and enmity are mutual. I want to distribute hats to them, in such a way that any 2 friends possess a hat of the same color but no two enemies possess a hat of the same color. Eac...
I am of the understanding that tradition "simple" recurrent neural networks have the problem of "losing error" after a lot of time steps. But is this some kind of deficiency of the math, or the machines the RNN's are running on? If it's just the machines, couldn't you use something like an arbitrary precision float and...
I need to find true shortest path between two points. true means that shortest path can be laid both through the vertices, and through the edges. Input Set of triangles, given by coordinates of 3D-points. Source and target points. Output Sequence of 3D-points representing a true shortest path from source to target. ...
Had this question on an algorithm exam. Can any one explain why $\sqrt{n} = \Omega(3^{\log n})$ is false?
Given an arbitrary undirected graph $G = (V,E)$, I am interested in a low-polynomial time algorithm which can find several moderately large (ideally $O(n^\epsilon)$ vertices per clique for $\epsilon > 0$) cliques in $G$, provided they exist. I am aware that the problem of finding the maximal clique is NP-hard. For my p...
If a CNF contains both horn and dual horn clauses and does not contain clauses of other types, then can its Satisfiability always be determined in polynomial time? If the answer to the above problem is yes, then suppose we only add XOR clauses in addition to horn and dual horn clauses, can the Satisfiability of this ty...
I have heard of some people mentioning the general rule that says that you can only ever guarantee that a program will not capture the negative cases but you can never guarantee that it captures all the positive cases. I am only roughly summarizing what i heard and don't know the exact definition or exact phrase but t...
I want to figure out if the following language is Turing decidable, Turing acceptable but not turing decidable, or neither. The language is {ρ(M) : |L(M)| ≤ 10} My question for this problem is what does |L(M)| ≤ 10 mean? At first, I thought it meant that the language will only accept strings that are less than ...
I was just reading this paper: Gate-Variants of Gated Recurrent Unit (GRU) Neural Networks Rahul Dey and Fathi M. Salem It seems to me that perhaps the architecture of LSTMs and GRUs are overly complicated. And that the same problems could probably be solved with a simpler architecture. I get the theory behind LSTMs a...
What does happen if two events simultaneously occur at a particular state of a finite state automaton (FSA)? For example, assume that an FSA's event table at its state $s$ is as follows: $\delta(s,e_1)=s_1$ and $\delta(s,e_2)=s_2$. What will be the system's next state if both $e_1$ and $e_2$ occur exactly at the same t...
Let $S_1$ and $S_2$ are two multi sets. We want to find, Is $S_1 =S_2$? Algo 1: Sort $S_1$ and $S_2$ and then check $S_1 = S_2$ Running time : $O(n \log {n})$, where $n$ is the size of the multi sets. Algo 2: Contruct two polynomials using $S_1$ and $S_2$ (example if $S_1 = \{1,1,2\}$ then polynomial will be $(x-1)(x...
We are assigning the colours white/black to the vertices of a DAG, under the condition that if $V$ is black and there is a path $V \to W$ for some vertex $W$, then $W$ is black. Examples: In the case of a linear chain of $N$ nodes, the answer is $N+1$ - either all the nodes are white, or one of the N nodes is black me...
I want to prove regularity of a language that contains a known regular language $L$ using an NFA. Say the transition function of the automation that accepts $L$ is $f$. In my new transition function, is there a limitation on composition of $f$? For example, can I make the following transition in the new function? $$f'(...
I am searching for information on a variant of the 0-1 Knapsack Problem I will call the Vector Knapsack Problem (VKP), which is basically the same as the standard KP except that the values being summed are vectors (and them sum is the Euclidean norm of the sum of the vectors). Formally, given a set of $m$ vectors $v \i...
I am studying for an artificial inteligence class, and i have to classify the following sentence "For any search space, there is always an admissable and consistent A* heuristic". Well, i know that there is always an admissable heuristic, for example zero, since its an underestimation of the real cost (althoug this wou...
Taken from Artificial Intelligence A Modern Approach : Notice how a node doesn't gets added to the frontier twice in Graph-Search, And then take a look at this : Now obviously this is not true as in the following example : Bucharest will be added to the frontier first with path sibiu->fagaras->bucharest, while the s...
I have a Turing machine M. How can I prove that $L(M) = (L(M))^R$ is decidable by constructing a Turing machine that can do this? I know how to figure out if two DFA's accept the same language (using the symmetric difference) however I don't believe it works for Turing machines. Now I am able to design a Turing machine...
The "function" type $\rightarrow$ is predefined in Agda. But how would one define it if it was not predefined? Specifically I am talking about $\rightarrow$ in: data Nat : Set where zero : Nat Suc : Nat -> Nat
I have a weighted graph representing traffic network. Nodes represent the locations and vertices represent available paths between locations. Weight values represent number of the passages on the path. I would like to cluster based on the similarity of the weight values (i.e. number of passages) and establish different...
Given a matrix $M \in \mathbb{R}^{n \times m}$ and a set $S \subset \{1, \ldots, n\}$, let $M_{S, {\rm row}}$ be the matrix obtained by picking the rows of $M$ from the set $S$. Similarly, given $S' \subset \{1, \ldots, m\}$ we let $M_{S', {\rm col}}$ be the matrix obtained by picking the columns of $M$ in $S'$. Now ...
We are given an array with only $0$s and $1$s. The number of $0$s is greater or equal to the number of $1$s. The goal is to ensure that there is not a pair of $1$s adjacent to each other. We can only read the value of an element or to swap 2 elements. What is an algorithm for the fewest swaps possible? I tried swapping...
Given a list of logical formulas: f1: A&B f2: A&D&C f3: B&D&E f4: A&B&C f5: fn: ... In this case I want A&B as the longest formula which is common to at least two formulas. Is there a simple algorithm to find the longest formula that could be performed on paper?
I want to reconstruct a graph when given the results of a Floyd-Warshall shortest pair distances matrix, similar to the problem being solved in this question: Is it possible to reconstruct graph if we have given matrix of shortest pairs The only difference being that, whilst the problem from the linked-to question seek...
What are the rules pertaining to 3SAT as to the actual boolean equation? The main thing I do not understand is in a given boolean expression within a single clause can you have both AND + OR operators i.e. (x1 & x2 | x3) or do they have to remain consistent i.e. (x1 & x2 & x3) or (x1 | x2 | x3)? That being said when c...
According to the answer at (How to define function type in AGDA) the function type is kind of a fundamental thing in Agda and needed for bootstrapping, hence end user can not define it like what they do for conjunction(product) type and has to be predefined at the language level. Does this mean that implication(functio...
I am fairly confident that my textbook (Concepts of Programming Languages 11th edition, international edition, Robert Sebesta) has an error in its definition of what a phrase is in the section on bottom-up parsers. After an infuriating conversation with the professor using that textbook in which I was told that the boo...