instruction stringlengths 35 29.1k |
|---|
I read in [Razborov, "An equivalence between...", p.248] that
It is well recognized in Theoretical Computer Science that when we change the representation of integers from binary to unary, the class $\mathsf{EXPTIME}$ becomes not the class $\mathsf{P}$ but the class $\mathsf{TIME}\left(2^{(\log n)^{O(1)}}\right)$.
Un... |
I'm given a target integer range $[x, y]$ which needs to be covered $n$ times, and a stream of integer ranges $[x_i, y_i]$. I need an algorithm which consumes integer ranges from the stream and returns immediately after processing the first element which causes $[x, y]$ to be covered $n$ times.
Example:
The target rang... |
Suppose I have a set of $n$ equations (each equation can be linear or quadratic).
I want to determine whether the system is underdetermined or overdetermined.
For example, $a_1=2,a_1=3$ is overdetermined since I already know $a_1$ from the first equation, while $a_1+a_2+a_3=1,a_1^2+a_2=5$ is underdetermined.
If I know ... |
I will explain whatever I understand about SSL handshake or simply SSL.
First client sends hello to server
Server sends signed certificate with its public key.
Client checks if certificate is valid, if it looks valid it generates its own private key, encrypts with server's public key and send back to server.
After th... |
At https://www.javatpoint.com/singly-linked-list-vs-doubly-linked-list, it says:
In a singly linked list, the time complexity for inserting and
deleting an element from the list is O(n).
And:
In a doubly-linked list, the time complexity for inserting and
deleting an element is O(1).
Is this not a mistake? Why would... |
In my ADS course we were given this pseudo code for the "exact string matching brute force" algorithm:
1 ESM-BF(P, S)
2 m = length(P), n = length(S)
3 k = 0 # number of matches
4 for j=1,...,n-m+1do
5 i=1
6 while i ≤ m and P[i] == S[j+i] do
7 i = i +1
8 if i == m+1 then
9 k=k+1 ... |
I was just curious how do RTS games actually implement this.
There are usually thousands of units on the whole map. They all have usually unique range of sight and then there's also settings for aggressiveness.
Secondly when an enemy unit goes out of range of sight the unit stops aggressing on the enemy unit. So how do... |
Assume a parralled adder program:
CPU0:
ADD sum,eax;or
LOCK ADD sum,eax
CPU1:
ADD sum,eax;or
LOCK ADD sum,eax
If these 2 instructions are issued in the same clock cycle, and reach memory control unit/cache control module, how does it decide which one will be served first? If not using lock, it seems that ADD require... |
First, let $H$ be a graph represented as an array of adjacency lists say. Next, let FindDegree$(H,y)$ be a standard subroutine that takes $H$ and a vertex $y$ in $H$ as input, and that returns the degree $d_H(y)$ of $y$ in $H$ as output. I am writing pseudocode that does the following: The subroutine FindDegree$(H,y_k)... |
My professor recently brushed over the formal definition of Big O:
To be completely honest even after him explaining it to a few different students we all seem to still not understand it at its core. The problems in comprehension mostly occurred with the following examples we went through:
So far my reasoning is as f... |
I have an expensive operation; I'll use the symbol + and the word "concatenation" to represent it. This operation is:
Binary: A + B
Associative: (A + B) + C == A + (B + C)
Non-commutative: A + B != B + A
Idempotent: A + A == A
These properties mean, for instance, (A + B) + (B + C) == A + B + C and (A + B) + (C + B) =... |
I'm trying to solve a problem that may arise in a system I am concerned with. It will be uncommon in practice, so I am more concerned about simplicity and correctness than performance. I have N nodes that I want to reach agreement on a boolean value v. F of the nodes might exhibit arbitrary faults. I would like to ... |
I'm very new to P and NP complexity classes and reductions. I'm trying to solve this problem and I want to verify my solution and if it is wrong, understand why.
Suppose that I'm given a polynomial time algorithm $A$ that takes a
graph $G=(V,E)$ as input along with integer $k$ and outputs yes if
there is an independen... |
I don't know how to search a bitonic array with roughly $2\log n$ comparisons in the worst case.
What I am trying now is to find the maximum integer using roughly $\log n$ comparisons (binary search) — this divides the array into the increasing and decreasing pieces. Then apply binary search again to these two pieces. ... |
I have been working on this particular question since yesterday and I can seem to figure out how to solve it:
Assume that your files are organised based on slotted page array which contains a header (8B) and slot references of 2B each. Insert in the text below the number of tuples that you believe can fit completely in... |
Exact cover by 3-sets is -complete:
Instance: Given a finite set $X = \{x_1, x_2, …, x_{3n}\}$ of $3n$ elements and a collection $C = \{(x_{i_1}, x_{i_2}, x_{i_3})\}$ of 3-elements subsets of $X$;
Question: Find a subcollection $C'$ of $C$ such that every element in $X$ is contained in exactly one member of $C'$.
Now i... |
I am looking for proper algorithm for so called "delta-homogenization" of 1-D non-equidistant grid.
Definition: The sorted monotonically changing vector $x = x_{homogeneous}$ is $\delta$-homogeneous if for specified $\delta > 1$ , the differences ratio $r_i(x) = (x_{i+1} - x_i)/(x_i - x_{i-1})$
satisfy to the condition... |
What are the differences between the CEK machine and the modern variant of the SECD machine (which combines stack and dump) from the point of view of performance, memory efficiency, and other factors? Are there any papers that explicitly compare the two?
|
Im working on a problem for a homework assignment in finite automata, but I'm having trouble conceptually grasping the problem in the first place.
Prove that the following is undecidable:
$SUB_{TM} = \{\langle M_1,M_2 \rangle \mid L(M_1) \subseteq L(M_2)\}$
I'm not sure what kind of Turing machine $SUB_{TM}$ is even de... |
I'm very new to complexity theory, please help me fill in the gaps in whatever knowledge I have acquired till now.
A decision problem is a problem $X(D)$ that outputs for each input
instance $I$, a Yes or No. $I$ is called Yes instance if $X(D) (I) $
is Yes, No otherwise.
Is my above definition of a decision problem ... |
I have a problem that's been bugging me, but I'm not sure what algorithm can solve it.
Alice has medicine that she needs to use as quickly as possible in case of an allergy attack. She wants to distribute $k$ number of medicines in caches throughout her house, but doesn't know what is the ideal distribution such that a... |
I'm supposed to perform actions corresponding to the different steps in Sipser's explanation of the Modified Post Correspondence Problem, but I'm not sure I understand the third step.
The part I'm referring to is:
Part 3. For every $a, b, c ∈ Γ$ and every $q, r ∈ Q$ where $q$ != $q_{reject}$,
if δ(q, a) = (r, b,L), put... |
I am reading The Art of Multiprocessor Programming. I was able to grasp almost everything up to Counting Networks in chapter 12 - Counting Sorting and Distributed Coordination. However I am having trouble understanding counting and sorting networks.
Does someone know a bit beginner friendly resource about counting/sort... |
I am unable to relate to any real life examples of negative weight edges in graphs. Distances between cities cannot be negative. Time taken to travel from one point to another cannot be negative. Data transfer rates cannot be negative. I am just blanking out while thinking of negative weight edges in graphs.
Can w... |
In Section 4.7.4 of the book "Compilers: Principles, Techniques, and Tools" (2nd Edition), it reads:
"The revised parser (LALR(1)) behaves essentially like the original (LR(1)), .... The error will eventually be caught; in fact, it will be caught before any more input symbols are shifted."
I understand an LR(1) parsi... |
I read different things online about this:
In Sipser, p. 283. The time-complexity of a NTM is defined as the maximum number of steps it uses on any branch on any input of length n.
So this is only defined for a decider.
In other sources (like the lecture notes I inherited from my predecessor at the university I work at... |
As shown in this post @ stackoverflow, ANTLR4 seems able to resolve the "dangling-else" ambiguity @ wiki in the following "if-then-else" grammar by prioritizing the "'if' expr 'then' stat" alternative to "'if' expr 'then' stat 'else' stat". But I have some difficulty
stat : 'if' expr 'then' stat
| 'if' expr 'then'... |
A graph $\mathcal{G}=(\mathcal{V},\mathcal{E})$ may be represented in central memory as follows:
an associative array (hash table) $V$ gives for any $v\in \mathcal{V}$ the list of its neighbors $V[v]$, each of these lists being represented as a dynamic array;
another associative array $E$ gives, for any $(u,v)\in \ma... |
I am currently trying to study the Quicksort algorithm. I understand how it works for integers but can anyone explain how does Quicksort algorithm work with strings?
The reason for my confusion is that strings do not have values assigned to them and the Quicksort algorithm seems to be using values to arrange an array o... |
I am looking for a clustering algorithm that is scalable up to large sparse undirected, unweighted networks (10-40M nodes, 10-80M edges). The most important aspects I care about are scaling efficiency to this size network and maybe consistency/stability. I'm mostly interested in this as a way to try and understand the ... |
I'm new to algorithm, and I am already overwhelmed with the term ∈ I really could use some good explanation.
|
I was trying to find all subsequences constrained to the following conditions:
remove element from the end.
remove element from the beginning.
remove element from both sides.
For example, given the sequence $(1,2,3,4)$ have subsequences $\{(1,2,3,4), (1,2,3), (1,2), (1), (2,3,4), (2,3), (2), (3,4), (3), (4)\}$. So, w... |
If i have a parameterized reduction from multicolored independent set (W[$1$]-hard) to some problem $A$, which take polynomial time. Can i say that problem $A$ is NP-hard?
in other words, Is multicolored independent set (non-parameter version) NP-hard?
Further, does exists a problem belongs to W[1]-hard but don't belon... |
Say you are a salesperson and you want to make a sale; there are $N$ customers on your list; customer $i$ takes $t_i$ time to talk to and there is $p_i$ probability to make the sale to that customer - you find out immediately at the end of the conversation with that customer whether they agree or not. You have no contr... |
Need to find the shortest distance between the closest pair of 'r' and 'b' nodes. You can traverse along '.' elements, but not 'o' elements. How can we do this in $O(MN)$ time? (M rows, N cols). $O(RMN)$ time would also be sufficient (R is numbers of 'r' nodes).
Below is an adopted version the Lee algorithm from here t... |
Given a binary relation $R$ on a finite set $S$, is there an efficient algorithm to transform $R$ to a transitive relation $R'$ by minimum number of addition or deletion of pairs $(x,y)$ to or from $R$ where $x,y \in S$?
|
In Special Matching, we are given an undirected graph $G$, a function $w:E\rightarrow\mathbb{N}$, and an integer $k$. The objective is to decide whether $G$ contains a matching $M$ of size at least $k$ such that for every two edges $e , e' \in M$ then $w(e) \neq w(e')$.
I want to design a random Dynamic Programing th... |
Let's say that I have a file that I really don't want to lose.
I want to convert the original file into $n$ files in the way that will allow me to recover the original file if I have any $m$ of the converted files. I want an algorithm that will solve this problem for any given $m$ and $n$, where $0 < m < n$.
A trivial ... |
I have a 2D bitmap with various shapes (each pixel is either 1 or 0).
How can I find the largest axis-aligned rectangle that covers only set pixels?
|
This is motivated from a homework question. Let $A$ be an algorithm with probability of success equal to $q$ for solving a given problem. Let $p \in (0, 1)$. Find an algorithm that has a probability of success of at least $p$.
My idea so far is to run the algorithm multiple times and counting the number of times the al... |
If one has a vector of size $n$, one can sort it in $O(n \log{n})$. If one has $m$ vectors of size $m_i$ each, such that $\sum_{i}{m_i}=n$, what's the total time complexity to sort all of them? I belive it's still $O(n \log{n})$ but can't formalize.
|
I was curious is there a really efficient way to see if a value is in a set? This question comes from me thinking about youtube views. As far as I understand youtube view count goes up for every unique view it receives (let's imagine it does if it doesn't already). There are millions or billions of viewers per video. T... |
I'm having a hard time trying to write a two tape Turing machine
I wanted to first think Oh all I'd have to do is scan from left-to-right till I find the strings that matches the accepted strings) but I'm stuck now and don't know how to continue
(Note** Σ = {0, 1, #} but the # character is only allowed as a marker to ... |
We were assigned to draw NFA for regular expression a|b|c, so like any one I draw this
But my professor told me it is wrong, the correct way is
So, I checked it on online tools toolbox by cyberzhg, and regexper and according to both of them I am also correct.
Professor's argument was in maths for 4+5+1, we first add ... |
These sources cp-algorithms and geeksforgeeks
state that query complexity (for example, submatrix sum) of 2-D segment tree is O(logN * logM), because
it first descends the tree in the first coordinate, and for each traversed vertex of that tree, it makes a query from the usual tree of segments along the second coordin... |
The rules of the question state that:
Only one element is different.
Rest are all same.
Array A size is 8.
I need to find the different element and remove it (Hashing cannot be used).
I have not developed the code but I have come up with an algorithm.
There will be two cases one where the different element value is... |
Considering the following set, I have to say if it is undecidable, decidable or semidecidable:
$$S_1 = \{y | \forall n \text{ the Turing Machine } M_y \text{ does not accept any string of length } n\}$$
The answer given by the professor is:
Set $S_1$ is undecidable, which can be justified based on the Rice Theorem.
I... |
I attempt to find a few general encyclopedic works on computer science such that looking up relevant terminologies is easily available ready to hand. I'm not familiar with the whole picture of computer science so I can't describe precisely the delicate character of what is a good encyclopedic reference to computer scie... |
The Courcelle's theorem as following:
Obviously, we need the length of the $\varphi$~(that is $||\varphi||$)~in Theorem. However, how to caculate the length of $\varphi$?
For example, $$\begin{aligned}
\operatorname{conn}(X)=\quad & \forall_{Y \subseteq V}\left[\left(\exists_{u \in X} u \in Y \wedge \exists_{v \in X} ... |
I understand that data is transferred from the main memory to the CPU and vise versa using the data bus. But, I am unable to understand, how the data is being transferred from the main memory to the hard disk or from the hard disk to main memory.
Does it use the same data bus for the transfer? My guess is that it also ... |
The game of life is one of the most famous cellular automata in 2D. It has a variety of objects, some of them are moving like gliders, some have an oscillating behavior and others do not change at all, i.e. are still lives.
I am interested in the computational complexity of finding still lives.
Especially in a restrict... |
I am studying the $k$-gossip problem on dynamic graphs against an adaptive adversary. Essentially, we are given a set of tokens $\mathcal{T}$ which are distributed amongst the nodes such that each token is distributed to at least one node. Importantly, the nodes do not know the value of $k$. The problem is solved when ... |
Given a directed graph $G=(V,E)$ with $|V|=n$ vertices and some weight function $w\colon E\to \mathbb{R}$,
I also know that there are at most $\log\log n$ negative weight edges in $G$, and $G$ does not have any negative cycles.
Find minimum cost path from $s$ to $t$
My try so far:
I know that just running Bellman–Fo... |
Let $P$ be a YES-NO decision problem. Let $A$ be an algorithm for deciding on it such that it is correct with probability $4/5$, in both cases (YES an NO). Design an algorithm that is correct with probability at least $p$, in both cases (YES an NO).
This is my solution but I'm stuck at bounding the probability. Let be ... |
I'm having a hard time trying to build the PDA for this language:
$$L=\{a^nb^m: n,m \geq 1 \land m=4n+2\}$$
I don't know how many $a's$ should I push into the stack when reading $a$, and how many $a's$ should I pop out of the stack when reading $b$, and how to reach the final state. Can anyone help me with this? Thanks... |
Assuming I have a list L of lists. Each list in L has four entries [North, Ost, South, West] which represents the neighbours of a point i on a grid. If the entry is 0, the grid neighbour is not occupied by another point.
For example L[0] = [0,3,8,0].
This means that point 1 (which is represented by the first list in L)... |
I am trying to understand the meaning of this scheme, providing a sort of classification of sequential logic circuits. This taken from
https://www.electronics-tutorials.ws/sequential/seq_1.html
Does anybody understand what "pulse driven" stands for? I am 100% fine with "event driven" and "clock driven". I am missing t... |
I want to find 2-approximation algorithm for finding path of m messages sent from m computers to m different computers in a ring topology with n nodes.
I know about clockwise embedding, which takes hyperedges, which are basically the connection requests and makes path from the lowest numbered node to the highest in the... |
The $k$-Partition Problem is NP hard. I want to know if some slight modification of this problem makes it polynomially solvable.
Now consider the set $S=\{a_1,\ldots,a_n\}$ of IDENTICAL numbers/objects ($a_1=\ldots=a_n=1$) which needs to be split into $k$ subsets $S_1$, $S_2$, $\ldots$, $S_k$ such that the sums of the ... |
I have a rather straightforward question for this community (that I am not able to solve). Assume there is a probability of Tom having a bag of candy. If Tom has a bag, he says the truth 4/5 times and lies 1/5 times. If he does not have the bag, he is honest and says he does not. How do I devise an algorithm that would... |
Given a zero-indexed, unsorted array, $a$ of integers (can be positive, negative, or zero) of size $n$. A window of size $k~(k < n)$ is defined as a subarray $a[i...i+k]$ for every $0 \leq i \leq n - k - 1$. The problem is to find the minimum difference between two elements present in the same window, for every window.... |
The meaning of edges with zero weight in a weighted graph questions me for a long time, and I even asked a related question previously.
Yet, when I recently read here a question on real life example of graphs with negative weight edges I was amazed I never asked this one before:
Does anyone know a meaninfgul example of... |
I'm referring to a question in this book: Algorithms by Jeff Erickson, link:http://jeffe.cs.illinois.edu/teaching/algorithms/notes/J-approx.pdf, in particular, pg.21, Q11.
The author mentioned that finding the chromatic number $\chi(G)$ is np-hard, and ask to show that return any integer between $\chi(G)$ and $\chi(G) ... |
Consider this variant of set covering problem.
Input: a collection of sets $S = \{s_1, s_2, \ldots, s_n\}$ and a universal set $U$, in which $s_k \subseteq U$ for all $k$.
The problem is, divide $S$ into two subcollections $S'$ and $S''$ (i.e. $S' \cup S'' = S$, $S' \cap S'' = \emptyset$) to maximize $|U'| + |U''|$ wh... |
The steps involved in proving that a problem is NP-Complete are fairly straightforward to follow, it's the logic behind why the proof is valid that's really throwing me for a loop. Okay so an easy one: we are showing that 3SAT is NP-Complete. There are 2 things that must be shown. First we show that 3SAT is in NP and t... |
As Wikipedia states the time complexity of Integer Linear programming(ILP) is NP-hard, so this means integer multicommodity flow problem is also NP-hard?
|
i am currently struggling with a Linear temporal logic equation: $$\phi=FG( \lnot a\lor X \lnot a )$$
For my understanding, it means that starting at a certain point in the future, proposition a can never be reached again due to the definiton of "finally globally".
Now we have to transform it into an aquivalent equatio... |
I have some 3d point cloud I wish to cluster into some number of clusters.
I have the probability of two points being in the same cluster given as some function of their relative locations, with the probability being 1 for the same location, and 0 for infinite distance.
I would like some algorithm to cluster the cloud ... |
I am trying to determine some bounds for sample complexity. Suppose we have a bounded loss function $\ell$ and target function $f:\mathcal{X}\to\mathcal{Y}$. Hypothesis $h$ is learned, then the empirical risk is is the mean of the computed loss:
$$\hat{R}=\frac{1}{n}\sum_{i=1}^n\ell(h(x_i),y_i).$$
And the true risk is ... |
Will the language $\{w\in L_1\mid \exists v, wv\in L_2\}$ be regular if $L_1$ and $L_2$ regular languages?
|
Given a set $Y$ with whole number positive divisors of $N$, is there a combination of divisors that have a product equal to $N$?
Does Subset Product remain NP-hard when whole number divisors are only allowed and there are no multiplicities in $Y$?
|
While studying a book on algorithms, I came across a question that asked about essentially $d$-ary Huffman coding, where the codeword alphabet has $d$ symbols (the usual case has $d=2$, with symbols $0$ and $1$, ie, binary).
Adapting the usual Huffman coding algorithm for the $d$-ary case is simple enough, and things w... |
I know this is sort of a basic question, but I don't completely understand the following.
Let $A$ and $B$ be two problems. If I take one instance $a$ of $A$ and one instance $b$ of $B$, and show the following. Solving $a$ implies solving $b$, and solving $b$ implies solving $a$. Am I showing that $A$ reduces to $B$, $B... |
I recently have been reading a bunch about David Hilbert's famous 10th problem, and trying to understand its proof. I am currently in the process of reading through an explanation of the proof, given by one of the people involved in trying to solve the problem, Martin Davis, Ph. D. It is really well explained, but pret... |
After working through some examples of proving the non-regularity of languages I encountered this language
$$
L = \{(ab)^{i}a^{j} | i \geq j, i,j \in \mathbb{N}\}
$$
Where $a^{k}$ = a repeated k times. Is this language regular? I believe not since there are infinitely many strings $(01)^{i}$ with $i \geq j$, so a DFA o... |
Suppose that I want to know the number of the cycles of cpu clock that uses to run a specific code written with a specific programming language, like Python or others.
Can I do it?
I mean, do you have any access to count the CPU's clock cycles for your code technically?
Does this code run on any system (any minicompute... |
Given a directed, rooted tree with $n$ vertices, the height of a vertex $v$, $h[v]$ is the number of edges on the longest path from $v$ to some reachable leaf node. Give an efficient algorithm to find the following,
$
d[v] := \max\limits_{w \text{ is a sibling of $v$}} h[w] \qquad \forall v \in V.
$
Note: The algorithm... |
Let's say we have DPDA with acceptance by empty stack, w is accepted by this DPDA. Why can't wv be accepted? I know about the prefix property but i don't see where it's coming from. Can't we just continue moving after reading w when the stack is empty until we read the whole input and decide whether we accept the word ... |
My Question is, what is meant with smallest number N. Does it mean I should try every possible constellation of the n variables and put each one of them into the formula φ and then use 3Sat on that? Then it would be 2$^{n}$? Is that meant?
|
It is known that reachability of 2-counter machines is undecidable. As far as I know, it is semi-decidable though.
Now let's focus instead on the problem of deciding if a 2-counter machine has a computation which passes through the initial state infinitely often.
My understanding is that this problem is non-RE. Is this... |
Let $U$ be the set of elements and $S$ be the subset collections. There exists a tree $T$ that each node is corresponding to an element in $U$. And for every subset $s$ in $S$, $V(T) \bigcap s $ is a path of T.
And I want to find a minimum set $Z$, where $Z \subset S$, and $\forall u \in U, \exists z \in Z$ s.t $u \in ... |
Due to finite precision of number representations, we face situations like:
In: 0.1+0.1+0.1==0.3
Out: False
(on my machine, with Python 2.7 and Python 3 but this is not directly related to the language actually).
This is because there is just no exact representation of $0.1... |
Whenever an algorithm has polynomial complexity, but exponential over the encoding of the input, it is said to be pseudo-polynomial.
What about logarithmic complexity? Wouldn't be wrong to refer to such algorithms as pseudo-polynomial (as often happens)?
Shouldn't I instead refer to them as pseudo-logarithmic algorithm... |
If Turing Recognizability means a T.M. will either halt on input $w$ if $w$ is in the language, or run forever if $w$ is not in the language.
How can we know the language is Turing Recognizable if we run the T.M. on a $w$ not in the language and thus it never halts so we do not get to the next input.
|
Problem: I have two computational problems, $A$ and $B$. We know that $A \in \texttt{Psearch}$ and I want to prove that $A \leq_p B$ for all problems $B$.
Goal: It is my understanding that my goal is to prove that there is a polynomial time reduction $R$ from $A$ to $B$ given that $A \in \texttt{Psearch}$.
I know from ... |
The language given is $L = \{a^i b^j c^k\mid i+j \ge 2k\}$ for which I need to construct a simplest possible Context Free Grammar.
I tried understanding but I could only go as far as making sense of $i+ j = 2k$ but I am unable to come up with anything that caters for the condition where it it can be less than 2k.
|
I am a bit lost in the literature. Is it known whether there is a $o(n \log n)$ size boolean circuit family for the majority function?
|
Currently i am studying Kinetic Data Structure thesis by Julian Basch. I am feeling stuck in some points. Are there any other resources to understand it properly ??
Edit:- I am very new to this data structure. Are there any blogs or video tutorial to understand an introduction to the concept which is a bit more in de... |
I have exactly no knowledge of programming. I want to design/develop/etc a video game I've been wanting to do and part of this is a crafting system similar to what Skyrim has.
Let's say we are working on making an edible food or drink. I want the character to be able to mix ANY ingredient to create a food or drink or e... |
Instance: A boolean formula f(x1, . . . , xn) in 3CNF form, with m clauses labelled C1, . . . , Cm.
Is there an assignment to x1, . . . , xn such that every third clause is False and all other clauses are True? That is, Ci is False for all i ≡ 0 (mod 3), and Ci is True for all i ≡ 1 or 2 (mod 3).
how do I prove that th... |
if A be an NP-complete problem, and if B be an NP-hard problem. If A is polynomial
time solvable then is B is polynomial time solvable?
on the contrary, if A be an NP-complete problem, and B be an NP-hard problem. If A is polynomial time solvable then is B is polynomial time solvable?
My intuition is, (which may be... |
I have recently been reading up on TOC, and had this thought, which does not seem to be answered explicitly anywhere.
They way I have understood it, a system is Turing complete if it can simulate any Turing machine. But Turing machines are limited to their instructions. Does that mean not every TM is actually Turing co... |
Is it true that if an edge is included in at least two different minimum spanning tree, then that particular edge is included in all minimum spanning tree? If so why?
|
I wrote an algorithm based on the Warnsdorff's rule to solve the knight's tour problem, where you need to create a sequence of moves of a knight on a chessboard such that the knight visits every square exactly once.
I noticed something strange, though: when the size of the chessboard is odd, about $50/60\%$ of the sta... |
Given a graph G I want to find the maximum planar subgraph which is a grid graph.
(Because the nodes of this subgraph represent points on a grid).
Is there any library in python for finding the maximum planar subgraph?
Is there some way how to implement these constraints for the grid graph?
Edit: As I understood I am l... |
In Wikipedia article on "Sum Type" it is stated that sum type Curry-Howard correspondence is intuitionistic logical disjoint.
But sum type definition states that it is
a data structure used to hold a value that could take on several different, but fixed, types. Only one of the types can be in use at any one time, and ... |
The general boolean satisfiability problem (SAT) is NP-complete, and thus can't be solved in polynomial time (assuming $P \neq NP$). But the special case of 2-SAT is in P, and can be solved in linear time. 2-SAT formulas consist of the conjunction of clauses with two elements, e.g.,
$$ (a \lor b) \land (b \lor \lnot c)... |
The group theory of $S_n$ shows that all permutations of $n$ objects can be generated from the $n$-cycle $a:=(1 2 3 .. n)$ and the transposition $b:=(1 2)$. (See Theorem 2.5 at https://kconrad.math.uconn.edu/blurbs/grouptheory/genset.pdf)
One can use this fact to label and enumerate permutations. For example, this sh... |
I was analyzing various classic dynamic programming problems:
1. Cut rod problem
Definition: Given a rod of length n inches and a table of prices pi of selling rods of different lengths i = 1, 2, …, n, determine the maximum revenue rn obtainable by cutting up the rod and selling the pieces.
Recursive top down naive im... |
For an algorithm homework, I'm asked to give a solution for a knapsack problem. I have in input a list of products. A product is assigned a cost and a number of calories. So I have two sets, one of money and one of kcal. My goal is to choose products that give an equal sum of money and kcal.
for example if I have this ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.