instruction
stringlengths
35
29.1k
i.e. $A\leq_pB\:\wedge\:B\in\text{co-NP}\rightarrow A\in\text{co-NP}$ ? I feel like it's the case but I can't think of a straightforward proof. Clarification: I am talking about polynomial-time Turing reductions.
I'm trying to understand the very simple concept of co-NP but I can't figure it out. On wikipedia, it gives the example of SAT and its complement: The complement of any problem in NP is a problem in co-NP. An example of an NP-complete problem is the circuit satisfiability problem: given a Boolean circuit, is there a p...
If $n<100$ then $O(n^2)$ is more efficient, but if $n\ge 100$ then $O(n\log n)$ is more efficient. I am sure that this statement is valid, but I don't know how to prove it or justify it. Can someone please help me?
When solving a multi source/sink max flow problem, the classic reduction to the single source/sink problem is to add a new source and sink node with infinite capacities that connect to/from the existing source/sink nodes. I was curious about an alternate reduction. It is kind of silly buy I just wanted to sanity check ...
First post here so hope I'm not missing too many guidelines. I've had this idea for a few weeks now and I can't myself see where I'm going wrong with it, hope it makes some sense to you and thanks in advance for the help. Here we go: Assuming we could solve a NP-complete problem in logn SPACE, e.g. TSP. Then by reachab...
There is an exercise which says : Al and Bob are arguing about their algorithms. Al claims his $O(n \log n)$-time method is always faster than Bob’s $O(n^2)$-time method. To settle the issue, they perform a set of experiments. To Al’s dismay, they find that if $n<100$, the $O(n^2)$-time algorithm runs faster, and only...
In the Wikipedia's Binary search tree, one can read Traversal requires $O(n)$ time, since it must visit every node. Since it is question of a lower bound, shouldn't we write Traversal requires $\Omega$(n) time, since it must visit every node. Is the $O(n)$ statement here even correct?
Before you downvote, please note that this question is distinct from this similar looking question I came across the following the problem in "The Introduction to Algorithms" by Cormen et. al. Show that for any two functions $f(n)$ and $g(n)$ that are asymptotically non negative, either $f(n) = O(g(n))$ or $f(n) = \ove...
Here is the definition of Blum's Speed-Up theorem. Blum's Speed-Up Theorem. There is a decidable language A such that for every TM $M$ that decides A with running time $u(n)$, there is another TM $M'$ that decides A much faster with running time satisfies $r(u(n))$ such that $r(u(n)) \leq u(n)$ for any computable func...
Given $n$ dots on a plane, such as: n couples ($x_i$,$y_i$) I would like to find a line parallel to y-axis ( $x=b$ ), such that the sum of all of the point's distances from that line will be minimal In order to do that, I need to write an alogrithem with a linear run-time ( $O(n)$ ) MY METHOD I relate only for the $x$...
Problem We are given 2 arrays a and b both of length n. We build a third array c by rearranging the values in b. The goal is to find the optimal c that maximizes result = (a[0] ^ c[0]) & (a[1] ^ c[1]) & ... & (a[n - 1] ^ c[n - 1]) where ^ is XOR and & is AND. Is it possible to do this efficiently? It's straightforward...
We know that Hamiltonian path, clique and independent sets are NP-complete but what about half or the square root of each problem or a fraction of $n$ ? That is, for a graph, $G$ of $n$ nodes, is there a Hamiltonian path of size $\frac{n}{2}$ or of $\sqrt{n}$ or any number of nodes less than $n$? is there an independe...
I am trying to determine if a given solution is a basic feasible solution. I am working with an $n-$dimension polyhedron $P$ defined by a set of $M$ inequalities $Ax \leq B$. I am running into an issue where I am not sure how to determine if a solution is basic feasible or degenerate. Working off of the following defin...
I have some questions that I don't understand about time complexity. Given that the worst case complexity of the algorithm $A$ is $O(f(n))$ and the best case complexity of $A$ is $Ω(g(n))$. It follows that $f(n) ∈ Ω(g(n))$. Given that the best case complexity of the algorithm $A$ is $O(f(n))$ and the worst case comple...
Problem: Given a graph G with positive integral weights on nodes as well as edges, find an induced subgraph H with maximum total weight per node, i.e., the goal is to maximize $$ \frac{ \sum_{e \in H}w(e) + \sum_{v \in H} w(v) }{|V(H)|}.$$ If you allow negative weights, then it is NP-hard (easy reduction from Clique). ...
An observation when defining List in agda with --without-K enabled: The following parameterized inductive definition is accepted: data List (A : Set) : Set where [] : List A _::_ : A → List A → List A but not the equivalent inductive family definition: data List' : Set → Set where []' : {A : Set} → List'...
Consider the following new operation for disjoint sets PRINT(x): print every element in S_x the set containing x One Approach that I found but couldn't figure out completely : In addition to tree we store a linked list. And each node in the tree in addition to the element the tree nodes also stores the pointer to elem...
Find all values of $ x ∈ R $ such that x + 1 = 1 in floating point arithmetic with 3 bits mantissa. How do we represent number 1 in floating point arithmetic with 3 bits mantissa I wonder? After that, I think we can subtract 1 on both side? I am a little confused about representations of numbers in floating point arith...
$a)$ Determine for all pairs $i$ and $j$, $i,j ∈ \{1, \ldots, 6\}$ whether for the ones given below functions $f_i ∈ O(f_j)$ or $f_i ∈ o(f_j)$ or neither of the two applies as $n → \infty$: $f_1 = \log(n),$ $f_2 = \log(\sqrt n),$ $f_3 = \log(n + \log(n)),$ $f_4 = \sqrt{\log(n)},$ $f_5 = \log\log(n^{\log(n)}),$ $f_6 = \...
I am looking at this algorithm in CLRS page 26: I am a novice when it comes to these things so please make your explanations as simple as possible. For the cost column, does c1, c2, c4, etc denote a value the same way n does, or are they just labels? My understanding is an operation takes one time unit (such as j=2 is...
A binary search tree is constructed by inserting the following value sequentially: $$3, 9, 1, 6, 8, 7, 10, 4, 2, 5$$ Let $p_v$ be the probability to search for the value $v$ in the binary search tree (for $1\leq v\leq10)$. $p_v = \frac{1}{25}$ if $v$ is an even number and $p_v = \frac{1}{10}$ if $v$ is an odd number. ...
I would like to know how different defintions of class DP (also written $D^p$) are equivalent (brief explanations would do). The following are the two definitions I see: Difference between two NP problems; i.e., DP $:=\{A\setminus B\ :\ A,B\in NP\}$. $\{L_1\cap L_2\ :\ L_1\in \text{NP},\ L_2\in \text{co-NP} \}$. Com...
Consider the language $$ \{ w \in \{0,1\}^* : \#_0(w) \ge \#_1(w) \} $$ consisting of all words over $\{0,1\}$ in which the number of zeroes is at least twice the number of ones. Is this regular, context-free, Turing decidable? My Idea It's not regular, because we need to track the number of zeros and so it cannot be d...
Let the alphabet be $\{0\}$. I have to prove that not all languages over this alphabet are regular, using some countability argument. My Ideas: The set of all languages over $\{0\}$ is uncountable. This can be proved with the diagonalization argument. So to prove the statement, I have to show that set of all regular la...
We recently learned Bellman-Ford algorithm for shortest path in class, but I didn't understand it. Can you give me intuition for why the algorithm works? And can you please explain why it is correct? Why are we sure to find negative circles? Also, we learned the following two lemmas: Lemma (upper bound property): At a...
I have found this exercise and I cannot solve it: In $X=\mathbb R^2$, let's observe two models $H_1$ (rectangle with sides parallel to the coordinate axes) and $H_2$ (lines). We define a model $H_3$ such that every hypothesis is a combination of one hypothesis from $H_1$ and one from $H_2$. Prove or disprove that the ...
I am pretty new with data science and Machine Learning. I am learning form one textbook and I found this task. I have no Idea from where to start and what relation could be. Any help would be great. Suppose we want to learn the Boolean functions in instance space $X=\{0,1\}^3$. We are given two models to examine: $H_1...
I have trained two binary decision tree classifiers with splits in $\mathbb{R}^4$. Same data, but from two different patches. Now, I want to find the exact intervals where the two trees disagree. The splits are along the lines of: \begin{align*} & (x_1 > 0.35592521727085114) \wedge (x_3 \leq-0.13628841191530228) \imp...
Prove that the following grammar is unambiguous: $$X \to aX | Y$$ $$Y \to Yab | b$$ I know that I must prove that the strings produced by this grammar have only one parse tree, but how can I do this?
I was looking at this course but I cannot seem to understand what is meant by the term "single-threaded kernel". Does it mean that: only a single kernel thread is made available by the OS? only a single kernel thread can be executed at one time? or is there some other interpretation?
For the following language, write grammar independent of the text. $$\{a^i b^j: j < 2i \text{ and } j \ne i \} $$ I want a hint to start solving this problem. Where should I start?
What is the grammar for $$\{ (n_a(w) - n_b(w)) mod\ 3 = 2 \} $$ please guide me with this. I tried to draw DFA to find grammar but I can't. any help is much appreciated.
Let MOD-INVERSE consist of all pairs $\langle N,c \rangle$ such that $c$ has an inverse modulo $N$. Let VERTEX-COVER consist of all pairs $\langle G,k \rangle$ such that $G$ is an undirected graph with a vertex cover of size $k$. Prove that if VERTEX-COVER reduces to MOD-INVERSE then P=NP**. My Thoughts : $\langle N,...
The original question I am answering: Can you use SAT solvers to solve problems complete in $\Sigma_2^P,\Pi_2^P,\Delta_2^P$? My first thought: Venn Diagrams show that the PH encloses NP, but does not equal NP. Therefore, there should be some problems that cannot be solvable using SAT? My second thought: To be able...
I am confused from these 2 true-false questions on the max flow and am seeking clarity on the basics. If in a network we increase the capacity of an edge in the minimum cut, the maximum flow gets increased. If in a network we decrease the capacity of an edge in a minimum cut, the maximum flow gets decreased. My thoug...
What is the algorithm to check if two DFA are disjoint? I want to know if there exist any string accepted by both automata.
Here is the video in question:https://www.youtube.com/watch?v=BpiMRyWoDu0&t=131s F(n) and g(n) are both equal to each other since they both have a time complexity of n^2 What's the point of applying the constant c to g(n) to make it 2n^2? What is this trying to show us? Additionally, why does the inequality include 'e...
Let the alphabet be {0,1}. Is it true that for every language over this alphabet at least one of L and L_complement is Turing-recognizable
In the paper linked below by Knuth and Bendix, theorem 1: The set of all pure words is well-ordered by the relation '$>$' has a proof that I can't seem to follow despite staring at it all day. I can't even decipher what the notation is trying to represent. So, we have four fixed sequences: An infinite sequence of va...
This is what I counted but I know I'm wrong since my conclusion is not in the choices: t = time unit s = space unit y=1 : 1t & 1s for 0 <= i <= N : Nt & 1s y=y*i : 2 reads, 1 write, 1 multiplication therefore 4 time units, the for loop is thus 4N time units total time = 4N+1 total space = 2 (because there are only tw...
There is this problem about pipelining that does not have an answer, and I'm wondering what the answer could be: In the five stage pipeline with forwarding support to EX, the first operand of ALU comes from 3-to-1 input multiplexer. As the memory latency increases, MEM stage now takes 2 cycles (from 1 cycle) To adjus...
After thinking for a bit, I am not able to prove a double inclusion proof for the following problem. It seems very interesting to me. Consider the regular expression $r= ((1(00)^∗1 + 0)1)^∗$ and the right-linear grammar $G= (\{S,A\},\{0,1\},S,P)$, where $P$ consists of the following rules: $S\rightarrow 1A|01S|\lambda...
I've been searching around google and this site and I haven't been able to find the answer to this. How are algebraic structures (like a set and its elements, groups, rings, etc.) defined in code (in any language)? Like, if I wanted to "do things" with an arbitrary ring, how would I go about constructing that ring?
If a problem is NP-complete with respect to randomized (polynomial time) reductions, but not with respect to deterministic reductions, then we have P $\neq$ BPP (See Question 2 here and its answer). Suppose a decision problem is proved to be NP-complete; and it is also proved to be DP-complete with respect to randomize...
I know that when we want to find out if Vertex Cover of size $k$ when $k \leq C$, belongs to P or not (when $C$ is some constant), we actually can find algorithm with polynomial time complexity (in the algorithm we iterate over subsets $V'$ such that $|V'|=C$). But what about $k \geq C$? I personally think it's not in...
I have written an assembly program to store digits in a stack. And to print the digits I have used loop2: mov ah,2 int 21h sub cl,1 jnz loop2 But this would only print them in reverse order as the SP is pointing to the last element, Now, I have a very simple yet very interesting question, I was very curious to know If...
I need some help with the following question. SHIP LOADING: Given items of weights $x_1,\dots,x_n$, ships of weight capacity $B$, can the items be loaded onto $C$ or fewer ships? (All numbers are positive integers, given in binary.) Show that SHIP LOADING is NP-complete. (Hint: reduce from SUBSET SUM, but go through a...
Let A be a PTAS algorithm with time complexity $O\left(\frac{1}{\epsilon}\right)$. Let $n$ be the input of the algorithm A. From Wikipedia: The running time of a PTAS is required to be polynomial in $n$ for every fixed $\epsilon$, but can be different for different $\epsilon$. Can we define $\epsilon$ to be equal to ...
Let's define a language $$C = \{ \{M_1, M_2\} \mid M_1, M_2 \text{ are TMs s.t. } L(M_1) \cap L(M_2) = \emptyset \}$$ We have to show that $C$ is unrecognizable. I am having trouble going on about with this proof. I am trying to do this by reduction, showing that this language is unrecognizable, but I am unsure on how ...
if we define $A_{TM}$ and $\overline{ A_{TM}}$ as follows: $$ \begin{align} A_{TM}&= \{ \langle M,w \rangle |M \text{ is a turing machine and $M$ accepts $w$} \}\\ \overline {A_{TM}}&= \{ \langle M,w \rangle |M \text{ is a turing machine and $M$ do not accepts $w$} \}\end{align} $$ $\overline{A_{TM}}$ and $\Sigma^*\bac...
I know that $L = \{a^lb^n c^m |l, n, m ∈ \mathcal{N}^+, (l ≥ n) ∨ (l ≥ m)\}$ is a context-free language, because I know the context-free grammar, i.e. $$ S \rightarrow AbZ \mid XBc \\ A \rightarrow aAb \mid X \\ B \rightarrow aBc \mid Y \\ X \rightarrow aX \mid a \\ Y \rightarrow bY \mid b \\ Z \rightarrow cZ \mid c $$...
I am wondering what generic example there is so that an NFA with n states results into a DFA with $2^n$ states after the conversion by the subset construction. I know there is the example by Hopcroft et al. where the resulting DFA has $2^{n-1}$ states but I am looking for a result with exactly 2^n states. Thanks in adv...
Consider the the binary erasure channel, with input and output alphabet $\{0,?,1\}$ and channel matrix \begin{bmatrix} 1-\lambda-\mu & \mu & \lambda\\ 0 & 1 & 0\\ \lambda & \mu & 1-\lambda-\mu \end{bmatrix} I want to determine its capacity, i.e. maximize $I(X;Y)$ over the probabilities distribution of the input. I have...
I’m struggling to understand how $T(N)=C_1 \times N + C_2$ was derived Assuming $C_1$ refers to l <- 0, and $C_2$ refers to return l Shouldn’t it total $T(N)= C_1 + (N + 1) + N + C_2$, which simplifies to $T(N)= C_1 + 2N + 1 + C_2$ ?
Hey I'm trying to prove that the following Language is regular so far couldn't find a way, hope someone can help me $L^{\prime}=\{x \# y \mid x y \in L, y x \notin L\}$ where $L$ is regular.
I don't understand very well section 16.5 of the 3rd edition of the famous Introduction to Algorithms book, known as CLRS. It defines the problem of scheduling unit-time tasks with deadlines and penalties for a single processor with the following inputs: a set $S = {a_{1}, a_{2}, ..., a_{n}}$ of $n$ unit-time tasks a ...
If deterministic context-free languages (DCFLs) are not closed under intersection, does this mean that the intersection of two DCFLs will always be context free but may not be deterministic? Or does it mean their intersection may not be context-free?
Say there is a set of m·N named elements. How to produce all the (unordered) combinations of N-sized subsets? For example, m=2 and N=2, the elements are called A, B, C and D. There will be 3 combinations: AB+CD, AC+BD and AD+BC. For m=2 and N=3 there will be 10 combinations. In general, it will be: $$\frac{(mN)!}{(N!)^...
In my work, I meet a process for DAG, and need to explain it in my report. So, I would like to know the name of the process. The process is very simple. The vertices of degree two except roots and leaves are replaced to the new edge between the parent and child vertices. This process is almost the same to what this li...
In this article about the recent breakthough in Matrix Multiplication, it quotes Chris Umans's words: Multiplications are everything. The exponent on the eventual running time is fully dependent only on the number of multiplications. The additions sort of disappear. I was wondering how I should understand this. Why t...
I am trying to prove the first assertion in the following code, taken from notes of Damon Wischik: def dijkstra(g, s): for v in g.vertices: v.distance = ∞ s.distance = 0 toexplore = PriorityQueue([s], sortkey = lambda v: v.distance) while not toexplore.isempty(): v = toexplore.popmin(...
I was watch this lecture https://youtu.be/moPtwq_cVH8?t=2895, and at this point he says a lot about reductions, take a problem and reduce to another problem. From what I could understand this is a symmetric relation, if I can reduce A to B, then I can reduce B to A. This seems pretty intuitive to me but I don't have a ...
Define the inversion of a binary tree as the tree whose left sub-tree is a mirror reflection of the original tree's right sub-tree around the center and right sub-tree a mirror reflection of the original tree's left sub-tree. Examples: Inversion 1 Inversion 2 C | C C | C / \ ...
For two languages over the same alphabet, if neither of them is context-free, can their union still be context-free? If not, does one of the languages need to be context-free for this to happen? Do both need to be context-free?
Please note that this question is different than this question. The $k$-disjoint triangles problem is as follows: Input: A graph $G=(V,E)$ and an integer $k\in \mathbb{N}$ Output: Are there $k$ vertex-disjoint triangles in $G$? An FPT algorithm is presented here (starting from slide 60). The algorithm uses color-codi...
The problem. Given an undirected, connected, edge-weighted graph $G=(V, E_G; w)$ and a minimum spanning tree (MST) $T=(V, E_T)$ of $G$, the MST sensitivity analysis problem asks to find, for each edge $f \in E_T$, the increase between the total weight $\sum_{e \in E_T} w(e)$ of $T$ and the total weight of a MST of $G-...
Let's say I have : a Graph g v vertices. Each vertex is associated to a cost c. A special vertex called the starter vertex or vs. I want to find the path p of length 10 (for example), that start from vs and that maximize the sum of the 10 seens nodes costs. I need to tell you that my graph represent a road network wh...
what do the tape contents of Turing machine look like after halting? Are there empty symbols after the qaccept or reject?
For two languages over the same alphabet that are not context-free, can their intersection be context-free, Or does at least one of them have to be context-free?
Wikipedia: The existence of such one-way functions... would prove that the complexity classes P and NP are not equal. How is this proved?
I'm supposed to write grammar for this language: $$L=\{a^{i+1}b^{i}c^{2j}d^je^{2j}\mid i,j>0\}$$ This is what I have so far: $$\begin{align} S &\to aXbY \; \\ X &\to aXb \;|\; a \\ Y &\to ccYdE \;|\; ccdE \\ Ed &\to dE \; \\ dE &\to dee \; \\ eE &\to eee \; \\ \end{align}$$ Edit: Thank you for answers, I looked at the ...
I need to prove or disprove the following claim: Given that the best case complexity of the algorithm A is $O(f(n))$ and the worst case complexity of A is $Ω(g(n))$, it follows that $f(n) ∈ Ω(g(n))$. I know that obviously $A_b \leq A_w$. I can also conclude obviously that for constants $c_1 , c_2$ and for all $n_0 \l...
Let's consider 128-bit LCG with modulus $2^n$ of the form: $X_{n+1}=a \cdot X_{n} + c \mod 2^{128}$ How fast we can run it in cycles per byte? And how much of RAM it required?
I was reviewing for my CS class and came across this question and answer combo that didn't have any explanation why it was correct. I'm confused on how they got the answer: We have a system to which we can instantaneously add and remove cores -- adding more cores never leads to slowdown from things like false sharing,...
I am beginning with my masters degree in mathematics and I will specialize in optimization theory. My minor is computer science and wanted to know which branch of computer science fits my specialization(optimization theory) the best. I know that machine learning involves some optimization theory (I don't know how much ...
Consider this algorithm iterating over $2$ arrays $(A$ and $B)$ size of $ A = n$ size of $ B = m$ Please note that $m \leq n$ The algorithm is as follows for every value in A: // code for every value in B: // code The time complexity of this algorithm is $O(n+m)$ But given that $m$ is strictly lesser than or ...
I was just wondering why are are new generation microprocessors faster at the same clock speed as the old ones. For instance a 2.66Ghz dual core i5 is faster than the a device with clock speed of 2.66Ghz but core 2 dual.
Two undirected graphs $G$ and $H$ on the vertices $1,2,\ldots,n$ are disjoint if the intersection of their edge sets is empty. Assume both $G$ and $H$ are represented by adjacency matrices. Describe an efficient algorithm that decides if $G$ and $H$ are disjoint. What is the complexity of your algorithm? J...
This is the pseudocode I used: Their calculation seems to be different from mine. Can someone explain how they derived it? Here is mine in comparison: Line 1: $c_1 \cdot (n-1)$ Line 2: $c_2 \cdot (n-1)$ Line 3: $c_3 \cdot n $ Lines 5-6: $c_4 \cdot \frac{n(n-1)}{2}$ (the if statement executes with an arithmetic progre...
I have a model counting program bob. On some graph coloring formulas, bob got the right answer only after removing clause learning. That is to say, with clause learning, bob sometimes counts duplicate solutions, while satisfiability remains stable. This would be big news if true.
In type theory, all computable functions must terminate, however, numbers like Pi are non-terminating real numbers, hence a non-terminating function is required to compute this number, even though one would never compute the full sequence. How does type theory view/deal with such non-terminating numbers/object?
I have an instance linear programming such that the coefficients and the constant terms are 0 or 1. Formally, the set of variables is denoted as $V$ and $|V| = n$. There are $m$ constraints, formed as $$ \mathbf{a}_{1}^{\top} \mathbf{v} \leq 1 $$ or $$ \mathbf{a}_{2}^{\top} \mathbf{v} \geq 1 $$ where $\mathbf{a}_{1}, \...
Leslie Lamport claims that TLA+ is too complex to be described in BNF. Does that mean TLA+ is not a context free language? What is the relationship between the set of context free languages and the set of languages that can be described by BNF grammars?
I meet a problem but when I google, there are all Hamiltonian Path Problem: How to find a path to visit every node in directed graph(not necessarily once)? This problem is different from Hamiltonian Path. For example: 1 --> 2 --> 3 ↔ 4 ↕ 5 I have a path $1\rightarrow 2\rightarrow3\rightarr...
I was going through the text Computer Networking- A Top-Down Approach by Kurose and Ross, there I found subtleties with the TCP congestion control FSM which is shown below: Mainly I am having difficulty in understanding the action transmit new segment(s), as allowed and transition to the Fast Recovery state. I have ...
The Problem: Say that a language is prefix-closed if all prefixes of every string in the language are also in the language. Let C be an infinite, prefix-closed, context-free language. Show that C contains an infinite regular subset. Can we show this by using Myhill-Nerode Theorem?
Given a regular language $L$ over the alphabet $\Sigma = \{a,b,c,d\}$, is the language $\mathrm{Perm}(L)$ consisting of all permutations of words in $L$ also regular? My intuition says it is, since each word in $L$ only has finitely many permutations, but I don't know how to prove it. Any help would be great.
I need to construct a TM that converts a number from binary notation to unary and calculate time complexity.  I have done the first part. The idea is as follows: binary number is decremented by 1 until it reaches 0. At each decrement an additional 1 is written on the left side. e.g. 111 -> 1111111 111x (TM goes to t...
Remove any 5 elements from a sorted array of n items and replace them with 5 new elements. Why does running Insertion sort again on this array take linear O(n) time, I tried counting the number of swaps when running Insertion sort again, and noticed every element is shifted by at most 5 places(not sure why), I cannot g...
I think the empty language is NP but I'm not sure if it is NP-Complete
I am studying Crafting Interpreters, and although I understand the responsibility of the Scanner (or Lexer), I still cannot understand if it is a deterministic finite automaton or non-deterministic finite automaton. The code responsible for scanning the input text in the book is: private void scanToken() { ...
My question is about the paper Three is Better than One Ensembling Math Information Retrieval Systems (a system used for math information retrieval - both for finding answers and formula search)(code on github). Before the questions, the following figures illustrates: CompuBERT (taken from Three is Better than One Ense...
I am trying to prove the following claim: Given DAG graph, there is Hamilton path iff the following algorithm returns true: Do topologic sorting. Move on the graph's vertices one by one (from low to high). In case there is no edge connecting 2 vertices with adjacent values from the topologic sorting then return fals...
Working with a question that states: Consider a hypothetical machine in which physical address space is of 512 words and virtual address space is of 2048 words. The page size is 8 words. What is number of bits used for: Page offset, Physical Page Number, Virtual Page Number Since my course uses MIPS, I'm assuming the...
I'm a bit confused by Wikipedia's tables of algorithms for the shortest path problem. For an unweighted graph with $E$ edges and $V$ vertices, it gives the best algorithm as breadth-first search, with a time complexity of $O(V+E)$. But above that, for an undirected graph with natural-number weights, it gives the best a...
I'm working on Algorithm Design (Kleinberg-Tardos) Chapter 1 exercise 7: Some of your friends are working for CluNet, a builder of large communication networks, and they are looking at algorithms for switching in a particular type of input/output crossbar. Here is the setup. There are n input wires and n output wires,...
I'm trying to understand how the construction of simple grammars works. In my textbook, there's the following example I am supposed to find a grammar for: Let $L_1= \{a^n b^n c^m d^m \mid n \geq 1, m \geq 0\}$ be a language over the alphabet $\Sigma = \{a,b,c,d\}$. Find a grammar $G = (\Sigma, N, S, P)$ - where $N$ de...
I've got a question about how best to classify the performance of an approximate algorithm. I'm trying to find the 'correct' value of a graph problem instance whose cost function has an objective function and a penalty function. I've configured my method such that the optimum solution of the problem has the highest val...
Condidering the proof, NLOGSPACE$\subset$PSPACE I wrote following proof: NLOGSPACE = NSPACE$(\log n)$ $\hspace{15pt} \because$ Definition of NLOGSPACE NSPACE$(\log n)$ $\subseteq$ DSPACE$(\log^2 n)$ $\hspace{15pt} \because$ Theorem(1) We let $m = \log n$, then, DSPACE$(m^2)$ $\subset$PSPACE $\hspace{15pt} \because$ Def...
Consider the language $$L = \{w \mid w \text{ has an unequal number of a’s and b’s}\}$$ where Σ = {a, b}. Prove that L is not regular. Hint: Try proof by contradiction. Would this be the right Answer: L = {a^m b^n | m < n} U {a^m b^n | m > n} Looking at this we can tell that a is more than b or a is less than b. They d...