instruction stringlengths 35 11.4k |
|---|
Given this following recurrence: $$T(n) = T(n/2) + O(n)$$Find the final time complexity.
My first thought is $O(n\log n)$, since there is at most $\log n$ times the
$O(n)$ will appear.
However, if we adopt the following analysis and let $n=2^m$, then we have:
$$T(2^m) = T(2^{m-1}) + k(2^m) = T(2^{m-2}) + k(2^m + 2^{... |
I have a set of elements $x_1,...,x_N$, they take values $x_i \in \{0,...,N\} $ for all $i \in \{1,...,N\}$; I need to sort them. I think I can do that with complexity $\mathcal{O}(N)$, where I can create a matrix of $N\times N+1$ where the colomns represent the sorted values of the range, i.e., $\{0,1,2,...,N\}$, and... |
Given 2 collections of finite sets $A_1,A_2,\ldots,A_m$ and $B_1,B_2,\ldots,B_n$, is there a set $T$ such that: $\left|T \cap A_j\right|\ge 1$, for $j = 1,2,\ldots,m$ and $\left|T \cap B_i\right|\le 1$, for $i= 1,2,\ldots,n$?
I tried doing this problem by considering it as a decision problem (pi).
Please suggest me if y... |
I have recently started thinking about application of SAT in solving different problems and how I can encode those problems into a SAT problem.
I think one of the interesting problems where SAT solvers can be used is finding a minimal representation for a logic expression. However, I have trouble encoding the problem i... |
Let the characteristic sequence of a set $A ⊆ \mathbb{Z^+}$ be the following infinite binary sequence:
$$χ_A = b_1b_2b_3\ldots,$$
whose $n$th bit is 1 if $n ∈ A$ And 0 otherwise.
Write $χ_{A,n}$ for the first $n$ bits of $χ_A$.
Prove for every decidable set $A \subseteq \mathbb{Z^+}$ there is a constant $c ∈ \mathbb{N... |
A cache memory has a line size of eight 64-bit words and a capacity of 4K words. The main memory size that is cacheable is 1024 Mbits. Assuming that the addressing is done at the byte level, show the format of main memory addresses using 8-way set-associative mapping.
So here's what I have understood from this quest... |
Question: In the problem below, does proving $T(n) = O(n^2)$ and $n^2 = O(T(n))$ lead to the same result as proving $T(n)=O(n^2)$ and $T(n)=Ω (n^2)$? Which would be the better approach to take? I feel like I am not getting the big picture. Right now I am just trying around until I find something that seems plausible.
... |
To me (but I might be wrong) Rice's theorem asserts that it's not possible to formalise the demonstration of a non-trivial property of a recursively enumerable language within the same given language. The modus ponens being the basis for demonstrating, Rice therefore says in substance that you will necessarily need a m... |
Does $2^{n-1}$ and $2^{n}$ share the same complexity complexity class as exponential named as $O(2^n)$? So the former belongs to $O(2^n)$ even though it's one order lower?
What is the name of the complexity complexity class of $O(n2^{n})$?
|
We have given integer array of $n$ points, let it be $A$, showing where it is on the x-axis. For this problem we are working only with the x-axis and the y-axis is not important at all. Now for given two indexes $l$ and $r$, such that $0\leq l\leq r \leq n-1$, we want to find the sum of distances from each point whose ... |
I have to construct NFA that accepts language $L=\{wbbav \;|\; w \in \{a,b\}^*, v \in \{a,b\}^+, v\; has\; suffix\; a\}$.
My solution is this automata:
Can you tell me, if this is correct or not? If yes, it is possible to construct this NFA with less states?
|
I have been trying to do a product construction(intersection) with 2 DFA which has dead states, but I'm stuck at the transition table with a confusion that,what should I do with dead state. Should I also combine the dead state with other states?
|
I am interested to learn more about topological graph theory and Graph Embedding.
Assume I have a metric space, $d \colon M \times M \to \mathbb{R}$ and a graph, $G=(V,E)$.
What is a rigorous way to define a valid embedding of $G$ given $d$ and how to find such an embedding?
Edit: I found this post about embedding gr... |
Max 1-in-kSAT is the following maximisation problem :
Given $n$ variables $x_1,\dots,x_n$, and $m$ clauses $C_1, \dots, C_m$, find a valuation such that the number of clauses satisfied by exactly one literal is maximal.
In the following paper, there are several inaproximability results about this problem, such as
Theo... |
I need to give the LL grammar for the language below and explain why the grammar is LL and what the value of $k$ should be:
$$L = \{ a^n c^m c^{n+m} : n \ge 1, m \ge 1 \}. $$
I have the following, but it works for $n \ge 0$ and $m \ge 0$. I'm not sure how to get rid of that case where $n$ and $m$ are 0.
$$
\begin{alig... |
A claw is the graph isomorphic to $K_{1,3}$, that is, a star graph with three edges, three leaves, and one central vertex. (see below)
A graph is claw-free if it does not contain a claw as an induced subgraph.
The line graph of G is the intersection graph of the edges of G, that represents the adjacencies between edg... |
I have a binary array like this:
$$A = [0,1,0,0,1,0]\,.$$
I'm trying to find a way to calculate how many arrays of the same length exist that have a Euclidean distance of 2 or less from this array.
So, how many arrays of length 6 exist where
$$\sqrt{\Sigma(A_{_i} - B_{_i})^2}\leq 2\,?$$
I'm trying to find or create a ... |
I saw this from SO which led to Feedback Arc Set, which describes the problem nicely:
In graph theory, a directed graph may contain directed cycles, a one-way loop of edges. In some applications, such cycles are undesirable, and we wish to eliminate them and obtain a directed acyclic graph (DAG).
I am wondering how t... |
I am wondering if there are dynamic programming speedups for the minimization problem $dp[i]=\min_{j<i}\{ f(a_j, a_i)\}$. Now I understand that its highly unlikely that such thing would exist for any arbitrary function $f$, but are there any speedups that can be applied if a certain condition is satisfied by $f$?
I am ... |
I found the following problem in my textbook and I'm having trouble with coming up with a solution. I'm thinking maybe there's a way to improve Dijkstra's algorithm by using a data structure other than a priority queue, since that's what causes the log(n) time complexity, but I'm a bit lost. Here's the question:
Suppo... |
I have question about the ALUOp control signal.
When doing R type instructions, 31-26th bits are all 000000.
What decides the instruction is actually the func field of 5-0th bits.
In that case, I wonder why the ALUOp signals for the R type(add,sub,and,or,slt) below the table should all differ. I don't know why ALUcon... |
Here is a quote from the Source 1:
For example, if $M$ is a machine with an oracle for the halting problem, then obviously there isn't in general an equivalent machine that can simulate the oracle.
But here is a quote from the Source 2:
If you have an oracle for the halting problem, then you can compute the Bu... |
In trying to understand how to convert DCG's (Directed Cyclic Graphs) to DAG's (Directed Acyclic Graphs) without removing all the edges, I came across this paper which says:
Since the problem involves DCG, therefore a new algorithm to reduce the DCG into the form of a DAG should be proposed. It is simpler when no cycl... |
This is a question about Markov Models. Let's say we have the following situation
Let's say that we want to find the probability that $2$ rainy days follow a nice day. You'd simply have $0.25 \cdot 0.5=0.125=12.5\%$. However let's take it up a notch. What's the probability that on the $7^{th}$ day it's snowy? Or in ge... |
We have 2 periodic tasks that start at the same moment in a monocore processor.
Why can happen that, even if the utilization factor is <= 1, the 2 periodic tasks are not schedulable ?
For example, in this picture the 2 tasks are schedulable, but if i increase the computation time of the first task of 1 ms, we've got th... |
I have two array of the same set of elements, say for exemple:
$a_1 = [x_1, x_2, …, x_n]$ and $a_2 = [y_1, y_2, …, y_n]$ so that $i \neq j \Rightarrow x_i \neq x_j$
Is it possible, in linear time, to construct the array $[(x_1, k_1), (x_2, k_2), …, (x_n, k_n)]$ so that $y_{k_i} = x_i$ ?
I found that with dictionnaries,... |
I am given a boolean circuit of depth $D \ge \log n$ where $n$ is the input size.
Given an input, I need to find an algorithm that evaluates the circuit in space $O(D)$.
Now, assuming the fan in of each vertex is at most 2, I can set 2 bits for each vertex, one for the value of the vertex, and the other for which of hi... |
Consider we're given a set $S\subset \{0,1\}^n$ and we want to find a minimal subset $A \subset S$ under the property that if we bitwise OR all of the strings in $A$ we get the all ones string $1^n$. I have been having trouble finding a polynomial time algorithm for this or finding evidence that one doesn't exist (e.g.... |
I have an exam coming up and my teacher posted a practice exam for it. Problem is that I solved the question but I am not sure if I am doing it right or getting the right answer as he refuses to give us an answer key to confirm if we got it right or not. The question goes
Given a simple page table as the figure below... |
Here I am talking about the Functor category, which is defined as a category whose objects are functors and morphisms are natural transformations.
For reference: https://ncatlab.org/nlab/show/functor+category
I was wondering if it is possible to define this in Haskell.
If we define category like this:
class Category ca... |
Right now I am working on a distributed system that sends messages from single source to many nodes. It is necessary that certain messages are sent to the same node to ensure order of processing. Using simple hashing on an important piece of the message to decide which node to send to works but leads to significantly u... |
I have variables $a,b\in\mathbb R$ and if $a>1$ I want $b=1$ or else $b=0$.
Can this be encoded by linear programming (no integer variables)? Even $b<0.5$ and $b>0.5$ is ok.
|
A remarkable feature of the reduction showing that TQBF (True Quantified Boolean Formulas) is PSPACE-complete is that it actually runs in logspace, i.e. for any $A \in \mathsf{PSPACE}$,
$$
A \le_L TQBF.
$$
(See for example, comment at the end of section 7.4 in these notes.)
Therefore, TQBF is complete with respect to l... |
I read that the Babbage machine is Turing complete. Which means that no decision Turing machine will halt on the question "does the Babbage machine computes the logarithms of its input?" (for example).
The way I imagine that is there is no finite method (i.e. algorithm) which would examine the Babbage machine, possibly... |
The problem involves date intervals filtered by days of week. For example, the filtered interval {2001 APR 1 - 2001 APR 30, 17} corresponds to all Mondays and Sundays between April 1 and April 30. Here is the problem: given a collection of filtered date intervals, find a minimal collection of such intervals that cover ... |
Given: 3 positive integers $a,b,L$. Problem: Is there a positive integer $x<L$ such that $x^2≡ a(mod\ b)$?
The above problem is NPComplete (as mentioned in G&J) even if we have the factorization of $b$ given. My query is the following:
Is there some specific value of $a$ (say $a_0$) such that, if we limit the original ... |
We are using hyperledger fabric. We have a doubt like, is there any limit, of creating number of nodes while configuring hyperledger fabric?
|
Assume a point set $P[n]$ with $n$ points which align in one plane in the euclidean space, so $p(x,y) \in \mathbb{R}^2$. Looking for an algorithm to construct an AABB (axis aligned bounding box) I did not find anything. But I thought that the simpliest appraoch could be the best: traverse all $p \in P$ and keep track o... |
I have been trying to implement a Van Emde Boas tree in python, but I'm having trouble understanding how exactly it works. In the notes here, It states that the summary of a VEB structure is another VEB structure, and the individual clusters are also VEB structures. Does that mean that the individual clusters than also... |
Given a sequence of 1 and 0 elements, what is the number of possible partitioning of the sequence in sub-sequences (not necessarily consecutive elements, and any number of sub-sequences are allowed) so that any sub-sequence starts and ends with a 1, and can contain an arbitrary number of 0s?
For example: Given the sequ... |
I'm trying to learn for my exam and had the following practice question:
Take a code with the following code words.
101100010111
110001001001
101110111011
Errors of how many bits can be corrected?
The answer i received was:
The hamming distance is: 4.
Therefore only single bit errors can be corrected.
How did they ... |
I TA for a course in theory of computation and this came up as an interesting question.
$E_{TM}$ is the set of TM descriptions where the machine's language is empty.
Of course, $E_{TM}$ is undecidable for arbitrary TMs (as well as $A_{TM}$).
Now suppose we restrict our attention to decider TMs (ones that always halt).
... |
I'm giving a language
$L=\{0^m 1^n 2^m \mid m,n ∈ N\}$. I designed this stack machine in order to accept $L$.
Here, I'm skipping $1$s (no matter how many $1$s there are). Is it acceptable to skip the input this way?
|
I don't think so, because $A_{TM} = \{<M,w>\mid \text{M accepts w}\}$ is not Turing-decidable. Is this the right way to think about?
|
For the language, $L(aa^*ba) \cup L(abbb^*)$ and the grammar
\begin{align*}S&\to aAba \mid abbB\\
A &\to Aa \mid \lambda\\
B &\to Bb \mid \lambda
\end{align*}
Would the grammar above constitute as LL? I'm having trouble recognizing what exactly constitutes an LL grammar.
|
Suppose that we have multiple minimum paths from $u$ to $v$ of a graph $G=(V,E)$. Now, we take this paths and create a subgraph $G'=(V',E')$ where for each $v \in V$ and $e \in E$ we have that $v \in V'$ and $e \in E'$ if and only if $v$ and $e$ exists in one of the minimum paths.
Now, my question is:
It is possible t... |
I am trying to find the worst-case complexity of the following algorithm. The input to the algorithm is a list of positive integers $a_1,\ldots,a_n$ and a bound $C$.
$S\gets$ empty set
$k\gets0$
for $i\gets1$ to $n$ do
add $i$ to $S$
$k\gets k+a_i$
if $k>C$
$j\gets\arg\max_{i\in S}a_i$
$k\gets k - a_j$
remove $j$ ... |
Is Turing machine is robust ?
if it solved with one tape, can it solved with multi-tape?
I know that TM is robust but i can't understand why
|
If you do a quick search for suffix trees on Google, you'll find a bunch of sources saying that Don Knuth called them the "Algorithm of the Year 1973." However, I can't seem to find a source on this.
Is there a reference to a paper, communication, etc. where Knuth specifically says this about suffix trees?
|
When proving a language is non regular we can use Kolmogorov complexity.
As far I know to do this we just have to use this satisfy the following conditions
Given $Y^A_{x,n}$= the nth string $y∈Σ^∗$ (in lex order) such that $xy∈A$ (if n such y exits). So what completes $x$ if adding $n$ such y's brings us to an element ... |
I am trying to prove that bidirectional BFS could have a worse run time than regular BFS. I am confused on how this would be possible, considered bidirectional BFS always divides the run time in two, since it is executing two searches. Would a specific order of nodes and vertices have to take place in order to give bid... |
I am trying to calculate the complexity of the euclidean algorithm for finding the greatest common divisor (gcd) (recursive version).
Here's the pseudo code:
algorithm euclid(a,b)
if b = 0 then
return a
else
return euclid(b, a mod b)
end if
My initial thought is that every time the recursive function is calle... |
Say I have a list of $n$ integral intervals $[a,b]$ where each represents a set $S = \{a, a+1, \ldots, b\}$. An overlap is defined as $|S_1 \cap S_2|$. Example: $[3,6]$ and $[5,9]$ overlap on $[5,6]$ so the length of that is 2. The task is to find two intervals with the longest overlap in $o(n^2)$ using just recursion ... |
I am trying to write a Matlab (or C) routine for the exact probability F of observing K or more successes when a success probability P is expected ($\sum_{k=i}^n \binom{n}{k}p^k(1-p)^{n-k}$).
I am trying to figure out the following:
I need to know, if it shoud work for large numbers:
i.e. K=501000, N=10^6, P=0.5
Is... |
We are developing game of sprouts bot using min-max algorithm. We need a good heuristic function for evaluating the state of the game/player. Can someone please suggest?
|
Is Euclidean TSP strongly NP-hard? What I mean is if it is NP-hard with weights specified in unary?
Can someone provide a reference?
|
Decide whether the language $L$, defined by the following grammar is regular or not:
$S \rightarrow aab$
$S \rightarrow aacSb$
$S \rightarrow acSab$
$S \rightarrow acSacSb$
Where should I start?
I have tried defining a new language $L' = \{(aac)^n\ w\ b^n | w \in L\}$, which should be non-regular, because of dependenc... |
Are there examples of functions that can be defined computably, though the existence of their range is not computable?
|
Let $A$ and $B$ be two arrays of size $n$. How many pairs of indices $i, j$ satisfy $1 \le i < j \le n$ and $A[i] > B[j]$?
After quite a bit of thinking the best i had gotten to was make a for loop inside of another, which i don´t think it´s a good solution. So i´d like to know some ideas on how to implement this alg... |
Hi! I faced a problem with calculating IPC.
I can tell the answers were derived from IPC=instruction/number of cycles.
But I have no idea why it has to be calculated that way.
Just to understand the meaning of IPC, it seems like how many instruction
can one cycle(clock) handle which obviously is not the case for this ... |
Given a sequence of N activity durations, the time P of pause between activities, and D, the length of a day (there are no breaks between days, only between activities in a day), what is the minimum sum of the cube loss across all days and how many days are required for the solution. The activities need to be scheduled... |
My question is what the title says. Given an weighted directed graph $G=(V,E)$ and the minimum distance between two vertexes $u$ and $v$, I want to know if the distance between $v$ and $u$ is always the same in $G^{T}$ (the graph with all edges inverted).
I did some tests and couldn't find a graph where this is false, ... |
I would expect issues with the Facial Recognition technology to prompt evaluators to measure performance with metrics such as:
accuracy (e.g. false positives)
poor image quality input handling
speed of algorithm
What are the metrics used to gauge state of the art Facial Recognition? Please feel free to add the list
|
Given $Y^A_{x,n}$= the nth string $y∈Σ^∗$ (in lex order) such that $xy∈A$ (if n such y exits). So what completes $x$ if adding $n$ such $y$'s brings us to an element in the set $A$
Given $A \subseteq \Sigma^*$ has the following property, then it is not regular
For every $c \in \mathbb{Z^+}$ there exits $x \in \Sigma^*... |
I have a question regarding the banker's algorithm step 2. When it says the Need[i] <= work. Need is an n * m matrix and work is a vector of length m. I want to know what Need[i] <= Work means. Does it mean that I have to find the vector magnitudes of Need[i] and work and compare them?
|
I'm not quite sure when they would have the same asymptotic running time. Would it be if the graph was each node connected to one other node in a line? I know that for a bi-directional BFS to have a worse running time a star graph would work, but I'm not quite sure how they would have the same asymptotic running time o... |
Given n packets, each packet has b(i) bits and takes t(i) seconds to stream. We cannot send 2 packets at the same time. Given r > 0 and for each t > 0, the total number of bits we send from second 0 to t must be <= r*t (bandwith limit).
Example:
Given n = 3, (b1,t1)=(2000,1), (b2, t2)=(6000,2), (b3,t3)=(2000,1) and r ... |
Take a look at the following expression:
{(AnB)m|n>0,m>0}
Or, to put it simply: the words in the language, have repeating parts consisting of, some A's followed by a single B.
There are TWO school of thoughts about this, which can be broken down, by this question:
Is the word ABAAB, a part of the language?
I say, that... |
Is it possible to encode $y=0\implies G=0$ else $G=x$ by Integer Linear Programming where $x,y,G$ are integer variables?
The answer mentioned below gets to the point of taking absolute value of difference of two integers $a,b$. How do we get $|a-b|$ from ILP?
|
Here Nested loops are used, the time complexity of outer loop will be O(n) but how to calculate the complexity of inner loop as it depends on the value of i
|
Let's say we have given matrix $N\cdot N$, with zeros and ones only at $P$ position at it. We want to implement queries $q(x_1, y_1, x_2, y_2)$ which will return the number of ones in the sub-rectangle described with those two points. Since $N$ can be up to $10^4$ we cannot create standard DP matrix for answering the q... |
Is there a method to apply when trying to finding out the time complexity of a piecewise function?
\begin{align*}
F(x) &= \begin{cases} 2^x & x < 8, \\ x^2 & x \geq 8. \end{cases} \\
\end{align*}
This case seems straightforward as the function is $\Theta(x^2)$ for a large enough value of $x$, but what should be done in... |
With great pleasure I was just reviewing Marvin Minsky's publication "Steps Toward Artificial Intelligence" from 1961.
Now I would like to know whether there are any more compilations about the approaches to artificial intelligence with a similar depth and scope by authors with similar credibility, dating before or af... |
I'm currently working on designing a relatively simple processor using a custom ISA .
It will use interrupts for I/O .
From what i know , once the interrupt controller issues an interrupt , the processor acknowledges it and set it's PC to the IVT , from where it executes the relevant interrupt handler , which specifie... |
We have a set of $k$ path requests from $src$ to $dst$ that arrive sequentially.
Each request may have multiple paths, but can choose only one of them. For example, in the Figure shown, there are two paths from $s1$ to $s4$ i.e., path1 : $s1-s2-s3-s4$ and path 2: $s1-s5-s6-s4$.
Further, each node on the path has an a... |
So in reading I have come across the terms "InLeft" and "InRight" and I am unable to find a concrete definition for it.
I have found it used in the specification for COQ, and in some notes on compilers (there it was refered to as INL and INR).
As far as I am able to ascertain it is to do with making a difference betwee... |
Let the function cane and its auxiliary helping function down be the smallest functions satisfying the following requirement. For every x∈ℕ, for every y∈ℕ, and for p=(x,y), all of the following statements hold:
down(x+1,y)=(x,y+1)
down(0,y+1)=(y,0)
cane(p)= 0 if down(p) is undefined
cane(p)=1+cane(down(p)) if both down... |
Assume L is regular language, define 1 = {: ∈ , ∉ }, prove or dispute L1 regular or not ?
|
I've revisited trying to understand the proof to why NTM exists iff there is a verifier. I think I'm finally understanding the proof but I want to make sure and thus have some questions as follow up along with to check if I'm understanding.
For the forward implication (there exists a verifier $V$ and we want to show t... |
I have this task for Analysis of Algorithms module in university
$$
\begin{align*}
W, V &= \{v_1, v_2, v_n\}, S = \{s_1, s_2, s_n\}\\
G(W) &= \max~_{i:w_i\leq w} ~\{G(W-s_i) + v_i\}, G(0)=0\\
\end{align*}
$$
I am not sure what does the marked text mean in this recurrence formula. Because I think $W$ is a variable not ... |
So i came upon this thread :
https://gateoverflow.in/57631/relation-between-np-recursive-and-recusive-enumerable
and the guy says Every language in NP is recursive and Every language in NP is recursively enumerable.
but i dont get it, isn't NP the set of problems which we can only determine if a given answer is true ... |
I have a recurrece equation
Changed notations:
$\qquad\displaystyle G(W) = \max \{ G(W - s_i) + v_i \mid 0 \leq i \leq n, w_i \leq W \}$,
I am not sure if I understand $\ w_i $ correctly.
On each iteration my $ w_i \leq W $ . So my $ w_i $ will be previous $ W-s_i $ since G takes one argument?
|
I have the following problem:
given
a directed graph $G=(V,E,d)$, where $d:V\to\mathcal{I}(\mathbb{Q}_0^+\cup\{+\infty\})$ (here $\mathbb{Q}_0^+$ denotes the set of non-negative rationals and $\mathcal{I}(\mathbb{Q}_0^+\cup\{+\infty\})$ the set of intervals, bounded or unbounded above, with non-negative rational boun... |
what are the language that the DFA accept ?
so my approach for the first one is : a needs to be 4n+1 for all n>=0, #b%2=0
also i found out there some loops inside the DFA and a:b ratio is 3:1
but how do i write it formally ? L = {W |.... } ?
second DFA is that the word must end with letter b, there also few loops, so... |
What happens if I build the following mapping function from $A_{\mathrm{TM}}$ to $A_{\mathrm{LBA}}$ (LBA means linear TM with a limited tape space and $A_{\mathrm{LBA}}$ is decidable):
If $M$ accepts $w$ then returns an LBA which decides the language {'111'}.
Clearly if $(M,w)$ is in $A_{\mathrm{TM}}$ then $f(M,w)$ is ... |
So considering CYK is O(n^3) and since we can just use LR(k) algorithms for DCFG's which they can check if a string is in the language in O(n) then whats the usage of CYK?
is it being used anywhere?
If I'm not mistaken(correct me If I'm wrong) the benefit of CYK is that since we can convert any CFG to CNF form therefor... |
So in a book that I'm reading it says that we can convert any given Turing machine to a standard turing machine with only 6 states
furthermore we can convert any given to a turing machine with only 3 states given we have no limitation on which version of turing machine we use(multi tape, non deterministic, etc so its n... |
Given an undirected graph $G=(V,E,p,c)$ and a positive integer $k$, $p: V \longrightarrow R^+$ which associates a positive weights $p(v_i)$ to every node $v_i \in V$, and $c: E \longrightarrow R^+$ which associates a positive cost $c(e_{i,j})$ to every edge $e_{ij} \in E$. How can I find a subgraph $G'=(V_{G'},E_... |
I have encountered a problem that is essentially the textbook statement of the Traveling Purchaser Problem. I don't know if this is the proper place to put this, if not then I will delete it.
Also a note is that while I have done some studying on my own of computer science, I did not have much formal education in it... |
$L = \{w \in \{a, b, c\}^*\mid w\text{ contains at least one }a\text{ and at least one }b\}$.
what's the proper regular expression for the following language?
|
Suppose we have a sequence $s$ with $n$ elements from $s[1..n]$. I want to check if there exists $m \leq n$ elements in this sequence that each satisfy some simple condition (that can be tested in $O(1)$ for each $s[i]$), such that all of these elements are spaced apart by at least $k$. Is there an algorithm that can a... |
I've come across this problem and I can't find a decent DP solution for it.
Given an initial amount of money and a bunch of items to buy (where each item has a 'value' and 'price' assigned to it), maximize the total 'value' such that the money spent does not exceed the initial money. With the exception that if the tota... |
How to solve the recurrence $T(n) = T(n/2) + T(n/4) + T(n/8)$?
We assume that $T(n)$ is constant for sufficiently small $n$.
|
1 for(i=1; i<=n; i++){
2 for(j=1; j<=n; j*=2){
3 a[i][j]=b[i][j-1]+1;
4 }
5 }
line 1 : n+1 times
lnie 2 : n/2+1 times
line 3 : constant time c
so, I computed $(n+1)(n/2+1)c=(n^2+2n+2)/2+c=\theta(n^2)$
Is it right computation?
|
I had this question in my HW:
Prove of disprove: If $L_1$ and $L_2$ are non-regular context free languages then $L_1 ∪ L_2$ is not regular.
My intuition is that it is wrong. I thought about the following two languages:
$L_1 = \{a^ib^jc^k : 0 \leq i \leq j \leq k\}$ and
$L_2 = \{a^ib^jc^k : j<i \lor j>k\}$.
The unio... |
I don't understand the proof of below sentences.
$O(f(n))=O(g(n)) \iff \Omega(f(n))=\Omega(g(n)) \iff \theta(f(n))=\theta(g(n))$
$f(n)=\theta(g(n)) \iff g(n)=\theta(f(n))$
How can I prove these statements?
|
Can I prove following statements with using available automated theorem provers?
$(a+b)^2=a^2+b^2+2ab$.
If $ 11 \mid 2a-3b$, then $ 11 \mid 7a-5b $.
If $ ax^2+bx+c=0$, then $x=\frac{-b\pm\sqrt{b^2-4ac}
}{2a}$.
If $a$ is even then $4a$ is even.
and so on!
I am asking this question because I just found the applicati... |
How to prove that the language over the alphabet $\{0, 1, +, =\}$ is regular or not:
$\{a+b=c:a,b,c \text{ are integers in binary for which } a \text{ plus } b\text{ equals } c\}$
I started with the pumping lemma:
|$y$| ≥ 1
|$xy$| ≤ $p$
for all $i$ ≥ 0, $xy^iz$ ∈ $L$
But I don't know what to do next. How can split ... |
So I have this algorithm that outputs the largest value of an array:
Input: $A[1,\dots,n]$, $n\geq 1$
Output: Largest value of an array
Maximum (A)
m = A[1]
i = 1
while i < n
if A[i+1] > A[i]
m = A[i+1]
i = i+1
return m
I have to prove this algorithm wrong and I'm confused how to do that, be... |
We are given NFA $A$, which for every input word $w$ has at most 10 runs over word $w$, beginning at the starting state.
Show that there exists an algorithm, that converts such NFA to DFA in polynomial time. We don't need that algorithm to work if given automata is not such a NFA.
I think we need to construct DFA wit... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.