instruction
stringlengths
35
29.1k
I have a method Func() that has two inner methods Func1() and Func2(). Func1() has a running time of $O(k\lvert M^2 \rvert (\lvert L \rvert +\lvert M \rvert \log \lvert M \rvert))$ and Func2() has a running time of $O(k \lvert K \rvert \lvert V\rvert)$. What is the running time of Func()? Is it $\max \{ O(k\lvert M^...
Does anyone know how many solutions there are for a XOR-SAT formula? And how do the variables in solutions distribute? For example, if (x0=1, x1=0, x2=1) is a solution for a XOR-SAT formula, how does x0 distribute in different solutions? Thanks!
Let me define a volatile graph first: It is an undirected graph in which the weight of each edge varies every time we query it. That is, when we request the weight w(e) of edge e, we obtain an approximate value ˆw(e) defined as follows: wˆ(e) = w(e) + η, where η ∼ N (0, σ). Here, N (0, σ) is a Gaussian distribution wit...
I have always read that Turing machines can simulate any algorithm, without changing the time complexity of the algorithm, and hence it is easier to study the Turing machine equivalent of the algorithm while doing proofs. However, I am unable to find a proof for this statement. Is there a formal proof of why the Turin...
In a communication link out of p packets one packet will be lost. If stop and wait protocol is used then expected number of retransmissions for a packet? (A) P/(1-P) (B) P (C) 1/(1-P) (D) 1/P I am getting option a) as answer. Anyway to solve this?
How to show that the following language is not regular with the pumping lemma? $$L=\left\{0^{n\lceil\log_2 n\rceil} \,\middle|\, n\in \mathbb{N}-\{0\}\right\}.$$
i have an arbitrary "reshaping" function which, given a linear sequential array can "reshape" it to 2D or 3D. the order in which the X-dimension, Y-dimension and Z-dimension may all be changed, as well as the size of the X, Y and Z dimensions, may all be changed, at runtime. consequently it is not possible to use sta...
Let $f:\mathbb{N} \to \mathbb{N}$ be a computable partial functions and $T$ a Turing Machine which computes it. By this I understand that $T$ writes $f(n)$ on its tape and halts when $n$ is an input on which $f$ is defined. But then what should $T$ do on inputs from $\mathbb{N}$ for which $f$ is undefined, and what sho...
I am given the following grammar: $ S \rightarrow AabAba \\ A \rightarrow a | \epsilon $ and I have to prove it is LL(2). I know what LL(k) means - one can choose a production based on k characters from the input. So consider the input $ababa$. Of course we start with $S$, so we apply the production to $AabAba$. Now we...
Given two sets of elements S and R, with p elements and q elements respectively. 1 <= p,q <= n. Now, the number of ways to choose same number of elements from set S and R is $$\sum_{i=0}^{\min(p, q)} pCi * qCi$$. I want to calculate the result for all possible combinations of p and q. I can think of a O(n^3) solution b...
I just started learning about circuits in Chapter 6 of "Computational Complexity". There is an emphasis on the fact this model of computation allows different circuits for different input sizes of the problem. The authors refer to this as a nonuniform model of computation. My question is: why do we need to use circuits...
I need to create a HDL which will use logic gates to demonstrate if something is a negative number in two's complement. The input is 8 bits, while the output is 1 bit, and if the input is a negative number then the output should be true, and in any other case, the output should be false. I've noticed that all the negat...
I'm having issues using the pumping lemma to prove $L_2 = \{a^ib^j \mid i > j \}$ is non-regular. It's obvious to know that the language is non-regular as there is no way of tracking $a^{i's}$ and $b^{j's}$ So I've done some digging. On page 2 here I found a proof. However, it doesn't make sense to me. Here is the pr...
So the question is to convert the following expression to postfix: (a+b)^(p+q)^(r*s*t) The answer I get when I calculate is: ab+pq+^rs*t*^ But the answer is given to be ab+pq+rs*t*^^ I assume that the step when you need to push second '^' into stack when there is already a '^' in the stack is where I went wrong (I pop...
Let say we have a relation with 5 attributes {A, B, C, D, E}. Let say we have two candidate keys as A and B,C. Let us say we have a partial dependency as B -> E with regards to the candidate key B,C. The database designer decides that A will be the primary key of the relation. Now since we had B -> E, will it be called...
I'm trying to prove, that the following statements are either true or false. Unfortunately, I'm having a hard time finding formal proofs for my answers. I hope you can help me out a bit. Let $A,B$ be two subsets of $\{0,1\}^*$ If $A$ is regular pumpable and $B \subseteq A$, then B is regular pumpable too. If $A$ not ...
I want to minimize DNF formula which has ~200k products combined into a sum. The depth of that formula is 2 - first level is the OR, and second level is AND for all conjunctions. I have tried using the Espresso program to minimize it, but it only reduces the number of products from 200k to 50k. Espresso still retains t...
Assume a regular language contains all the strings that are ended with "01". We can draw the following DFA for it: And I reversed the DFA according to this answer (designing a DFA and the reverse of it) I expected this DFA to accept all strings that start with "10" but it is not. What is my mistake in drawing the rev...
Suppose $ R $ is a regular language, let $ f(R) = \{ w \mid \exists x \text{ such that } |x| = f(|w|) \land wx \in R\}$, prove that $ f(R) $ is regular for $ f(n) = 2^n $ and for $ f(n) = n^2$. I've been on this question for a while now, and I'm not really sure how to approach it. I only really know elementary techniqu...
$S$ is a subset of the class of all recursively enumerable languages over some finite symbols then $S$ is recursively enumerable iff If $L$ is in $S$ and $L'$ is a language such that $L ⊆ L'$ and $L'$ is recursively enumerable, then $L'$ is in $S$ If $L$ is an infinite language in $S$, then there exists at least one f...
Assume a Forth-like environment with two stacks, a main one and an auxiliary one. The following operations can be done on the main stack: DUP (duplicate the top element), SWAP (swap the top two elements), DROP (drop the top value), PUSH (move the top value to the auxiliary stack) and PULL (move the top value of the aux...
I read somewhere that given two languages $A$ and $B$, if $A \le_{\log} B$, then $A \le_P B$ (with $\le_{\log}$ the log-space reduction and $\le_P$ the polynomial time reduction), but I'm not sure about the proof. Could someone help me with that please.
I want to develop a genetic program that can solve generic problems like surviving in a computer game. Since this is for fun/education I do not want to use existing libraries. I came up with the following idea: The input is an array of $N$ integers. The genetic program consists of up to $N$ ASTs, each of which takes in...
We have seen various languages proven to be outside of REG and CFL by corresponding pumping lemmas. Has something similar been done for SAT?
How to prove that given convex sets A and B, the erosion of A by B will result in C - a convex set, too? I was given this question as a test-preparation, and I think it shuold be a proof, but I don't know how to prove it. A convex set is a set where every line connecting 2 dots in the set, must be part of the set, too....
CLRS gives the following implementation for a queue's enqueue and dequeue operations head = 1 tail = 1 ENQUEUE(Q, x) Q[Q.tail] = x if Q.tail == Q.length Q.tail = 1 else Q.tail = Q.tail + 1 DEQUEUE(Q) x = Q[Q.head] if Q.head == Q.length Q.head = 1 else Q.head = Q.head + 1 return x but I'm having trouble under...
I understand that a 64-bit processor can hold a 64-bit long address and that a 64-bit address can represent $2^{64}$ different values. But I don't understand why that processor can address $2^{64}$ different locations in memory at one time and thus process billions of billions of GB at a time (theoretically). I haven'...
This is a HW question, so I'm not expecting any answers, just a general guidance/help. Definition. Given $\underset{\neq0}{\underbrace{s}}\in\left\{ 0,1\right\} ^{n}$, a function $f:\left\{ 0,1\right\} ^{n}\to\left\{ 0,1\right\} ^{n}$ will be called s-difference-preserving if for all $x,y\in\left\{ 0,1\right\} ^{n}$ s...
Consider the following CFG: $S\to AED | F \\ A \to Aa | a\\ B \to Bb | b\\ C \to Cc | c\\ D \to Dd | d\\ E \to bEc | bc\\ F \to aFd | BC$ The CFG produces $a^*bbb...ccc...d^*$ (equal number of b,c) and $aaa...b^*c^*ddd...$ (equal number of a,d) There is ambiguity since $abbccd$ can be derived respectively by $S\to A...
I'm trying to create a formal algorithm in order to determine whether two given regular expressions $a$, $a'$ define identical/equal or unequal languages and if those languages are subsets of each other? (I'm not sure if following thoughts are correct and formal enough and I'm glad if you spot mistakes and improv...
I am working on the following problem- "Finding the matching among all possible matching such that the sum of edge weight is minimum in the matching." Please note that I like to search over all possible matching (that includes maximum matching and other matchings as well). As per my knowledge, Hungarian algorithm searc...
I cannot seem to find a precise definition of what "super-exponential" is supposed to refer to when one's talking about an algorithm's time complexity. For instance, if an algorithm runs for $nC(n-1)$ steps, where $C(\cdot)$ is the Catalan number, is this algorithm super-exponential in $n$?
I am watching this video (https://www.youtube.com/watch?v=aZjYr87r1b8) and up to the ~6 minute mark, he explains the disk structure and how when you want to read a block, the spinner spins to the correct sector and the arm to the correct track. How do the spinner know where the correct sector is? How does the arm know ...
So this was an interview question I had a few weeks back that I just haven't been able to think of how to solve... Given a random number generator that returns 0 or 1 with a 50% chance of either, describe how you would implement a function that returns 1 with a probability $p$ and 0 with a probability $1-p$ So you c...
I understand intuitively why the pumping lemma for regular languages must hold. That is to recognize a infinite string with a finite amount of states you must repeat states and you can "pump" those repeated states as many times as you wish. However for the context free language version I can't seem to come up with the...
Given an undirected graph $G(V,E)$, our problem asks whether $G$ contains $2$ simple cycles which differ by $1$ in length. What is the complexity of this problem?
It should be obvious that a Turing machine is capable of computing the sum of two integers. However, what is the simplest automaton that can compute the sum of two integers of arbitrary length? I have a proof scratch that the automaton in question should be no more complex than a non-deterministic PDA: Let addition be ...
I came across this question while studying for an exam: T/F: Suppose we can show for some fixed $k$, an NP-complete problem P has a time $O(n^k)$ algorithm. Then every problem in NP has a $O(n^k)$ time algorithm. I think the answer is false, since we can't reduce NP-complete to NP-hard in linear time, right? Or am I ...
The title was difficult to formulate (I am open to suggestions). Two things bug me about this: "is almost any" is imprecise, which goes against Volume 1's statement on definiteness. When he writes, "in other words", this means Prof. Knuth explained it to me in two ways and I still do not understand it. What is going ...
If so, what are the similarities and differences between the two? I’ve only worked with properties while programming.
Let \begin{align*} &P=2^{\log_2 N}\\ &\Rightarrow \log_2 P = \log_2 N\\ &\Rightarrow P=N\\ &\Rightarrow 2^{\log_2 N}=N\,. \end{align*} I don't understand how can you just drop the logs and go straight to $P = N$. Can someone please explain this to me? Am I missing a log rule?
How could you prove: An edge (u,v) is part of an undirected graph G. If post(u) $<$ post(v) (i.e. the post number of u is smaller than that of v) then it implies that v is an ancestor of u in the DFS tree. So far I have understood that it does in fact imply that so I need to prove this. I have thought of doing it by ...
I have a simple question. In signal encoding we have B8ZS (Bipolar with 8 zeros substitutions) technique which encodes every 8 sequencial 0 bits with 000+-0-+ or 000-+0-+ depends on previous voltage level. Can we do this with 7 seven bits like 0+-+0-+- and 0-+-0+-+ in order to decrease number of 0s and to prevent from ...
Flynn's taxonomy contains three interesting computer architectures: SISD, SIMD, MIMD. For the SISD architecture, we have RAM computational model that simulate real SISD systems very well; For the MIMD architecture, there is PRAM computation model that is capable to highlight main benefits of the parallel processing u...
So I watched a couple of videos regarding this and the divide and conquer made sense to me. But I am still not convinced as to how recursing on the side with the larger number guarantees us the solution. Please can someone explain it Mathematically.
What is the first problem that was demonstrated to be NP-Complete?
In this link https://techdifferences.com/difference-between-bubble-sort-and-selection-sort.html it says that the best case of bubble sort is order of n due to the fact that there would be only comparisons and no swaps in the inner loop. But is that correct? Are comparisons not counted in the complexity ? Only swaps? ...
I have got a confusion in PCA: Is the concept of weight same as Eigenvalues as discussed in the research paper Eigenfaces for Recognition by Matthew Turk and Alex Pentland: efficient way to learn and recognize faces would be to build up the characteristic features by experience over time and recognize particular face...
There's a famous question posted on this site which asks about finding the $k$th largest element. Many answers are written there which optimized it and found algorithms with expectation of $O(n)$. The thing I don't understand is.... Those algorithms wouldn't work if $k$ is dependent on $N$. Therefore $k$ must be a co...
Shapes Let $C$ be the unit hypercube in $\mathbb{R}^{n}$. Let $\vec{o}$ be a point in $\mathbb{R}^{n}$. Let $B$ be a $n \times m$ matrix. The columns of $B$ are a set of linearly independent vectors in $\mathbb{R}^{n}$. $m \le n$ $n$ is about 15 to 20. Let $O$ be a $m$ dimensional coordinate with columns of $B$ as axe...
Having the alphabet $\{a, b\}$, how can I generate a regular expression for the language that does not have substring of three or more consecutive same symbol? For example, I can't have ${baaab}$ nor ${abbba}$, but I can have ${abbaabba}$.
I've constructed an algorithm on (rooted) binary trees, where the running time at a node depends on the size of its smaller subtree, where we compute from each leaf upwards towards the root. More specifically, at each node, a constant amount of time is required for each node in the smallest of its 2 subtrees. The runni...
Let's say I have a program P, in form of a binary code for x86 architecture. I want to find a Boolean formula F (in form of CNF, or something like that), such that F(input,output) = true iff P(input) = output So to answer a question "what output does the program produce on given input" I will only need to run a SAT/...
I was reading a paper about a transposition and single deletion error correcting code and they claim that the redundancy of the code was only $\log(6n-3)$ bits. But what does that means? I was trying to get that from the proof of that fact but what they proved instead was that there exists a such (with the structure...
I am studying PCA. I have a problem in understanding the following concept: What is meant by transforming "correlated attributes into a set of values of uncorrelated attributes" in Principal Component Analysis? Principal Component Analysis (PCA) is a mathematical procedure that uses an orthogonal transformation to con...
My question concerns link/cut tree structure after an access operation. I am assuming an implementation with splay trees. As far as I can tell, once you access a node v and splay it to the root, it no longer has a preferred child and therefore no longer has a right sub-tree. Furthermore, you move this tree up to the ro...
I'm trying to understand this paper on computer vision (http://persci.mit.edu/pub_pdfs/elements91.pdf) and it talks about building a periodic table of things we can get from the plenoptic function. It says that by taking the partial derivative of it with respect to x you can get "vertical "edge"" but I have no idea wha...
So I am working on a question that requires me to find the linear address. Here's some information: Main memory size is 8GB, which translates to $2^{3} * 2^{30} = 2^{33}$. Block size is 16KB each, which translates to $2^{4} * 2^{10} = 2^{14}$. I was then required to find: (i) The number of blocks in main memory: $2^...
Please let know if this is not the correct forum to ask this question. If not can anyone please tell where can I ask this question? I am trying to understand the difference between the paper : https://pdfs.semanticscholar.org/59ee/e096b49d66f39891eb88a6c84cc89acba12d.pdf and the paper http://users.cecs.anu.edu.au/~will...
Let $G$ be an arbitrary graph with $n$ vertices and we want to find a simple cycle with $\log n$ length. Is there exists a known polynomial algorithm for this problem?
Given is a undirected and 1-connected graph G=(V,E). Between every two node b=(u,v) in graph G there is a cost c_b to build another edge(Regardless of whether (u,v) ∈E or not). We use a C={c_b |c_b∈Z^+,b∈V×V} to represent costs between every node regardless of whether (u,v) ∈E or not. Now, we want to add some edges M⊂E...
In a CS theory class I'm taking, we showed Halts was undecidable via a diagonalization argument. All other undecidable problems we looked at we either got by reducing Halts to them, or some chain of reductions that started with Halts. Are there any undecidable languages which Halts does not reduce to?
Let $S = \{ ⟨M,q⟩ | (\exists x) M $ reaches state $q$ when running $M$ on $x$$\}$, where ⟨M,q⟩ is coded TM M and state q. To prove that $S$ is semi-decidable, I've tried to use the equivalence: Language $L$ over alphabet $\Sigma $ is semi-decidable $ \iff $ There exists a semi-decidable language $M$, such that $L = \...
I'm interested in how the computer registers got their names, for example: eax and ebx. I couldn't find anything.
I've been reading about building Turing machines for specific purposes, and some sources talk about input encodings and some talk about programming specific machines, but I've been unable to find anything that discusses both. Here's a specific set-up: Suppose you have a universal Turing machine. It has a two-sided inf...
Given I have a $n$ dimensional $\vec{a}$. All elements of $\vec{a}$ are between 0 and a positive number $K$. $n$ is about 15 to 20. Problem I want to randomly and unbiasedly choose a vector $\vec{b}$ such that: Elements of $\vec{b}$ are between 0 and 1. $\vec{a} \cdot \vec{b} = 1$ How to do that? Attempt I thought ...
I'm supposed to prove this through mapping reducibility. I think I'm supposed to show that $A_{\mathrm{TM}} \le_\mathrm{m}\overline{L}$, which means that $\overline{A_{\mathrm{TM}}}\le_\mathrm{m} L$ and, since $\overline{A_{\mathrm{TM}}}$ is not Turing-recognizable, then $L$ is not Turing-recognizable. I think that $\o...
Uniform sampling over a $n$-dimensional standard simplex is described here: Uniform sampling from a simplex I want to sample one point from a non-standard simplex with vertices at: $s_{i}\vec{e_{i}}$, where $\vec{e_{i}}$ is the $i^{th}$ vector in the standard basis, and $s_{i} \ge 0$. the origin is : $\vec{0}$ How to...
I was wondering what is the most efficient algorithm to solve something like the following: You have $P$ people. You have $T$ tasks, each of which is a set of sets that represent all of the possible sets of people that could be used to complete the task. What is the minimum set of people required to complete all of the...
Let $\mathbb{F}_p$ be a finite field of prime order $p$. Define $r_q : \mathbb{F}_p \to \mathbb{F}_p$ as $r_q (x) = x \bmod q$ with $q<p$. A tad more formally, treat $x$ as an integer in $[0, p)$ and then perform the modular reduction mod $q$. For example, with $p = 5$ and $q=3$, we have: $$0 \mapsto 0$$ $$1 \mapsto 1$...
There is an undirected graph and some of the vertices are said to be stores. Person A wants to reach to person B with a present. That means person A has to stop by one of the vertices marked as stores and get the present first before ever reaching to person B. Moreover, each store has a specific waiting time, and if th...
Take the nearest neighbor algorithm for the traveling salesman problem as an example. Why is it used to find the upper bound? When can't it guarantee an optimal solution? (Thanks to many comments below, which suggest (and are invalidated by) the last update of this question)
What is the regular expression for the following language? $$L = \{acbc: a,b,c \in \{0,1\}^+ \}$$ maybe we can say $$L = ((0 + 1)^+ 0 (0 + 1)^+ 0) + ((0 + 1)^+ 1 (0 + 1)^+ 1)$$ Is it true??
Consider the following image: The problem is: can we cover the bigger rectangle with small rectangles such that no two rectangles overlap and no gap opens up? Prove that this problem is $NP-Hard$. I know that to prove that it is $NP-hard$, I must reduce a $NPC$ problem to it. However, I guess that the problem is not $...
Is there a standard name for the following algorithm? At each step, the code picks an index, remove the object at that index, and remember to never pick that index again. See the following illustration: Others have suggested the Fisher–Yates shuffle, but it seems like this algorithm is simpler. I found this algorit...
I translated the following $\lambda$-term: $z(\lambda b.ba)(tt)(\lambda y.y)$ in the following CL formula: $z(CIa)(tt)I$ through the Markov algorithm. Now I'd like to prove the translation was correct, and I know that's done by applying arguments to such CL formula and execute each constant by its rule. If I apply it t...
In chapter 4 of Jeffrey Shallit's A Second Course in Automata Theory the following problem is formulated as open: Let $p(n)$ be a polynomial with rational coefficients such that $p(n) \in \mathbb{N}$ for all $n \in \mathbb{N}$. Prove or disprove that the language of the base-k representations of all integers in $\{p(n)...
Show that $R^{+} \equiv R \leftrightarrow L(RR) \subset L(R)$ sigma is any alphabet. R is a regular expression. How can L(RR) even be a subset or equal to L(R)?
$L=\{\left<M\right> \ | \ M $ is a TM s.t. $M$ does not accept any string starting with a '1' $\}$. Assume the alphabet to be $\Sigma = \{0,1\}$. By Rice's theorem $L$ is undecidable. I managed to "prove" that $L$ is decidable. So can someone point out the error in my proof. To keep things clean I ignore the empty...
Do one have to define the upper and lower bound to be able to solve the tsp, or is that just an unnecessary intermediate step? And if so, why would one define those bounds? (context: the traveling salesman problem (TSP)) Additional question: After having calculated the upper bound (using eg. the Nearest Neighboor algo...
Is there a small-memory way to estimate how many unique strings have been encountered without needing to know the strings themselves? The trick is that we only have a tiny amount of memory to track what strings we have seen. Tiny like a 64 bit integer or 64 byte string. (The EZ infinite-memory solution is to keep a h...
Let $f$ be a continuous function and $[a,b]$ be an interval where $f(c)=0$ for some unique number $c \in [a,b]$ and where $f(a) f(b) \leq 0$. Suppose there exists a sub-interval $[a_0,b_0]\subset [a,b]$ so that $c \in [a_0,b_0]$ and some other function $g$ such that $g(x_1)=g(x_2)$ for all $x_1, x_2 \in [a_0, b_0]$. Al...
Suppose we have $n$ different summands. Is it possible to get the sum x with a maximum of two of the $n$ summands (Below the m summands there can be several times the same one). For example you have the summands (2,4,6,7). So its possible to get the sum $2+4 =6$,$6=6$ but its impossible to get the sum $3$ or $1$ ect. M...
Given two sequences $a$ and $b$, find largest $x$ such that in $a$ there is substring $A$ and substring $B$ in $b$ meeting those conditions: length of both $A$ and $B$ is equal to $x$; sum of elements in $A$ has the same parity as sum of elements in $B$. Lengths of $a$ and $b$ are up to $5\times10^5$, so simple $O(n^...
How many boolean functions exist that satisfy the following condition? $$\neg f(x_1,x_2,x_3,....,x_n) = f(\neg x_1, \neg x_2,...,\neg x_n)$$
I originally posted this on math.stackexchange, but then deleted it and moved it here since I think it would fit this site more. I saw a claim in a slideshow from a basic computer architecture course that given some boolean operator $T(x_1,...,x_n)$, if it is universal then necessarily: $$T(x,...,x)=\neg x$$ However, I...
How could you design an efficient algorithm that uses the least amount of memory space and outputs, in ascending order, the list of integers in the range 0..255 that are not in a randomly generated list of 100 integers? The aim is to output the number of such integers, and determine if the randomly generated list of 10...
Full question: Numbers of the form $a+b\sqrt{q}$, where $a$ and $b$ are nonnegative integers, and $q$ is an integer which is not he square of another integer, have special properties, e.g. they are closed under addition and multiplication. For $q=2$, some of the first few numbers of this form are given: $0 + 0\sqrt{2},...
Following is a Question from a competitive exam, it is given that the solution is A but I don’t know why the dead state 4 is not eliminated.Dead states like 4 which has transitions only to itself, should be eliminated right? UPDATE: My solution to the question in the comment
I'm studying Quick-Sort and I am confused as to how it works when the first element is chosen as the pivot point. I am trying to trace the first step in the Quick-Sort algorithm, to move the pivot S[1] (17) into its appropriate position. Example: [17, -10, 7, 19, 21, 23, -13, 31, 59]. ^# = pivot ^ pointer My underst...
I am given a homework assignment on this question: Show that if we add any number of incoming arcs, with any capacities, to the source node, the maximum flow value remains unchanged. Similarly, show that if we add any number of outgoing arcs, with any capacities, at the sink node, the maximum flow value remains unchan...
I understand the concept behind for and do/while loops, but I am trying to understand what is happening at the hardware level that allows a loop to run infinitely. Technically wouldn't it have to stop at some point because there are only a couple billion transistors in a microprocessor? Maybe my logic is off.
The question asks to provide an algorithm to compute $(i)$ The product of $n$-bit numbers using reciprocation operation and addition operation but not using multiplication and squaring. $(ii)$ The square of a polynomial of degree $n−1$ using only reciprocation and addition operation but not using multiplication and sq...
I'm trying to understand this claim. I see that if there are $S$ vertices, then we can identify each vertex using $\log S$ bits. Now each vertex can be connected to, let's say, $S$ other ones (is there some sort of restriction to the fan-out that I'm unaware of?). If we use an adjacency list, then for each vertex, we w...
I just read this definition for the longest path problem: LONGEST PATH Input: A graph $G=(V,E)$, an integer $k$. Question: Is there a path with at least $k$ vertices in $G$ This seems a decision problem and a certificate can be verified easily. But, what is the usage of such a problem? Isn't the main concern finding ...
I'm trying to prove that if $G$ is a connected graph, then $BFS(u\in G)$ is total (i.e. it visits all the vertices of $G$). The inductive proof consists in 2 cases: (i) Prove that $\rm{BFS}$$(u \in \rm{G'})$ is total, where $\rm{G'} = G \cup (u,v) \quad u,v \in G$ (ii) Prove that $\rm{BFS}$$(u \in \rm{G'})$ is total, w...
Been thinking about a problem recently and I am wondering if anyone can comment on some ideas to make solutions to this problem more efficient. Let's say that I am some business owner with a set of $n$ possible store locations $L = \lbrace x_i \in \mathbb{R}^m \rbrace_{i=1}^n$, for $m > 1$, where I'd like to build som...
Wikipedia's solution for multi Producer-Consumer problem uses both mutexes and semaphores. mutex buffer_mutex; semaphore fillCount = 0; semaphore emptyCount = BUFFER_SIZE; procedure producer() { while (true) { item = produceItem(); down(emptyCount); down(buffer_mutex); putIte...
Let's assume that we have a binary search tree with node Y that hasn't a right child and for whom a successor exists in the tree. I want to prove that if I insert a node X into the tree and node X is greater than node Y and less than the successor of node Y then X will be added as the right child of Y. Intuitively, thi...
In Parameterized Complexity the Independent Set Problem for a Parameter $k$ ist $W[1]$-complete, and Dominating set is $W[2]$-complete. Now the prototypical $W[1]$ problem is deciding by a single-tape non-deterministic Turing machines if it has an accepting run with at most $k$ stepts, and for $W[2]$ it is the same not...