instruction
stringlengths
35
29.1k
Having encountered the concept of "pseudopolynomials", my understanding is that we have to be careful when the input to a problem is a number, that the complexity of the solution should be polynomial in the length of its representation and not its value; that is, if we want a solution polynomial in the size of the inpu...
Let $n$ be a positive integer and $[n] := \{1,2,3,...,n\}$. You are given $k$ non-empty subsets of $[n]$. Decide whether it is possible to select exactly one element from each subset such that the elements selected form a permutation of $[n]$. I try to reduce the Hamiltonian cycle problem. However, Hamiltonian cycles o...
Is there an algorithm that, given an undirected graph and one independent set IS1, finds an other independent set IS2 by adding and deleting vertices from the first IS1?
Specifically, properties that identify preconditions over which a function can be used without resulting in undefined behavior or data races. For example, I am familiar with 3 important properties: pure idempotent re-entrant My question is whether: is this set of properties non-overlapping and complete? If not, is t...
In Arora-Barak, the authors mention a way how TMs can compute everything that can be computed by computers. The idea is that every high-level language program has an equivalent machine language program which is basically a sequence of instructions. These instructions are easy enough to be implemented in TMs. I am attac...
Consider we use a RAM model with word length w (or if you really want a more exact model, you can use Knuth's MMIX instructions with w-bit numbers). Given a number n, we want to compute the most significant digit. For least significant digit, this is pretty easy: $n - 10 \lfloor {n\over{10}} \rfloor$ which is O(1). If ...
I am looking for algorithms (or at least something similar to the problem definition): Given a fully-connected weighted graph $G$ with $n$ nodes, find a subset $S$ of edges that form a square lattice graph (where each node, except for the ones at the edges, is connected to 4 other nodes) such that the sum of edge weigh...
I am having trouble with the statement that $DSPACE(\log^2n)\subseteq DTIME(n^{\log n})$ holds which is given without argument in the paper The structure and complexity of minimal NFA's over a unary alphabet in the proof of Theorem 3.2. I only get to something like $DSPACE(\log^2n)\subseteq DTIME(\log n)$. (Using the u...
I am attempting to draw the DFA of this problem but I'm kind of stuck. In another post I saw that the DFA should have 10 states. I'm finding it hard to even understand the question, is the input to the DFA the full string so for example 1001 or is it multiple inputs of length 3 in this example 100 and then 001. I've ma...
In role playing games, switching equipment for better is a common procedure. My question is to find an algorithm that can optimize linear combination of stats the equipped gear gives - this is exactly how it works on The-West.net: Each piece of equipment can be equipped in only one slot (there is approximately 5-10 of...
Suppose I have this c++ code: for(int i=0; i<n*n*n; i++) { for(int j=0; j<n*n; j++) { if(i>n && j<n) { for(int k=0; k<n*n*n*n; k++) s++; } } } I need to find its time complexity. What I tried doing is: I tried determining the times the if clause would be fulf...
I found the proof of this theorem from https://www.csie.ntu.edu.tw/~lyuu/complexity/2011/20120103s.pdf. Here is the screenshot of the construction of probabilistic Turing machine RP. (https://i.stack.imgur.com/76pyK.png) The idea of proof is to show that if 3SAT $\in$ BPP, then 3SAT $\in$ RP. I understand the construct...
In the code below, I describe a problem and provide a backtracking implementation in Python that solves it: # Find the combination of k out of n measures that maximizes score # while ensuring that their total cost does not surpass C. # Each measure has a profit of m₁, …, mₙ and a cost of d₁, …, dₙ. # The score of the...
Me again. This time I have a more general question. Suppose I have the following code snippet: int f(int k) { int s=0; for(int i=0; i<k*k; i++) { s++; } return 2*k*k; } And the expression is: f(n) * f(f(f(n))); I am told that the complexity is O(n^2) + O(n^2) + O(n^4) + O(n^8) I have several questions: Why is...
So this is the language that I need to prove is irregular via pumping lemma, however I am completely stuck with this and seeking some advice. The other ones I have done during my tutorial are much more simple but struggling a bit more when it comes to having two conditions as such. Any help would be appreciated
LogLog/HyperLogLog provides a great way for estimating the cardinality of the set of $n$ objects. At its simplest, you hash all $n$ objects into binary strings, find the largest number of leading 0's $z$ in $O(n)$ time (and basically $O(1)$ space), and $2^z$ is your estimate for the cardinality. In practice, instead of...
How to prove that the heaviest edge in mst is not heavier than heaviest edge of any possible spanning tree? by heaviest edge of any Spanning tree i mean considering any possible Spanning tree, we have to prove that the heaviest edge in mst is not heavier than heaviest edge of that spanning tree.
I've been reading papers on streaming algorithms and ran across the following question which I haven't been able to answer: Consider the Dyck language $Dyck(2)$ over the alphabet $A = \{(,),[,]\}$ and let $f_n:A^n\times A^n \to \{0,1\}: f_n(x,y) = 1 \text{ if } xy\in Dyck(2)$ and 0 otherwise. Suppose two parties Alice ...
I am reading Papadimitriou's Computational Complexity and got stuck on part d) of the following exercise (pg. 505) 20.2.14 A panorama of complexity classes. ... A language $L \subseteq \{0, 1\}^*$ will be called a leaf language. Let A and R be two disjoint leaf languages (the accepting and rejecting leaf language, re...
I would guess that this question is going to make some people wonder how I haven't already found a solution looking through papers -- but I do not see a clear algorithm. In implementing CDCL, I read this site, which gives the following definition: Consider an implication graph $(V,E)$ obtained from a trail that falsif...
Consider $n$ houses in a city which each house's water can be supplied with either a well or pipes from other houses. Constructing a well in a house $i$ costs $w_i$ and connecting a pipe from house $i$ to $j$ costs $c(i,j)$. The question is to find an algorithm to find the minimum cost to provide water to all houses. M...
I would like to use or create a hashing algorithm that takes K inputs from 1 to N and maps them uniquely to different numbers on 1 to N. K can be 1 to N. Ideally I would like the hashing alg to be able to be salted, but I'm not sure that is possible if some of these numbers must be prime. Someone in #algorithms on libe...
I am trying to write down a code which would blindly search for a condition using breadth first search.I have been thinking of it for quite some time and I cant figure out how to continue. On the one hand the data structure is a tree with each node having n children so in order to tranverse every node of the tree you n...
Given a graph $G =(V,E)$, a set of colors $\mathcal{C}=\{0,1,2,3,...,c-1\}$, and an integer $r$, I want to know if I can find a coloring procedure that can assign a color to each nodes (all nodes must be colored) in such a way that each node can find all distinctive colors around it within a radius of $r$, i.e., for ev...
As far as I know, all existing strongly polynomial algorithms for flows and assignment problem have $\Omega(V^3)$ complexity in the arithmetic model (assuming the graph is dense). I'm interested in the arithmetic model of computation, where each arithmetic operation on two numbers takes $O(1)$ time regardless of the s...
I have asked a question on math.SE about if there is a way to do it better than by brute force, but this time I am interested in the complexity of the problem itself. I will repeat the problem, with a slight change to it: Suppose, you have a box $B$ with $n$ items and you pull $k<n$ items out of it. Items have differe...
I am trying to understand the probing model proposed by Yao in the paper "Should Tables Be Sorted?". Yao suggests a "Basic Model" (in the section appropriately titled "Basic Model") but there seems to be some disconnect in the way I remember hash tables and the way it is presented here. Consider sorted table vs cyclic ...
Are you able to construct a boolean circuit that computes the majority function of n bits where the circuit only takes up O(n) space? If so, what would that circuit look like? I have a feeling it has to do with a Full Adder, but I am unsure.
I know that propositional satisfiability is NP-complete and that if I add first-order quantifiers I get the complete problems for the polynomial hierarchy and PSPACE. What happens if my formulas are relations $R(x_1,...,x_n)$ over boolean variables?
It is well-known that $\mathsf{MIP} = \mathsf{NEXPTIME}$, and recently there was a breakthrough stating that $\mathsf{MIP^*} = \mathsf{RE}$. This was very confusing because it seemed like the (malicious) provers should become more powerful about fooling the verifier, for the provers was equipped with a new toy, namely ...
Consider a Reed-Solomon code over a finite field of $\mathbb{F}_q$. Why is the typical block size chosen to be $q-1$ [1][2][3]? The reasoning I saw around this is that in order to maximize the rate for a fixed minimum distance. But wouldn't choosing $q$ as the code size would be even slightly better? Does it have to do...
How to calculate the maximum step of sorting network? Based on image below, it has most comparators at second index which is 9 comparators than another indices. That's mean, overall networks need 9 forward propagation steps which is the 9 is the maximum step of sorting network. This network has 6 elements input. How ab...
If a CPU is able to execute multiple instructions in parallel, and fetching/decoding/scheduling instructions happen in batches, and there's multiple execution units, etc. What does the IP register points to among all the instructions being executed at the same time?
At 12:11 in this video the creator talks about unverified rumors the Q* algorithm can break AES-192 encryption. If this is true, would this mean P = NP?
I was wondering if there is a reason behind clearing all the values in a list and reusing it, as opposed to deleting the list and creating a new one. Are there any practical advantages of using clear() method, aside from situations where the list is referenced in multiple locations, and deleting it might lead to uninte...
I've implemented linear BVH as described in Karras 2012, and I was using triangles' centroids for Morton Code generation. I found recent papers and implementations use triangles' bounding boxes' centroids for Morton Code generation and they seem to result in better BVHs. I used triangles' centroids because I didn't kno...
I made some code about "integer interpolation" for running approximate alpha blending at FPGA which have low quantities of logic gate. Let's refer to "II" as integer interpolation. "II" made applying Russian peasant algorithm. The different point of Russian peasant between "II", Russian peasant is algorithm for multipl...
I have been trying to implement an approximation algorithm for the max traveling salesman problem with triangle inequality, and each paper I've read references the step of finding the max cycle cover in O(n^3) time. I know how to find it in O(n^6) time by creating a new graph with a vertex for every edge and using a pe...
$O(\sum_{l=0}^{log_2n} l*2^l)$. I took the integral of the term which I think is $O(n*log(n))$
Testing whether a number (N) is prime or not can be made very fast but it will require storage space. If there is a central repository that stores all prime numbers found till now and if there is a webAPI that returns these numbers or one/few number(s) at a time (sequentially) then it will be very fast to test whether ...
If I have two CTL equations, how do I prove they're equivalent or that one implies the other? What's the general approach? Disproving is obvious, but I am unable to figure out how to prove the equivalence of the two or an implication
This may seem like a simple question, but I can neither find the answer on the internet nor AI tools can give a proper answer. I was reading a book about static networks and I saw that the bisection width of the star topology is 1, but it didn't make sense to me. The definition of bisection width is given as follows: T...
for a=1 to m means for(a=1;a<=m;a++) for i=1 to n for j=i to n c= c+1; The total no of iterations is O(n^2) i=1,j executes n times. i=2,j executes n-1 times. . . . i=n, j executes 1 times. So Total No of iterations = n+n-1 + n-2+ ..... + 1 = Sum of n natural numbers = O(n^2) For the Time complexity of the given ...
We are given two cyclic $\{0,1\}$ strings $X$ and $Y$ with both length $n$, containing $k$ 0s and $n-k$ 1s. Suppose positions of 1 in $X$ are $x_0,\dots,x_{k-1}$, for $Y$ are $y_0,\dots,y_{k-1}$. We assume $x_0=y_0=0$. Find $c \in \{0,\dots,n-1\}$ and $s \in \{0,\dots,k-1\}$ minimize $$ \sum_{i=0}^{k-1} d(x_i,y_{(i+s) ...
I recently designed an algorithm for single-source shortest paths in graph structures, which can limit the number of edges as Bellman-Ford while approaching the performance of SPFA. Of course, it also supports negative weights and helps check the negative weight cycle. The runtime ratio is SPFA : Mine : Bellman-Ford = ...
Say i have an 2d array A of nxn size, int values already given for each item.these values can be the same or different. There's gonna be another nxn array B being input. I can only interchange one row from B with another row from B, or one col from B with another col from B. (Exchanging a row with a col is not a thing....
Let $G = (V, E)$ be a connected DAG (representing a circuit) with every vertex may be one of the following three types: Input variable, with in-degree $0$ and out-degree $\geqslant 1$. A gate, with in-degree $2$ and out-degree $\geqslant 1$. Output variable, with in-degree $1$ and out-degree $0$. Does there exist a p...
I've been reading the book "A Primer on Memory Consistency and Cache Coherency", and it contains the following paragraph: The Atomic Requests property states that a coherence request is ordered in the same cycle that it is issued. This property eliminates the possibility of a block’s state changing—due to another core...
Assume the following hypothetic scenario: You know the values $v_1^0, \ldots, v_n^0$ of $n$ cryptocurrencies. You know the values this currencies will have for the following $m$ days; this is, $v_0^1, \ldots, v_n^1$ up to $v_1^m, \ldots, v_n^m$. In general, $v_{i}^j$ is the value of the $i$th currency in $j$ days from...
Suppose a polynomial time machine that has an access to a polynomially long string of bits independent on the input. On average, it's impossible to compress this string to a subpolynomially long string using a deterministic polynomial time compression algorithm. As far as I understand, such a machine would be a $BPP$ m...
Is this the CFG for part (a), S -> AxxyxxA A -> Ax|ε If this is the answer then this grammar would accept "xxyxxx" also which is wrong. How to do it if this is wrong?
There are algorithms that speed up matrix multiplication over the naive $n^3$ algorithm. But supposing you have 3 matrices $A$, $B$ and $C$, is there a way to compute $ABC$ that is asymptotically faster than first computing $AB$ and then computing $(AB)C$? Let's assume the matrices are square and dense. This question w...
I am trying to understand this Expected linear time MST algorithm, and I have a problem in the implementation of the Borůvka's step. My problem is with the removal of duplicate edges between merged connected components and keep the one with minimal weight. To get the right complexity, one would need to do it in $\mathc...
Consider the following decision problem: Given $([b_1, \cdots, b_n],t)$, where $[b_1, \cdots b_n]$ is an array of natural numbers each less than $n^c$ and $t$ is a target natural number, do there exist natural numbers $f_1, \cdots f_n$ such that $f_i \le b_i$ for all $1 \le i \le n$ $\prod_{i=1}^{n} f_i = t$? We gues...
Consider the variant of the Subset Sum problem, where the input is a list of $2 m + 1$ positive integers of sum $2 S$, and the goal is to find a subset with the largest sum that is at most $S$. The problem is NP-hard in general, but it can be solved in polynomial time if the all inputs are 'big', that is, larger than $...
I want to compute the centroid of a body of the following form: $$ E\cap H_1\cap \cdots \cap H_T $$ where: $E$ is an ellipsoid in $\mathbb{R}^d$: $E = \{x = c + Bu | u^T u \leq 1\}$, where $c$ is the ellipsoid center and $B$ is a matrix. $H_1,\ldots,H_T$ are half-spaces. Can this be done in time polynomial in $d$ (th...
To find the maximum matching on a bipartite graph, I propose the following greedy algorithm: At each iteration, pick an unmatched vertex with the smallest degree and match it to one of it's neighbours if possible. Remove the 2 matched vertices and all of it's edges from the graph and repeat till the graph is empty. I'v...
Consider a directed unweighted graph (in a adjacency matrix for example), how can I visit each node exactly once? By once I mean for example in a DFS traversal, a node can get finished and we should go back to it's parent node and try other paths. But what's an algorithm that doesn't get back to the parent node at all ...
I'm learning about induction and co-induction. From what I know, given a set of judgments $U$ and an inference system $\Phi \subseteq \wp(U) \times U$, where $(\left\{ h_1,\dots,h_n \right\}, c) \in \Phi$ stands for the rule $\frac{h_1 \quad \dots \quad h_{n}}{c}$, we can define the function: $ F_{\Phi}(X) = \left\{ c ...
I recently came up with this bin packing variant and was wondering, if someone has studied it before: Given: Instance $I$ is a set of tuples $\begin{pmatrix}s_{i} \\ o_{i}\end{pmatrix}$ with $s_{i}, o_{i} \leq 1$ and $s_{i} \leq o_{i}$ for all $i$. Task: Pack the items in $I$ into the least amount of bin with size $1$....
I'm a student trying to learn more about CMOS design, I already understand assembly and computer architecture, but VLSI is very interesting and I was wondering if you guys knew some good books/games in order to learn more. I already know how to use electric, and I just want to know more about this topic. Also, I don't ...
Below depicts a FIFO buffer: So the buffer is there for when the speed of data written into the FIFO buffer is faster than the data read. But I don't understand one thing. Wouldn't eventually all the free buffers of the FIFO buffer run out after certain amount of time? Because writing speed is faster than the read spe...
Classic text (Linz, P., & Rodger, S. H. (2022). An introduction to formal languages and automata. Jones & Bartlett Learning.) describes the following language where one is to describe an nondeterministic pushdown automata (chapter 8 problem 4j fifth edition) : Describe a language over {a,b} where the count of b's is eq...
Classic text (Linz, P., & Rodger, S. H. (2022). An introduction to formal languages and automata. Jones & Bartlett Learning.) describes the following language where one is to describe an nondeterministic pushdown automata (chapter 8 problem 4j fifth edition) : Describe a language over {a,b} where the count of b's is eq...
Classic text (Linz, P., & Rodger, S. H. (2022). An introduction to formal languages and automata. Jones & Bartlett Learning.) describes the following language where one is to describe an nondeterministic pushdown automata (chapter 8 problem 4j fifth edition) : Describe a language over {a,b} where the count of b's is eq...
I'm trying to understand reaching definitions and I'm having hard problem wrapping it around my head with the following definition (taken from the the following paper page 114): $B_i\;\text{be a basic block}$ $ReachIn(B_i)\;\text{be the set of registers that reach the entrance to}\;B_i$ $ReachOut(B_i)\;\text{be the se...
I have an algorithmic problem in which I have a highway that is a straight line of length $n$ and a set of unique respective costs for construction of a radio tower for each mile on the highway. I am trying to use dynamic programming to find a way to minimize the cost of ensuring that each point in the highway is cover...
Given an isothetic polygon (sides parallel to the x-axis or y-axis) and 2 points (start and end) on the boundary of the polygon, find the shortest path traveling only in the direction of the x or y axis (up, right, down, left), such that the entire polygon is visible by the time a point travels from the start point to ...
Given an array of length n, how to determine if all the continuous subsequence of this array contains at least one unique element. Any subarray array[start, end] with 0 <= start <= end < n will have a unique element. The algorithm will return : True for array = [1, 3, 5, 3, 1] False for array = [1, 3, 5, 3, 5] becaus...
The question asks to write an algorithm using Dijkstra's algorithm with time complexity of $\Theta(|E| \log |V|)$ that find the second shortest path between $s∈V$ and $t∈V$. The farthest I managed to get is: Run Dijkstra's algorithm and find the path from $s$ to $t$. Mark this path as $P_{(s,t)}$. Remove one edge $e'...
I am trying to implement an algorithm that fairly distributes people into groups, given their ranking of those groups, while also taking into account their preference for partners. I have modeled this as a directed graph with upper and lower bounds and costs on edges representing their ratings. Finding a solution would...
#define N 2 #define TRUE 1 #define FALSE 0 int flag[N]={FALSE} int turn; void process(int i) { int j=NOT(i); while(1) { a) NON-Critical Section(); b) flag[i]=TRUE; c) turn=i; d) while(flag[j]==TRUE && turn==i) { //wait } e) Critical secti...
If you go to the JSON spec page : https://www.json.org/json-en.html, then you'll see the language represented by some diagrams showing graphically what the language looks like. I wondered, does this kind of diagram has a name ?
I'm a first year BCA student. Can you help me with flowgarithm of the common child problem (LCS) without pointers
I'm given a rectangular plane with width, height and a set of rectangles defined by left, top, width, height, where left and top define left upper corner of the rectangle. My task is to find the largest rectangle that can fit among the other rectangles without overlapping. It should be possible using Sweep line algorit...
Now, I have assumed the unary number to be 1. and my doubts are Do you design this machine similar to normal unary multiplication assuming that the constant 2 (11) is always present in the input tape? Or Is there only one unary number present in the tape? This confusion may be because of my poor understanding of the ...
You are given a rooted tree $T=(V,E)$ with $n$ nodes and the root $r$. Each node $u\in V$ has an integer label $l(u)$. Suppose $S⊆V$ then $S$ is well-formed if for every $u,v\in S$ if $u$ is an ancestor or the parent of $v$ then $l(u)\le l(v)$. Let $wf(T)$ be the maximum size of any well-formed set in $T$. How can we ...
I've been asked to prove that the language $A_{TM} = \{ \langle M,w\rangle \mid M$ is a TM that accepts $w\}$ is mapping reducible to the language $LOOP-ONE = \{\langle M \rangle \mid M$ is a Turing machine that doesn't halt on exactly one input$\}$. I came up with the following idea : F = "On input <M,w>: Construc...
The Fermi Paradox asks why we have not yet encountered other intelligent life given the high chance of intelligent life emerging. I recently had the following thought: Evolution shapes the behaviour of an organism so that the organism behaves in ways that increase the organism's chance of survival. When evolution creat...
Git uses SHA hashing as a content address key. This relies on their being a vanishingly small probability that two different pieces of content will ever hash to the same key. For content c with length l(c), SHA(c) can be computed in time O(l(c)) and uses constant space. I am curious if there are hashes with a similar e...
So this is the Rice's theorem we were provided: Definition: $TM$-$FUNC(S)$ Input: Turing machine $M$ Question: Is $f_M \in S$ Let $S$ be a set of computable partial functions with $\emptyset \neq S \neq R$, where $R$ is the set of all functions computable by a Turing machine. Then $TM$-$FUNC(S)$ is undecidable. In othe...
$\mathsf{RP}$ can be deterministically defined as: A language $L\in\mathsf{RP}$ iff there exists a polynomial $p$ and deterministic Turing machine $M$, such that: $M$ runs for polynomial time $p$ on all inputs, $\forall x \in L$, the fraction of strings $y$ of length $p(\vert x\vert)$ which satisfy $M(x, y) = 1$ is g...
where i got it from. This was weird so I wanted to try it myself because they way he did it seemed wrong. So this is my attempt is it correct? I did not add the basic parts of the pumping lemma proof but just did the hard part, is it correct? $L=\{a^ib^j \mid j = i^2\}$, ab, aabbbb $z = a^nb^n$ Case one: v and x only c...
I have come across a c program like this . int main() { int a,i=4; int z=5; a=--i+ --i+ --z; printf("%d %d",a,i); return 0; } What will be the output? I need some explanation.
If we were to discover a deterministic algorithm capable of deciding, in polynomial time, whether a given graph contains a Hamiltonian path, would that imply that the problem SUBSETSUM belongs to P? In this scenario, the existence of a deterministic polynomial-time algorithm for the Hamiltonian Path problem could lead ...
C++ code: int main() { short int arr[4][4]; for (int i = 0; i < 8; i++) { for (int j = 0; j < 8; j++) { arr[i][j] = i+j; } } return 0; } Is there going to be a difference in hit time if it is loading data from arrays or storing data into array. For example for arr[i][j] = i+j; and a = arr[i][j]; ? Also what ...
I know that, in general, the Shortest Hamiltonian Path Problem in a general weighted graph is NP-complete. I am wondering, however, if the restriction to a complete weighted graph admits an algorithm in P. Being in a complete graph does give the knowledge that a Hamiltonian path exists in the first place. My guess is t...
Brief: I have two configurations, a and b, of the same set of Rummikub tiles (a may not be a valid Rummikub config) and want to find the fewest number of pickup->place tile operations to transform a into b. Type Definitions: C = Pair<int, int>: Card represented as a suit and value pair. CL = List<C>: Card list. S = Mu...
I have a question related with the response time of Deadline Monotonic scheduling...let's assume that there are 4 tasks, and the processor only allows to have 3 task priorities, thus there will be 2 of 4 tasks that will have same priorities. Tasks with same priorities will be processed in FIFO order. Do you know the fo...
I have a data set showing different clusters of data points and was attempting to find a way to get the peak of at every cluster. Comparing the moving average between a set of points does not work as the y values fluctuate up and down as x increases.
Is there a name for the class of software errors that arise from the fact that the software believes something wrong about the state of the world? (Allow me a bit of anthropomorphization of software, for the sake of explanation.) One example: A temperature sensor correctly reads 19°C, but the software accesses its mem...
Here is the block diagram of the pipeline for the H.264 encoder (Fundamentals of Multimedia by Ze-Nian Li, Mark S. Drew and Jiangchuan Liu). The feedback loop is used for motion estimation, but why is it taken after the transform and quantization steps? Why introduce and overhead from the inverse functions? I know th...
I have a parameter $q$ which is the probability of selecting a vertex (among $n$ vertices...) to be in a certain set. I am constructing the sets in an iterative way, having the vertex $v_i$ be in the set with probability $\leq \left(1 - q\right)^i$ (I'm not going into details about the order of the vertices for which t...
A practice problem in my textbook asks to proof the amortized complexity for a sequence of insert, delete min, and decrease-key operations on an initially empty skew heap. Insert and delete min both have an amortized complexity of $O(log(n))$, and the deletion algorithm that removes an arbitrary node in a skew heap is ...
Turing Machine where instead of having a set of final states F it has: A designated final state qaccept which exists in Q set of states. Upon being in this state, it halts, and accepts the input. A designated reject state qreject which exists in Q set of states. Upon being in this state, it halts, but rejects the input...
Suppose $P\neq NP$. The following problem can be solved in polynomial time? Given natural number $n$ and positive real numbers $a_1,a_2,\dots,a_n$ and $b_1,b_2,\dots,b_n$. The goal is to find $I\subseteq\{1,2,\dots,n\}$ such that $\sum_{i\in I}b_i$ maximized and $\sum_{i\in I}a_i\leq 5$. But I have no idea about it...
Let $D(V, A)$ be a DAG. We call a dominated path in $D$ a path $P$ such that $P$ is maximal and $\exists P^{'} \in D . (P^{'} \text{ is maximal } \wedge V(P) \subset V(P^{'}))$ that is, $P$ is a dominated path iff $P$ is maximal and there exists another path $P^{'}$, also maximal, containing all the nodes of $P$, along...
I just started studying the concept of context-free grammars and I find something very confusing. Watching a video I found someone tackling the problem ${0^n 1^m : n,m\geq 0}$. I thought that the simple answer would have the production rules: $S \rightarrow \epsilon \ | \ 0S \ | \ S1$ Since I thought this implies that ...
While preparing for final exam, I encountered a (target) problem where you have $M$ lines and $L$ points and you want to answer if it's possible to cover them all using $K$ disks of unit radius (decision problem). I would like to reduce the Disk Covering Problem to the problem at hand to show that the problem is NP-har...
Does an edge never being the largest weight in any cycle imply that it is included in the MST? I believe the answer is not, but can't think of a counterexample. I know that one guarantees an edge is in the MST with the cut property, but was wondering if this is equivalent.