instruction stringlengths 35 29.1k |
|---|
I was given an assignment in which I had multiple recurrence relations and I had to find their Big-oh time complexities. Nearly all of the recurrence relations were of the form as under:
$$T(n)=aT(n/\alpha)+bT(\beta n/\alpha)+f(n)$$
So I tried to find the general Big-oh complexity, so that I could solve each one just... |
Given an arbitrary (potentially ambiguous) context free grammar $G: \mathbb{G}$, and string $\alpha: \Sigma^\ast$, is there a decision procedure that returns whether appending and/or prepending symbols can alter the parse forest of $\alpha$? In other words, we want a function $F: (\mathbb{G} \times \Sigma^\ast) \righta... |
So I have an undirected graph G(V, E). We may assume there is always at least one path between any two vertices. I want to efficiently check if there are at least 2 different paths between x and y that have no vertices in common. (I'm pretty sure that) Equivalent problem would be to find if all paths between x and y go... |
What is the smallest NFA that could be design for a^n where n!=1003?
I have been racking my brain at this for a while but still can't reduce the number of states required from 1004. Here state(1003) will be a rejecting state and all the other previous state will be accepting state. A transition from state(1003) to stat... |
While working on a math problem the following tree structure came up:
o
\
o
/
o
/ \
o o
/ \ /
It is a binary tree with the following constraints:
all nodes except the root have a left child
all left-child nodes have a right child
none of the right-child nodes have a right-child
It als... |
I am looking for an efficient CNF encoding of the following situation: I have sets of boolean literals $A = \{ a_1, \ldots, a_m \}$, $B = \{ b_1,\ldots, b_n \}$ and subsets $B_1, \ldots, B_m$, where for all $i$ we have $B_i \subseteq B$ and $|B_i|\le 10$. I would like to encode the constraints
$$ a_i \to \bigwedge_{b \... |
If $L$ is a decidable language, $M$ is a Turing machine that determines $L$. For $\forall s \in L$, M accepts, and for $\forall s \in \overline{L}$, M rejects
However, my question is that
If $L$ is a recognizable undecidable language and $M$ is a Turing machine that recognizes $L$, for $\forall s \in L$, M accepts and ... |
Let $L$ be an arbitrary language in $\Sigma_3$. Thus it can be written that $x \in L \Leftrightarrow \exists y^{p(|x|)} \forall z^{p(|x|)} \exists w^{p(|x|)} \langle x,y,z,w \rangle \in B$ where $p(\cdot)$ is some polynomial function and $B$ is some language in $P$.
While giving a reduction from $L$ to $\Sigma_3$-SAT o... |
Consider array $A=(a_1,a_2,...,a_n)$ such that $a_i$s are positive integers. Moreover, we have $k$ binary tuples, each with length $n$. In each iteration, we choose one of those tuples, and decrease it from the array. For example, if $A=(5,7,4,2)$ and we decrease $(1,0,0,1)$ from it, it will become $(4,7,4,1)$. We cann... |
When using the Baum-Welch algorithm to train a hidden markov model you normally repeat it on some observed sequence iteratively until your values converge.
If you have multiple observed sequences, Wikipedia tells you to run the update on all sequences in parallel and then combine them into a new model and then apply th... |
Hi i am practising standard theta notation:
How could i find the standard theta notation of the following :
2n + 3n^2(log n)^3 + 2
and
((2n^2 + 7n+5)(7n+1))/7
So far i have used the "drop constants and find dominating term" strategy where we remove the constants from the expressions and then we find the biggest and d... |
I understand range updates in segment trees using lazy propagation where each node is an integer.
Merge Sort Tree (source GFG): https://media.geeksforgeeks.org/wp-content/uploads/20220722205737/MergeSortTutorial.png
But when it comes to merge sort trees (segment tree of sorted arrays as nodes), how does one perform ran... |
I want to study the reduction from the Diophantine Equation Problem (Hilbert's tenth problem) to the Halting problem.
Can you either explain it to me or give me a credible source from which I can study it?
|
I was watching some lectures by Prof. Pfenning on Proof Theory. Between 5:30 and 15:00, he gave a list for some different kinds of judgments along with their calculus and computation phenomena that they can represent or model. I am looking for a more comprehensive list. I would like to compare and know the advantages a... |
I am writing an N-body simulation in C++ that has to be able to deal with large N ($N \le 10^6$).
Everything has been going well so far, but now that I have started to code in collisions between bodies (which can result in mergers - which means that one body is added to the system and two are removed) I cannot help but... |
The definition of P is given by the union of all DTIME($n^k$) languages for $k >= 0$, where DTIME($n^k$) is the set of languages for which there exist a TM time-bounded by $T(n) = O(n^k)$. However, this is where my confusion lies - if $T(n) = O(n^k)$, then $T(n) <= c.n^k$ for $n >= N$; but does this mean the TM can run... |
My idea was that it is because we can construct a TM M' that simulates a TM M that is to find a solution for a PCP instance. M' accepts if M accepts, rejects if M rejects, and doesn't halt if M does not.
But I'm confused about the fact that in such a way we can also construct a TM M'' that simulates M. It rejects if M... |
I was studying the Barrington Theorem in https://homes.cs.washington.edu/~anuprao/pubs/CSE531Sp2020/lecture2.pdf when I found a doubt regarding permutations. Particularly, with conjugations.
It is said, in the 2nd page, 4th point, that two cyclic permutations $\pi$ and $\sigma$, always have a permutation $\tau$ s.t. $\... |
I am working on a problem that asks me to write an LR(1) grammar that satisfies the following rules:
Consider a robot arm that accepts two commands: $\triangledown$ puts an apple in
the bag and $\triangle$ takes an apple out of the bag. Assume the robot arm
starts with an empty bag.
A valid command sequence for the rob... |
Given a group of cities and a starting city, we have to find a path that covers all the cities. The path doesn't need to end at the starting city. Is this a TSP problem? What is the solution for it?
This is not a homework problem or an interview question. I asked ChatGPT to find the shortest paths covering 5 random cit... |
I'm studying for the Algorithms and Computability course. I have encountered a problem that I cannot solve and cannot find any materials to help me solve it. It's the following PCP problem:
We have two sets:
A = (b, a, ca, bac)
B = (ca, ab, a, c).
The task is to find a solution to the given PCP problem or prove that th... |
Given a number n, the task is to find the XOR of every number from 1 to n. Why does the following algorithm work?
Find the remainder of n by moduling it with 4.
If rem = 0, then XOR will be same as n.
If rem = 1, then XOR will be 1.
If rem = 2, then XOR will be n+1.
If rem = 3, then XOR will be 0.
|
I was wondering if the combination of Horn-SAT and XOR-SAT is solvable in polynomial time or not.
It seems they can be solved in polynomial time as both are in class P and also that Horn-SAT is P-complete thus XOR-SAT must be reducible to HORN-SAT .
Just want to clarify if that's the case.
By,HORN-sat with XOR relation... |
In this paper they prove that the number of rotations after doing $n$ insertions or deletions to a weight-balanced tree is $O(n)$ (when starting from an empty tree).
What isn't clear to me though is how many times each node becomes the new root of a sub-tree after a single or double rotation takes place. Intuitively, I... |
Use equation (3.14) or other means to show that $(n+o(n))^{k}=\Theta\left(n^{k}\right)$ for any real constant $k$. Conclude that $\lceil n\rceil^{k}=\Theta\left(n^{k}\right)$ and $\lfloor n\rfloor^{k}=\Theta\left(n^{k}\right)$.
Where equation (3.14) is:
$1+x \leq e^{x}$
|
In this post,Monotone$(+, 2^-)$-SAT problem is defined as follows:
Given a monotone CNF formula $F^+$, where each variable appears exactly once (as a positive literal), and a monotone 2-CNF formula $F_2^-$ defined on the same variables as $F^+$, where all variables are negated. Is $F^+ \land F_2^-$ satisfiable ?), let ... |
Prove that:
$\lg (\Theta(n))=\Theta(\lg n)$
|
Say for example I'd like to state that there exists a pair of vertices such that they form an edge in one graph but not some other graph. I'd go about it as follows:
$$ \exists u, v \in V, (u,v) \in G, (u,v) \not\in H $$
My main question here is: Is my use of commas fine (it seems odd, since there's commas between $u$ ... |
The Question
I define the language$$\mathsf{2-SIMPLE-PATH}=\left\{ \left\langle G,s,t\right\rangle \left|\begin{array}{c}
\mathsf{there\;are\;two\;different}\\
\mathsf{simple\;paths\;from}\;s\;\mathsf{to}\;t\;\mathsf{in}\;G
\end{array}\right.\right\} $$
where $G$ is a directed graph.
it's easy to show using a reductio... |
The problem is to find the shortest distance in a weighted graph, where the weight of each edge is non-negative and it is given that the weight of each edge is less than a constant C. For example, C = 500.
I know that I can solve this problem using Dijkstra, however, the time complexity would be high. The problem shoul... |
As the question suggest. I want an algorithm that runs in linear time which finds the longest prefix of a substring that is a sub-prefix of the same string.
Formally:
Given a string $S$ of length $n$, we define a function $\delta_{S}:$ $[n]\rightarrow[n]$ as follows. For each integer $w$, $1\le w\le n$, $\delta$ is de... |
What are some recent breakthroughs in computer science? I am especially interested in research which have received inadequate attention or attains significant improvements over previous approaches.
|
How do manufacturers lock their devices to run only software by them? And how is it possible at all? For example: upgradeable toothbrush, mobile device, smart watch
|
I want to know if there exist a algorithm to efficiently compute the number of odd vertex in an undirected graph?
A graph vertex in a graph is said to be an odd vertex if its vertex degree is odd, degree of a graph vertex v of a graph G is the number of graph edges which touch vertex v.
This post conclusion seems to be... |
I am new to reinforcement learning, and recently came across the following issue. When implementing a multi-armed bandit algorithm, we assume we have k machines with reward probabilities [p_1,..., p_k] which we try to approximate. While these probabilities are clearly unknown to the player himself, they must still be e... |
if L is CF does that mean L interaction L reverse is also CF? thats the whole question since CF is clsoed for reverse it makes sense but there are alot of refute out there for interactions, so I was wondering how can i prove it ?
|
We have $c$ arrays of positive integers, named $j[1],j[2],j[3]..,j[c]$. We know that the length of $j[i]$ is $c-i+1$. In addition, the sum of the numbers of $j[i]$ is greater than or equal to the sum of numbers of $j[y]$ if $i \leq y$. Moreover, we have $k$ tuples, each with a length of at most $c$. If we use a tuple $... |
Let $\ast$ stand for "type" and $\square$ stand for "kind" so that $\ast:\square$. Suppose I want to find an inhabitant of $\Pi x: A.\Pi y:B(x). \ast$. The derivation rules are given here.
Intuitively, as far as I understand, this inhabitant should have the form $\lambda x:A.\lambda y:B(x). P(x,y)$ for some $P: A\to B(... |
Some devices (for example Android devices) are "locked", the bootloader checks following bootloader/software sign, right? Chain of trust. Signing technically means that the file must be encrypt with one (private) key and decrypted with another (public) key.
The software is compiled to executable binary and if we then s... |
Aho-Corasick can result in a quadratic number of matches because it finds all occurrences of each searched-for substring. What is a faster algorithm or modification to this one to simply determine if there is any occurrence for each of the substrings?
|
To my knowledge a Turing machine is able to compute anything considered computable.
I got the definition of Turing completeness from this answer Explain the difference between Turing Complete and Turing Equivalence
If so, how can one achieve Turing completeness?
Why is the Turing machine (a machine that can compute any... |
While I know that every edge is fully saturated in every min-cut of a network flow, I'm trying to get some intuition when the converse is true.
I can find an example using edges with infinite capacity, but is there any way to generalize this idea?
Are there graphs where every saturated edge is part of some min-cut?
EDI... |
When adding two 2D matrices of the same size (in row major format), in sequential code with no vector operations, is it faster to add them column by column or row by row?
At first I thought it would be faster to add them row by row, but now I'm thinking it would be faster to add them column by column. If you have the f... |
My textbook claims the worst-case running time of Shellsort with Shell's increments is $Ω(N^2)$, but this analysis is done when $N = 2^m$ for a positive integer $m$. I see why the proof would work for those cases of $N$. The reasoning for the proof does not appear to, in general, hold for arbitrary $N$. However, the de... |
Given the challenge of proving algorithmic bounds on the likes of 3-SAT to resolve P versus NP, I wondered whether it might be possible to use undecidability within an NP problem to ensure that we can never find any algorithm as an alternative to brute force. I couldn't find any references on this type of idea.
After p... |
There's a question I've long had about reversible computing: do non-trivial algorithms usually end up generating strongly pseudorandom data as an artifact of the computation?
The most straightforward example of this would be if you used Fredkin gates or equivalent to wire together a binary multiplier circuit. My unders... |
The path-convergence criterion states that there should be a φ-function for variable
a at node z of the flow graph exactly when all of the following are true:
There is a block x containing a definition of a,
There is a block y (y $\neq$ x) containing a definition of a,
There is a nonempty path $P_{xz}$ of edges from x... |
Recently, I am reading paper An Upper Bound for Resolution Size: Characterization of Tractable SAT Instances, which use tree decomposition to give an upper bound for SAT resolution refutation.
For a given nice tree decomposition $T=(V(T),G(T))$.
My question: Why $O(3^{treewidth})*V(T)$ is still $O(3^{treewidth})$
my qu... |
I'd like to know if there's a reduction $\mathsf{ALL}_{\mathsf{TM}}\leq_{m}\overline{\mathsf{ALL}_{\mathsf{TM}}}$ where of course $\mathsf{ALL}_{\mathsf{TM}}=\left\{ \left\langle M\right\rangle \mid\mathsf{L}\left(M\right)=\Sigma^{*}\right\} $
All attempts I've tried failed - if for example I try to define the reductio... |
I have a language $L$ which is NP-hard and I have another language $L_1$, s.t. if I take an instance $q$ of the decision problem corresponding to $L$, and if one of polynomially many instances, $f_1(q),\ldots,f_{p(|q|)}(q)$ is in $L_1$, then $q\in L$.
Is this enough to say that $L_1$ is NP-hard?
|
I hope someone can help me with that:
$$T(n)=T(2^{\sqrt{\log n}})+1$$
I will be asked to answer what is the runtime complexity of the algorithm.
I tried to set m=2^ and still failed.
|
for a language $L$ we define $rev\left(L\right)=\left\{ \sigma_{n}\cdot\ldots\cdot\sigma_{1}\mid w=\sigma_{1}\cdot\ldots\cdot\sigma_{n}\in L\right\} $.
My question is, are $\mathsf{L,NL}$ closed under this operation?
Meaning, for example, that if $L\in\mathsf{L}$ is $rev(L)\in\mathsf{L}$?
I think the answer is yes if w... |
We know that the K-median problem is proved to be NP-Hard. In fault-tolerant K-median problem on an undirected graph $G=(V, E)$:
We are given a set of facilities $F\subseteq V$ and a set of demands (or clients) $D\subset V$ in a metric space. We can open at most $k$ facilities and then assign each client $j$ to the $r... |
subject: pairing numbers and intervals
Let NUMBERS be a list of n integer numbers. The numbers are listed in no specific order. Duplicates are possible.
Let INTERVALS be a list of m intervals. The low and high limits of the intervals are integer numbers. The intervals are listed in no specific order. Duplicates are pos... |
Main Problem
Given an array $A[1...n]$ ($n \geq 3$) of distinct integers with at least a local minimum, output a local minimum.
A local minimum is an integer $1 < i < n$ such that $A[i-1] > A[i] < A[i+1]$.
Find an $O(\log n)$ algorithm or prove such an algorithm doesn't exist
Notes
It could be useful to have an $O(1)$ ... |
I'd like to decide whether, given a connected graph $G = (V, E)$ and an integer $k$ as input, $G$ admits two vertex-disjoint subgraphs $T_1 = (V_1, E_1)$ and $T_2 = (V_2, E_2)$ such that $T_1$ and $T_2$ are trees, $V_1 \cup V_2 = V$ (so in some way they are spanning), and $|V_1 - V_2| \leq k$ (they aren't too different... |
We are learning of the Ford-Fulkerson Algorithm for max-flow/min-cut, and I have been wondering of the following question:
How do we exactly find which nodes are on the "sink" side of the min-cut produced using the algorithm?
I have read here
https://www.geeksforgeeks.org/minimum-cut-in-a-directed-graph/
that all node... |
I was playing around with https://visualgo.net/en/maxflow when I realized a pattern:
Take this graph, for example. We notice that the min-cut divides the graph into two sets of nodes: {0, 2, 3, 6} and {1, 4, 5, 7}.
I noticed that choosing any node within {0, 2, 3, 6} as a source and {1, 4, 5, 7} as a sink, or vice ver... |
What is the definition of the term "small systems" in the context of computer science? My professor didn't really define the term, they just gave examples of some small systems. I'm having a hard time finding a concrete definition of the term online. This is not a homework question. I just want to know the definition s... |
Suppose I'm given a set $S$ and antichain $A \subset 2^S$ ($\forall a_1,a_2\in A: a_1\neq a_2 \iff a_1 \nsubseteq a_2$).
Let's call subset $b \in 2^S$ covered by $A$ if $\exists a \in A :b \subseteq a $.
I'm looking for a way to answer "What part/what percentage of $2^S$ is covered by $A$?"
Due to $|S|>100$, it's infea... |
Suppose there is an array $A[1..n]$.$A$ contains a permutation of $\{1,2,3,\dots,n\}$.
We run the following algorithm $m$ times to sort $A$:
for each odd index of $A$ from left to right ,respectively, put $A[i]$ be the minimum of its and right adjacent (if exists). Also we store index of larger number for $A[i]$.
fo... |
I have been trying to find a a CFG for this language generated.
I came to the conclusion that I need three parts
When $i \le j$
When $j < 2j < i$
When $j < i < 2j$
I was able to come up the production rules for 1 and 2 but I'm getting stuck at 3.
I thought I found a solution in Context Free Grammar for $\{a^ib^j | i,... |
Summary
Recently I have had a path-finding puzzle that has some complex constraints (currently, I don't have any solution for this one)
A 2D matrix represented the graph. The length of a path is the number of traversed cells.
One or more number sequences are to be found inside the matrix. Each sequence is scored with ... |
I Hope someone Can help me with that:
$T(1)=2$
$T(n)=\left(T(\frac{n}{2})\right)^2\cdot2^n $
what is the runtime complexity of the algorithm (base 2)
Thanks a Lot!
|
This is more for my curiosity than anything else as I understand how to find the two's complement of a binary number via the standard approach which is to convert all 0s to 1s and 1s to 0s and then add $1_2$, but this "quick method" truly puzzles me. I see that the author of the book I am going through suggests that th... |
I understand the complexity of the issue in the event that P = NP: in this case, we couldn't prove it "by example" - it's simply impossible to sort through all possible tasks. The proof that, for all NP-complete problems, checking a solution is not easier than finding it, apparently, should be very non-trivial. However... |
I am reading Michael Sipser's book Introduction to the Theory of Computation and in the section 2.4(chapter 2 and DCFLs section) there is a proof for the lemma that says "Every DPDA has an equivalent DPDA that always reads the entire input string."(lemma 2.41, page 132 in the 3rd edition of the book). I have read this ... |
I am trying to prove that the following statements are true:
* The average time complexity of the quick sort is O(n log2 n).
* The average time complexity of the randomized quick sort is Θ(n log2 n).
* The worst case time complexity of the quick sort is Θ(n^2).
* The worst case time complexity of the randomized q... |
I want to prove that, $$\sum_{i=0}^{h}{2^i\times(h-i)} \sim O(2^h).$$
I did come up with the below proof,
$$\sum_{i=0}^{h}{2^i\times(h-i)} \sim O(\sum_{i=0}^{h-1}2^{h-1}) \sim O(h2^h),$$
but as it is clear I did not find the correct path for my proof.
|
I know that if $P=NP$ then all of the languages in $NP$ are $NP-Complete$, but what about those in $P$?
I assume yes, because $P \subseteq NP$, but I just want to check.
Thanks!
|
Consider the following exercise from chapter Dynamic Programming in the book Algorithms by Jeff Erickson.
Let $D[1 .. n]$ be an array of digits, each an integer between $0$ and $9$. A digital subsequence of $D$ is a sequence of positive integers composed in the usual way from disjoint substrings of $D$. For example, $... |
Let $G$ be an undirected graph with an infinite number of vertices (and edges), and assume it is connected in the sense every $u,v$ have at least one path connecting them. Assume each vertex has a finite degree. My question is: Is it possible for a pair of vertices to exist, such that they will have an infinite number ... |
I know that $A_{TM}=\{<M,w>|M~is~a~TM~and~M~accepts~w\}$ is NP-Hard:
By showing a polynomial time reduction - $A \le_p A_{TM}$:
Let $A \in NP$, then there exists a $NTM$ that decides $A$ in polynomial time, thus there exists a $DTM$ $M_A$ that decides $A$ in exp time.
Then $f(w)=<M_A,w>$ is the reduction, so $A_{TM}$ ... |
I'm reading this book, and there's something basic that I don't exactly get. The authors say that every common noun is declared to be a type. For example, $Human:Type$. Then, they give an example of semantics of an intransitive verb, which is $talk: Human \to Prop$, where $Prop$ is "the internal totality of all logical... |
I was recently playing around in Python, and I wrote a program to check if a given number is prime. It works by checking to see if its divisible by each number other than 1 leading up to itself. It works well for small numbers but for very large numbers it takes a very very long time. I was wondering if there are progr... |
I need help in finding a more performant algorithm.
I have two timelines in the form of two indexed lists where each element is a floating-point value that represents seconds. The values in each list are only growing with higher indices. Each list has about 2000 elements.
From every timeline, I take two indices and thu... |
I have thousands of short arrays (length less than 9) holding integers. These numbers can be identical with high probability (in many arrays there are two triples of equal numbers). I need to remove the duplicates in each array, as efficiently as possible.
An obvious solution is to sort using a fast sort (such as strai... |
I'm trying to find an algorithm to update minimal top-down tree automata/hypergraphs.
Regular tree grammars can be seen as definitions for recursive data structures:
List -> cons(Bool, List) | nil()
Bool -> true() | false()
By minimal I mean that distinct nodes should generate distinct term languages. Intuitively thi... |
Let $\begin{bmatrix}0\\ 0\end{bmatrix}$ be a two-column vector with $0$ in the first row and $0$ in the second row.
Let $\Sigma_2 = \left\{
\begin{bmatrix}0\\ 0\end{bmatrix},
\begin{bmatrix}0\\ 1\end{bmatrix},
\begin{bmatrix}1\\ 0\end{bmatrix},
\begin{bmatrix}1\\ 1\end{bmatrix}\right\}$
be the set of all 2-element colu... |
Before an exam in Computability I go through questions from last year's test.
So the question is:
$$A= \{ \langle M\rangle x | M \text{ is a TM and accepts } x \}$$
$$ L = \{ \langle M \rangle | M \text{ is a TM and halts only on words starting with 101 } \} $$
Prove by reduction that $L$ is undecidable. So this should... |
Assuming unbounded memory, it seems many data structures can contain an arbitrary finite number of members. However, how they store data differs. In particular, it seems useful to represent the said "how" by an ordinal. For examples:
The list data structure is represented by the fixpoint of $O = 1 + O$, which is $\ome... |
I know that if there is a Turing Reduction from $A$ to $B$, say $A \le_T B$, and $B \in R$ then $A \in R$.
I also know that Turing Reduction is for Decision, and not Recognition.
Is it possible to design a new type of reduction, such that if $B \in RE$ then $A \in RE$ ?
Thank you!
|
Given the following code:
int f3(int n)
{
if(n <= 2) return 1;
f3(1 + f3(n-2));
return n - 1;
}
I was trying to find the time complexity and I got this expression: $T(n)=1+T(T(n-2))$ which I've never seen before.
I know the answer is $O(2^{\frac{n}{2}})$ but I have no idea how to get there. Can anyone explain... |
I am working on designing a DFA with the language $a^i b^j c^k$ such that $i + j + k$ is odd
I thought along the following lines:
$i+j+k$ is odd $\Rightarrow$ two of them are even and one is odd or all of them are odd. But designing a DFA like this will lead to a complex and big DFA. I am not sure if there is a simpler... |
I am interested in the following problem
Input: A boolean function F with n boolean inputs and m boolean outputs.
Output: A circuit C implementing F such that C has as few gates as possible.
The function F could either be given as a boolean truth table, or more likely, another circuit D.
I realize that this is a prot... |
I know that a computer can be mechanical, screws/nuts or even water/pipes. Of course, it would be slow and big, but it doesn't have to be electric, transistors, etc. How can a machine like this do all that it does? I can't understand.
I would like a thought path for this, analogy. Especially one where I can think it as... |
Given an NFA with more than one initial or final state, it is possible to convert it to another NFA with only one initial or final state by using epsilon transitions. To remove the epsilon transitions, we may need to add final or initial states, depending on the method used (backwards removal vs forward removal).
Is th... |
Suppose we are given an array-based list data structure. Suppose that its initial capacity is
$m > 0.$ When appending an element to the end of the list, if the list is full, we extend its capacity by $d > 0$ array components, copy the old content, and finally append the element. Suppose we are to append $n \geq m$ elem... |
I am a total noob to programming, and one of the basic ideas in Haskell is how one can define new types using some things called constructors. I haven't quite understood it fully, but why would one want to make any types beyond the basic ones? What practical utility does it hold?
|
Let A[1 : n] be a vector of n integers such that all elements except O(n^2/3) elements are between 1 and 10n. Design an algorithm with linear complexity that sorts A.
Beyond the algorithm, what I can't fully understand is why we are provided with the information "all elements except O(n^2/3)" It is certainly an informa... |
Hoare Triple formalizes program correctness, which contains postcondition, program and precondition such as $\vdash P \{Q\} R$
Provided code snippet:
i := 0;
s := 0;
while i < N do
s := s + max(arr[i]);
i := i + 1;
od
The program's goal is to compute the sum of the maximum integers obtained from each element $a... |
I have two arrays that both contain $n$ elements (positive, non zero, not negative)
$\{x_1\dots x_n\}$
$\{y_1\dots y_n\}$
I want to pair them up optimally, one from each array, so that the pairs come out as even as possible, when paired up optimally. I want the difference between the highest sum of pair values and the ... |
Assuming $G=(V,E)$ is a 3-colorable graph, then there are 3 disjoint independent subsets of $V$: $S_1,S_2,S_3$ such that $S_1 \cup S_2 \cup S_3=V$, by taking each $S_i$ to include the vertices of color $i$.
I wanted to know - if $G$ is not 3-colorable, then can it has 3 disjoint subsets that their union is $V$?
I think... |
The complementary language of a recognizable undecidable language is not recognizable.
If the complementary language of an recognizable language is a non-recognizable language, is the recognizable language a non-decidable language?
|
This post introduces a new variant of 3-SAT called EQUAL-3-SAT, where the number of 3-Literal clause is equal to the number of variable.
Consider the 3-SAT problem where the formula is in conjunctive normal form and we restrict the Boolean formulas such that the number of clauses in the formula is equal to the number ... |
I was provided with the solution to the language being represented. An example of accepted input would be [001][101]. The DFA that would recognize this language is below.
What do the states represent? What are the meaning of the transitions
|
What is the optimal time complexity for an algorithm that solves the Longest Increasing Subsequence problem?
I am aware of the O(n log n) algorithm mentioned in textbooks (and on the Wikipedia article). Can we do better? Is it possible to solve this problem in O(n) time?
|
Say they are two tokens, A and B. A has probability weight 0.99 (and B has 0.01). If I want to encode the sequence "AAA", wouldn't the binary encoding just be "0"? And wouldn't that be the same for encoding "AA", or "AAAA", or an number of A's? How is the decoder supposed to know how many A's are sent when all it recei... |
A decidable language must be recognizable.
Unrecognizable languages must be undecidable?
I want to know more about the relation of undecidability and unrecognizability
|
From my understanding, the general implementation of an adjacency list is using a hashtable with vertices as keys and linked lists to as values in the hashtable to represent the adjacent vertices of the key. It is also said that the time complexity of finding all the neighbours of a given vertex in the graph using the ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.