instruction stringlengths 35 29.1k |
|---|
I have a graph and don't know how nodes in it are connected to each other.
I know the number of nodes in the graph.
I know the degree of each node in the graph.
I know that given any node $A$ that any other node $B$ is $n$-connected (where $n$ may vary per $B$) to a sub-graph containing $A$. So if I trim $n$ specific ... |
How can we construct the algorithm to evaluate the logarithm of a real positive number bit by bit in the base 2 system?
I have first expressed any number as $x\cdot2^n$, where $x \in [1,2]$, by shifting the binary points. But after that, I am not sure what to do.
|
I am learning how to extend a basic Hindley-Milner type system to support overloaded variables by following Geoffrey Seward Smith's dissertation.
The proposed type inference algorithm makes use of the "least common generalization" (or LCG) of an overloaded variables types and cites this Reynolds paper as providing an a... |
Let $G$ be a non-complete weighted (only positive weights) undirected connected graph. I'm trying to find a path such that it visits all nodes at least once (repeating nodes is allowed), and it's the shortest one. Length of the path is defined as the sum of weights of all traversed edges, including the repeated ones. T... |
Say I have two noisy / lossy streams of symbols of the same data. Essentially, I want to match up the two streams as best as possible. For example, say I have:
s1 = 1 2 6 3 8 0 4 3 2 7 6 2 ...
s2 = 1 2 3 6 3 9 3 2 7 6 2 ...
and I'm essentially trying to end up with this:
s1 = 1 2 6 3 8 0 4 3 2 7 6 2 ...
| | ... |
My problem is the following: I have $N$ inner products to compute in parallel every second.
Each of the vectors in those inner product is composed of $7$ bits.
I want to know for which $N$ it starts to become computationally intensive to do that, let's say that a supercomputer would have struggle to follow it.
I know t... |
It is known that Graph Isomorphism is important in chemistry (studying molecule structures) and in chip design. Are there other applications of significant practical importance, and how much money is involved?
Is the industry interested in new efficient algorithms, or WL and DeepWalk are enough? Having a new efficient ... |
My professor gave an introduction to the arithmetic hierarchy via Turing reductions, stating that, for instance, $\Sigma_2 = \text{r.e.}^\text{r.e.}$ (namely an $\text{r.e.}$ pseudocode with access to an $\text{r.e.}$ oracle) or $\Pi_3 = \text{co-r.e.}^{\text{r.e.}^\text{r.e.}}$. Later, the equivalent formulation via a... |
When you release your IP address using the ipconfig/release command and then renew with ipconfig/renew, the computer will request and receive the same address you had previously.
Why is this so?
How would you (what commands would you use) so that your computer will not request the same address?
|
Let $H_{1}$ and $H_{2}$ are two hypothesis classes over some domain $X$1.
If both $H_{1}$ and
$H_{2}$ have the uniform convergence property, then do $H_{1}$ U $H_{2}$ have uniform convergence?
|
People have recently started talking about "differentiable programming". I have listened to some people talk about this at a philosophical level, but I don't see the practical difference between this and just existing Autograd libraries like PyTorch.
I understand that (at least according to some interpretation of "diff... |
I found this paper http://nomis80.org/ctmf.pdf, that describes an efficient algorithm for applying a median filter to an image. Though this works for non-HDR images, I am not sure how well it scales in HDR scenarios. The concern is that if the dynamic range is extended, it is no longer true that the number of intensity... |
I am looking at the proof of the Cook-Levin theorem in Computers and Intractability: A Guide to the Theory of NP-Completeness. In particular, I find one thing unclear. He constructs the statement that is satisfied if and only if transition from step $i$ to step $i+1$ is correct. It goes as follows:
So essentially thes... |
An undirected tree has $n$ nodes and some nodes contain a fruit. How many ways can we remove edges from the tree such that each sub-tree has exactly one node with fruit in it?
I found this question in an algorithm book without any hint.
My approach : Let $C[i]$ be the number of ways we can cut the edges if node $i$ was... |
There is a common leetcode problem that asks
Given $n$ non-negative integers $a_1, a_2, \dots, a_n$, where each represents a point at coordinate $(i, a_i)$. Then $n$ vertical lines are drawn such that the two endpoints of the line $i$ are at $(i, a_i)$ and $(i, 0)$. Find two lines, which, together with the x-axis form... |
I have a problem related to a common dynamic programming problem LIS. I got LIS function that takes arr as an input and returns the length of the longest increasing subsequence.
def LIS(arr):
n = len(arr)
# initialize LIS values for all indexes
lis = [1]*n
# Compute optimized LIS values in bottom up ... |
Operating System MCQ Question:
If a system has 1 GB RAM with a page size of 8KB and operating system occupies 16 MB of RAM, how many page frames does the system have for user process?
a. 129024
b. 120924
c. 131072
d. 119864
|
In optimization, particularly evolutionary computation, we often try to optimize (through either minimization or maximization) non-smooth, non-differentiable, discrete functions that aren't readily visualized (for example through function plotting).
Given this, it's often challenging to picture the shape of the resulti... |
Intuitively, this seems impossible (because negation is forbidden in the head), but i am not sure.
A naive (and wrong) example is
p :- p
But, this just means
¬p or p
We can get the assignment p=true, so no contradiction.
Could you give me an example of contradictory horn clauses without goal clauses if it is possible... |
I would like some advice in this homework question. There is a three players game, in which each player ($A, B$, and $C$) is given a $n$-length array of integer values. There are $n$ rounds in this game. At every $i$-th round the players have to choose one value among $A[i]$, $B[i]$ and $C[i]$, which is going to be the... |
C's char array can hold an ASCII string, such that a user can query individual characters by indexing the char array, modify them or do what ever they want to, its pretty straight forward. I have browsed through many questions+answers on stack(exchange|overflow) on topic of unicode strings in char arrays but haven't fo... |
https://atcoder.jp/contests/past202004-open/tasks/past202004_f
I am trying to solve the following problem:
We have $N$ tasks. Let today be Day $1$. You can do the $i$-th task on or after Day $A_i$, and finishing the task gives you $B_i$ points.
Each day, starting with today, you choose one task and finish it. For each... |
I have this graph that I created and am wondering how DFS and BFS would work on something like this. I made this graph undirected and am going off the premise that if possible, a vertex should be visited in numerical order
|
I have the following problem:
let $(a_1,b_1)$ and ($a_2,b_2)$ be to geodesic lines on the sphere, i.e. great circle arcs.
I need to determine, if the two arcs intersect.
I already have a working solution namely: this blog post.
The idea is the following: Calculate the two intersection points of the great circles and af... |
If a $\mathsf{PSPACE-Complete}$ problem (say $\mathsf{TQBF}$) has an algorithm that has the runtime $\mathsf{NP^{NP}}$ it follows that $\mathsf{PSPACE=\Sigma^P_2}$.
Does that also imply $\mathsf{\Sigma^P_2 = \Pi^p_2}$?
Moreover, does that imply $ \mathsf{\Delta^p_2\subset \Sigma^P_2}$ or is that question still open?
|
Though the concept can be for many RTS games but lets use the specific system of 'age of empires'. For simplicity one resource will be considered. Food.
So in the game there are villagers who gather resources. And resource food is used to create new villagers.
Lets say it costs x (ex: 50 unit) amount of food to create ... |
It is agreed upon that the time complexity of BFS is $O(|V| + |E|)$.
Breath first search usually is used within a connected component. The connected component with the least $|E|$ given a fixed $|V|$ is a tree graph where $|E| = |N| - 1$. Therefore $O(|E|) \ge O(|V|)$ given a connected component.
Why is the runtime com... |
I understand how CPUs work in general in RiscV, but things got a little complicated with pipeline and I don't get it why we need registers at all. For example, let's look at:
When the ALU's input was Reg File's output before adding support to pipeline, so what has changed now?
We can still do that same as when the clo... |
I was wondering about a kind of grammar where we can expand rules of the form A -> X|Y|... with A being a nonterminal and X and Y being strings of nonterminals or terminal symbols, but the expansions of X and Y (and all other rules under A) must all be the same. Is there a name for this? It feels like it is probably a ... |
How would you determine if these arithmetics are sentences or not?
-(x + 2) > y
i++ == 2
i++ == 2 is this sentence True where i = 1
I understand it as if the expression can be determinated as true/false, and there are no free variables, it is a sentence. But in my mind only the last one is a sentence since the variabl... |
Suppose we are give a natural number $n$, the value of $\sin(x)$ and $\cos(x)$. How efficiently can we compute $\sin(n x)$?
My Thoughts :
The $\sin (n x)$ expansion will have $O(n)$ terms. The power terms will take $\log(n)$ time each to compute. But there will be a term $nC_n/2$ so if $n=10$ this will be $10/5$. How... |
We say that an undirected graph $G=(V, E)$ is special if for every vertex $v\in V$ and edge $\{u, w\}\in E$, it holds that $\{v, u\}\in E$ or $\{v, w\}\in E$. In other words, a graph is special if for every vertex $v$, the set of the vertices that are not neighbors to $v$ is an independent set.
Is the vertex cover prob... |
In order to calculate the Kolmogorov complexity one has to "count" the minimum amount of operations it takes for a certain task(from here). Since the game of life (or cellular automata) outputs are non predictable and not compressible the amounts of rules applied should equal the Kolmogorov complexity? Or does the fact... |
Given integers a, b, and c all <=n, is there an efficient algorithm to find an integer y
such that a | c + b*y? One brute force approach will be to check for all y = 0 to n
and if there is a solution, there must be a solution within this range.
That will be O(n)
|
In the third edition of "Introduction to Algorithms" by Cormen et al ("CLRS"), section 17.4 ("Dynamic tables") is an overview of amortized analysis as it relates to managing the array-backed storage of a table of values.
I'm particularly concerned about the analysis of the TABLE-REMOVE algorithm: either I'm misundersta... |
And I assume these new data structures are more context/field-specific?
|
This is a homework question. Let $G = (V, E)$ be an undirected graph. Let $u, v, w \in V$, find a path from $u$ to $w$ that passes through $v$. I know that I can solve this by running BFS on $u$ and then on $v$. If $v$ is a reachable from $u$, and $w$ is reachable from $v$, then I just output the shortest path from $u$... |
This question relates to the 2nd edition of Probability and Computation by Mitzenmacher and Upfal.
The authors then use the Law of Total Probability
My question concerns the line that begins with $\leq$. Shouldn't that be replaced with $=$ because the authors proved that the event $\mathbf{AB} \bar{r} = \mathb... |
This question isn't very technical, but I'm in desperate need of help and I thought this would be the best place to post this question. I'm in an computer science course, data structures and algorithms and we have dealt mainly with singly / doubly linked lists as our main data structure, skip lists and time complexity.... |
We all know that We estimate our running time by drawing a graph and Big O and Big Theta is our worst and average running time respectively and we graph our function like :
$ O(g(n))= f(n)$ and create a range $0<f(n)<cg(n)$
and for $\Theta(g(n))$ $0<c_21g(n) <f(n)<c_2g(n)$
here What does g(n) means precisely and how do... |
I would like some hint in this homework question. I have to write the max-flow problem (with souce $s$ and sink $t$) as a linear program. I have to do this by defining variables on each $s - t$ path, which is different than the typical approach of considering as variables the flow of each edge.
So far, I thought on the... |
Suppose $f_1(n)=n\log^*n$,$f_2(n)=n\log h$ that $h$ is number of vertices of convex hull.
Can we conclude that
$$f_1+f_2=O(f_2)?$$
Edited:
Note that, $h$ is a function accroding to $n$ that $h\leq n$, and according to the input $n$ it can be less than $n$ such as constant.
$n\log h$ is running time of an ouput senseti... |
For a regular language $A$ with the alphabet $\{a, b\}$. Is $L$ a regular language, where $L$ contains strings of $A$ but sorted with $a$ and $b$?
In other words, formula: $L = \{ a^{\#_a(x)}b^{\#_b(x)} \mid x\in A\}$, where $\#_a(x)$ is the number of $a$'s and $\#_b(x)$ is the number of $b$'s.
$A$ is a regular languag... |
I came across the following family of online problems:
Given a sequence of values of length n, the maximum value and the minimum value of the sequence, our goal:
Given min and max, we want to find a good/best element in an online that if an element of the sequence satisfies some criteria based on min and max accept it ... |
My question is related to this one
Minimize number of circles to cover set of points
In a 2D space, I have a set of points. I can deploy up to $k$ circles with radius $r$ to the space, and my goal is to maximize the number of points that will be put inside these circles. There are two cases:
a) Either the circles canno... |
We are given an undirected weighted graph $G=(V,E)$ that contains at most $2n$ edges, as well as an MST of $G$.
If we decrease the weight of exactly $n$ edges, is it possible to compute an MST of $G$ in $O(n)$?
If it's not possible, are there any lower bound that show us, it can't be done in linear time?
|
I have a list of supported operators, my question is whether the lexer should just yield the token for the operator or raise a syntax error in case that particular operator (let's say "?") doesn't exist in the operators list?
for example, the operators list [+, -]. for the expression "1 ? 2", should the output be
[numb... |
Are there any algorithm for finding MST of given graph $G$ in linear time?
I found this paper at this link
But I can't understand it running time is linear or not.
|
Is there a way to tell if ANY machine on ANY input will halt in fewer than n steps OTHER than running the machine for n steps?
I've read the similar questions and answers such as here, but I wanted to make sure that they were talking about any machine on any input, not a particular machine or on a particular input.
If ... |
Given pixel values $r_1,r_2,\dots,r_n \in \{0,\ldots,255\}$ and $k$, find
$$
\min_{v_1,\ldots,v_k} \sum_{i=1}^n \min_{1 \leq j \leq k} (r_i - v_j)^2.
$$
My attempt: Let $F[L,c]$ be the minimum cost, where $L$ is the last color that was chosen, and $c$ is the remaining colors. Since the order of pixels don't matter, l... |
For a CNF SAT instance in the DIMACS format what is the best algorithm to compress it? What is the best algorithm for 3-SAT instances in particular?
In 2020 SAT competition used .xz which if I understand correctly relies on the LZMA algorithm.
Brotli probably would not be optimal as it has a pre-defined dictionary of E... |
This question kind of puzzled me, it was presented as a homework assignment for 2nd year undergrads and one of them approached me in case I could give him some pointers, but the problem is I couldn't even think of the answer myself.
They start with an unsorted array of integers and they're to find an element (there cou... |
My attempt at solution-:
Solution by a teacher-:
Both are giving same answer, is the one that I made correct?
|
A model of computation is currently defined on wikipedia as:
a model which describes how an output of a mathematical function is computed given an input.
Is it therefore correct, at least as a rough approximation, to conceive of a model of computation as "reverse engineering a function"?
|
I'm having some trouble understanding the regular expression $0^*10|01(01)^*$.
The expression matches strings like $00010$. But for some reason, I wasn't able to find a string that matches the $(01)^*$ at the end. An equivalent expression with capturing groups to demonstrate the order of evaluation would be very much h... |
I have a PDA A = ({q0, q1}, Σ = {a, b}, Γ = {a}, δ,
F = {q1}), with these transition functions δ:
((q0,a,ε),(q0,a));
((q0,b,ε),(q0,a));
((q0,a,ε),(q1,ε));
((q1,a,a),(q1,ε));
((q1,b,a),(q1,ε)).
The exercise asks me to explain the structure of the words accepted.
I have designed the PDA but i'm having problems understand... |
I was trying to understand pointers by watching YouTube videos. However, I could not understand
How do they work?
Why do we use them?
When do we use them?
|
I have $n\times n$ matrix of non-negative integers $a_{ij}$. Let $S:\mathbb{R}^{n\times n}_+\mapsto\mathbb{R}_+$ be the following function:
$$S(A)=\sum_{j=1}^n\sum_{k>i}\large\mathbb{1}_{\{a_{ij}=a_{kj}\}},$$
where $\mathbb{1}$ denotes the indicator function.
I would like to find a permutation $\sigma$ of the rows of $... |
Having the ability to see 2 or more colors can improve the sensitivity of nuances but greatly increases the complexity of image processing algorithms. I once thought that 3 colors are necessary for the most complex tasks (such as self driving cars) until I learned that colorblind people (who can see only 2 colors) can ... |
this is very confusing question. I am having no idea to solve it, can you please guide me here?
|
I have a problem that looks like a 0-1 Knapsack problem, except that the value of each item is a vector of length about 5, $v=(v_1,\dots,v_5)$. I want to maximize the product of components of the sum of the value vectors that are selected. In other words, if $S$ is the set of value vectors for the selected items, I wa... |
A friend and I did the Inorder-tree-walk with pen and paper.
We both can't figure out how the algorithm would move 'up' the tree again upon hitting a leaf:
We are using the algorithm as described by our professor and taken from "Introduction to Algorithms, Third Edition" Chapter 12 page 288:
Inorder-tw(node)
if node ... |
I have a graph $G$ with $n$ nodes and $O(n)$ edges. Each of the nodes has a positive integral weight at least 2, such that sum of all weights is at most $O(n)$. We want to color the nodes and edges red or blue, where coloring a node of weight $C$ costs $C$ units, and coloring an edge costs 1 unit.
Constraints:
Any edg... |
I am trying to understand the Boolean Hierarchy. the formal definition of the Boolean Hierarchy is as follows:
$BH_1 = NP$
$BH_{2k}$ is the class of languages which are the intersection of a
language in $BH_{2k-1}$ and a language in $coNP$.
$BH_{2k+1}$ is the class of languages which are the intersection of a
langua... |
I am given $A$ and $B$, where $A$ is less than or equal to $B$, and they are in the range of $[1, 100000000]$. I want to calculate the number of pronic numbers in that interval $[A, B]$. These numbers are numbers $n$ such that $k \times (k + 1) = n$ for some $k$. The following algorithm works, but I am having a lot of ... |
Design a DFA that accepts language $$L = \left\{ x \in \{ 0, 1, 2 \} : \text{ sum of digits in } x \text{ is } 2 \mod 3 \right\}$$
How to make a DFA for this? I have no idea how to solve this dfa problem. I have a solution by someone but I am not getting concept to start this solution.
|
I was assuming the following equivalence in one proof:
$L \in NP^B \iff \overline{L} \in coNP^B$
here $NP^B$ is the class $NP$ with oracle acess to oracle $B$ and similarly $coNP^B$.
Is this correct? Does it matter if I give oracle acess to $B$ or to $B^c$?
|
State machines are a fundamental computer science concept and in many senarios they are the simplest way to implement a process or program. However, most programming languages don't support them natively. Is there a technical limitation to do it? And if not, are there any programming languages that do support state mac... |
In undergrad theory classes, the idea of decidability and recognizability is introduced. It's well known that $A_{TM}$, the set of words accepted by a TM $M$, is recognizable but not decidable. We also know that the complement problem $\overline{A}_{TM}$ is co-recognizable but not recognizable.
I have a doubt about the... |
Construct a PDA, which recognizes the following language $L$: $L = \{w\;|\; |w|_a > 2|w|_b\}$, so it is the language that consists of words which have more than twice as many $a$'s as $b$'s.
I have constructed a PDA, which I believe to recognize $L$, however it is too complicated to prove its correctness. Is there an... |
Suppose you have a machine that takes inputs a set of sets, $\{S_1,S_2,\dots S_n\}$, and an integer $k$. The machine then returns True if $S_1$ intersects every other set $S_2,\dots,S_n$ in at least one place and otherwise returns False. Call this problem the INTERSECT problem. Now call the K_ELEMENT problem the pro... |
Given a $\Sigma$ I define a regular language as one of the folllows:
$\emptyset$
$\left\{ \sigma \right\}$ for any $\sigma \in \Sigma$
$L_1 \cup L_2$ for regular $L_1, L_2$
$L_1 \cdot L_2 $ for regular $L_1,L_2$
$L^*$ for regular $L$
Now, I would like to show that for a given regular language $L$, its complement $\ov... |
Pretty much just the title. Is it all possible combinations of a and b that have 2 letters ?
|
In our lecture, the Huffman coding was described as optimal. Optimal with regard to the minimum information content. When asked, the professor explained to me that the length of a fixed code word should be minimal.
I have now looked up on the internet what the common information is, this characterises the code as minim... |
My Monte Carlo algorithm starts by placing some circles in the plane with potential overlaps. I then place a large circle somewhere and compute the overlapping area of this larger circle with the other circles, through iteratively testing random points of the larger circle.
On this site it is stated that Monte Carlo al... |
Context-:
A language over Σ need not include strings with all symbols of Σ Thus, a language over Σ is also a language over any alphabet that is a superset of Σ.
https://www.univ-orleans.fr/lifo/Members/Mirian.Halfeld/Cours/TLComp/TLComp-introTL.pdf
Page number 10
I am trying to understand what it is trying to say-:
Σ={... |
Most cryptographic protocols like pseudorandom number generators run only on "internal" information: that is you set a seed and the next state is a function of its previous state etc.. I am wondering if there are any examples of cryptographic protocols that make use of "external" randomness or information, which is as... |
An Exact Cover problem is commonly denoted as a matrix of 0s and 1s. Columns denote requirements, rows denote possible choices. The problem is solved when a set of rows was found such that, using just this set, each column has exactly one 1 in it.
In this question, assume that exactly one solution exists.
A common way ... |
I'm trying to solve following problem:
Check, if the string contains substring, that can be obtained from pattern using one to one lower case symbols replacement (using bijection between original lower case letters and new letters).
My strings only consist of upper case and lower case english alphabet letters (A–Z, a... |
By definition are Nondeterministic Finite Automata not allowed a 'sink-state' (non-accepting state we don't get out of)? I can see us having them for NFA but not necessary but do not see how they are against the rules of a NFSA/NFA or should not be allowed. My teacher said they are not allowed in a NFA/NFSA, but even i... |
You have an array of floats, for example:
[74.45329758275943, 501.9063197679927, 172.59563201929095,
307.1739798358187, 362.042263381624, 940.1282277740091,
577.2604546481798, 63.201270419598224, 828.8081043649505, 31.1630295128974]
For each float, you can either call floor() or ceiling() to convert it to the near... |
Context-:
https://math.stackexchange.com/questions/1600257/determining-if-a-binary-string-represents-a-prime-integer
Confused text-:
The problem of testing primality can be expressed by the language LP consisting of all binary strings whose values as a binary number is prime. That is, given a string of 0's and 1's, sa... |
I got bombed in a interview because I was asked to write an algorithm which would count the leaves of a tree, I did this:
class TreeNode{
TreeNode[] children;
int value;
ctor(){
children = new TreeNode[]();
}
}
class CountingClass{
int count;
ctor(){
count = 0;
}
void Count(TreeNode node)
{
if(node.Children.Count... |
I have a problem which could be stated as follows:
Given an unweighted undirected graph $G=(V, E)$ and positive integer $k \leq |V|$, I need to find a subset of vertices $R \subseteq V$ such that $|R| \geq k$ and no two vertices in $R$ are joined by an edge in $E$.
As you can see, this is the definition of the independ... |
Context-:
Problems that can be solved by a computer using no more time than slowly growing function of size of input are called tractable. Polynomial functions are slowly growing functions. Functions that grow faster than any polynomial are deemed to grow too fast.
I googled about input size-:
For sorting arrays-: in... |
Define the subset sum with interval integer target problem (SSIITP) as follows:
SSIITP Input:
A multiset $S = \{a_1, …, a_p\}$ of positive integers $a_i$.
An integer $T$.
SSIITP Output:
True, if there is a subset $S’ \subseteq S$ such that $\sum_{x \in S'} x \in T .. 2T$.
False, otherwise.
Where $a .. b$, for two i... |
I am reading CLRS 3rd Ed, chapter 17.1 (Aggregate analysis pg453) and I came across this statement.
Let us analyze a sequence of n PUSH, POP, and MULTIPOP operations on an initially
empty stack.
I am confused as in:
Do the push, pop, and multipop cumulatively add up to n operations.
(there is a total of n operati... |
Assume that P1, P2,..., Pn are all NP-class problems. PP1 and PP2 are unknown problems (i.e., we don't know whether they belong to the P or NP classes). If "P1, P2,...., Pn" problems can be reduced to PP1 in polynomial time, then PP1 can be reduced to PP2, and PP2 can be reduced to another NP problem in polynomial time... |
Can we prove by induction that $A_k$ is computable for every choice of $k \in \mathbb{N}$?
$A_k$ is the set of descriptions of a no-input Turing Machine which accepts in $k$ or fewer steps.
|
Text of the problem:
Solve the following recurrence equation and prove it by applying the principle of
induction:
$T(n) = \begin{cases} 3, \ n \le 2 \\ T(\lfloor\frac{n}{2}\rfloor)+n^2, \ n \ge 3 \end{cases}$
after doing the recursion tree, I find that the complexity (if I'm not wrong) is $ \Theta (\log_2 n) $
But I ... |
The first one is from unreputed youtuber whereas second one is from reputed university called adiuni course of theory of computation.
Now I know what that second figure means, it means it also accepts $\in$ as initial state=final state, but
how I don't know that. This dfa should accept all binary divisble by 4. But h... |
Let $G = (V, E)$ be a directed acyclic graph, which is quite sparse (in the examples I have in mind, $|E| \approx 10|V|$ or so). For each vertex $v \in V$, let $f(v)$ be the number of vertices reachable from $v$. Is there a way of calculating the function $f$ for all vertices in time $|V| + |E|$?
The obvious algorithm ... |
It is known that:
$\Sigma_2^P \subseteq \Delta_3^P$ i.e. $NP^{NP} \subseteq \Delta_3^P$.
$BPP^{NP} \subseteq \Delta_3^P$
If $\Sigma_2^P = PSPACE => BPP^{NP} \subseteq NP^{NP}$
Doesn't that imply: $\Sigma_2^P = PSPACE => BPP \subseteq NP$?
Am I missing something?
|
Let $G = (V,E)$ be a connected undirected graph. Let $s \in V$ be a vertex in the graph.
True/False: If $v$ is a leaf in every spanning tree resulting from DFS(s), then $v$ is a leaf in every spanning tree resulting from BFS(s).
I assume that this one is True, and I think that because if $v$ is a leaf in every DFS(s), ... |
I was asked a question in my algorithms exam which had this as the core question after simplifying. I had written that it would be NP-Hard but I got it wrong my professor is saying that it would be NP-Complete.
Kindly help me resolve my doubt.
|
I am trying to construct the DFA that accepts the following language
$$ L_2 := \left\{ w \in \{a,b\}^* \mid \#a(w) \text{ is divisible by } 3 \text{ and } \texttt{babbab} \text{is a substring of } w \right\} $$
My solution is illustrated below. I feel like my current solution is incomplete/wrong.
|
I need to find a regular expression for the language over $\{a,b,c\}$ consisting of all words in which no two consecutive letters are the same.
For example, $abacbabca$ is in the language, while $abbc$ isn't.
How do I do that?
Any help would be greatly appreciated!
|
Let $u$ be a real vector of $m$ entries, and $A$ be a $\pm 1$ matrix of dimension $N\times m$, and real rank $\operatorname{rank}(A) = r$.
What are some conditions on $A$ (e.g. in terms of its rank $r$, or any other property of the rows of $A$) such that $u$ with $Au = 0$ is forced to have a zero entry?
|
I am relatively new to algorithms and I hoped you can help me with the following question. The question can be summarized as follows:
Given two different starting vertices, A and B, and a destination vertex, C. Find the shortest path from A -> C and B -> C (assuming there is no negative edges). The graph can be modele... |
There are lots of code metrics that claim to measure maintainability, e.g. CK and Li & Henry metric suits. However, it seems elusive to me to find a meta-study that compares different metrics to decide their current empirical status.
In contrast, here's a quite brilliant such study about fault prediction: https://romis... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.