instruction stringlengths 35 29.1k |
|---|
I tried few cases and found any two spanning tree of a simple graph has some common edges. I mean I couldn't find any counter example so far. But I couldn't prove or disprove this either. How to prove or disprove this conjecture?
|
I came across a question stated as $L = \{wxwy \mid w \in \{0,1\}^* , x,y \in\{ 0,1\}^* \}$ is regular and I have no problem understanding it.
However I thought what could happen if the language is modified to $L = \{wxw \mid w \in \{0,1\}^+ , x \in\{ 0,1\}^* \}$.
In my opinion the above language is regular and it repr... |
It seems intuitive that there's no list data structure which has $\mathcal{O}(1)$ worst case time complexity for random access and a worst case complexity better than $\mathcal{O}(n)$ for insertion: if insertion is allowed to affect only a small part of the list, then there's no way for it to always keep the entire li... |
consider following persudocode:
i=0
while(i< k):
uniformly pick u,v in V
if(uv in E):
remove uv form E;
i++;
let $T$ be the number of iteration of this process,
I know how to compute the expectation, but what is well bound for
$P(|T -E[T]|)$? And is this process independent?
|
I'm studying programming languages (more specifically type systems) and came across a concept I couldn't quite wrap my head around: soundness and completeness.
I'm taking a class, and according to my instructor:
Soundness is an analyzer's ability to prove the absence of errors. If a program is accepted by an analyzer,... |
I was learning about segment trees and came across this:
We have an array arr[0 . . . n-1]. We should be able to
1 Find the sum of elements from index l to r where 0 <= l <= r <= n-1
2 Change value of a specified element of the array to a new value x. We need to do arr[i] = x where 0 <= i <= n-1.
A simple solution ... |
I have undirected and unweighted graph, in which I would like to find the shortest path between two entered nodes. There is also a set of forbidden nodes. How to find the shortest path, if I am allowed to visit at most one node from the set of forbidden nodes?
|
It should be a very easy question, but I am a little bit confused.
According to party optimization post, the Maximum-weight Independent Set for trees can be found in the poly-nominal time using Dynamic Programming (the Algorithm is also explained on page 562 of the book Algorithm Design). Now, imagine that we want to t... |
I understand how the control, data and instruction buses form the system bus in von Neumann architecture but in the context of Harvard architecture, my textbook refers to "parallel data and instruction buses". The Wikipedia article for Harvard architecture also refers to an instruction bus: "TMS320 C55x processors, for... |
Is there any way to model the big M method for continuous variables?
Something similar to this but $B, C \in \mathbb{R}_{\geq 0}$ and $A\in\{0,1\}$.
Due to the precision problem, when the $B$ and $C$ are close I do not get the correct answer.
Let $p_{i,j} \in \mathbb{R}_{\geq 0}$, for $i=1,\dots, n, j=1, \dots, m$. As ... |
\begin{align*}
S&\to AACD\\
A&\to aAb\\
C&\to aC\mid a\\
D&\to aDa\mid bdb\mid\varepsilon
\end{align*}
I think that this grammar is infinite so it is not possible to convert it into cnf. Am I correct ?
|
Considering a cactus graph $G = (V, E)$, defined as:
A graph is a cactus if every edge is part of at most one cycle.
There is a way to calculate the number of cycles in this graph given only $n= |V|$ and $m = |E|$?
I did some examples before posting this, but now I think I got somewhere.
If $G$ is connected, $m = n-1... |
Using probing, is it possible for for a hash table's load factor to exceed 100%? I don't too much about Hash Tables. Is this possible?
|
The Problem
I have a set of sets of time intervals (hour, minute, day of the week). I want to select exactly one interval from each of set, and I want to minimize...
the number of pairwise intersections,
the total number of days,
the total time,
minus (the average start time), and
the average end time.
The number of ... |
I'm having trouble with proving the following, and my attempt and confusion is mentioned further below.
PROBLEM STATEMENT:
For a string $w = a_1 a_2 a_3 a_4 a_5 a_6 a_7 \dots$, define $third(w) = a_3 a_6 a_9 \dots$
Then, for a language $L$, define $third(L) = \{third(w) : w ∈ L\}$.
Show that if $L$ is regular, then $t... |
Consider the Minimum Spanning Tree Problem on an undirected graph
G = (V, E), with a cost ≥ 0 on each edge, where the costs may not all
be different. If the costs are not all distinct, there can in general be
many distinct minimum-cost solutions. Suppose we are given a spanning
tree T ⊆ E with the guarantee that for ev... |
In college, we've seen some general formulas to compute the decimal value a of a binary representation $a_{N-1} \dots a_2 a_1 a_0$ in two's complement, $N$ being the number of bits.
For $a \ge 0$ we've seen $a= \sum_{i=0}^{N-2} a_i 2^i$, which seems correct to me if I work it out.
But for $a < 0$ our book says $a=-2^{N... |
I read that there are 4 types of rotations:
Left rotation
Right rotation
Left-Right rotation
Right-Left rotation
What are the corresponding abbreviations: RL,LR,RR,LL? Is there a reference how to rebalance AVL trees?
|
Given:
A set of available customers $c_1, c_2, \dots, c_n$.
A set of available foods $f_1, f_2, \dots, f_m$.
Each customer will choose a subset of the available food.
Problem:
Find the maximum number of customers that can be chosen, such that no two customers share the same food.
Question:
How to reduce the indepe... |
In our lecture notes about many-one reduction we showed that the following statements hold:
$$ L, L' \subseteq \mathbb{N}\space and \space L\leq L'$$
$$(I)\space L' \in RE \implies L\in RE$$
$$(II)\space L \notin RE \implies L'\notin RE$$
Now I was wondering if this would also be true if you'd reverse these statements ... |
I know the Floyd-Warshall, and I also clearly understand the proof of running time of $O(V^3)$ of F-W algorithm. However, consider this algorithm:
Let $dp[i][j][n]$ denote the shortest path from $V_i$ to $V_j$ using at most $n$ vertices. Use $dp[i][j][n] = \min_{V_k\text{ adjacent to } V_i} (e_{ik}+dp[k][j][n-1], dp[i... |
If a grammar has the same variable multiple times, is it the same as adding a $\mid$ between them? For example, is
$$\begin{align*}S &\to bB \\
S &\to \varepsilon \\
B &\to cB \\
B &\to \varepsilon \end{align*}$$
equal to the following?
$$\begin{align*}S &\to bB \mid \varepsilon \\
B &\to cB \mid \varepsilon \\
\e... |
I came across this question in a test and I had to answer whether it is true or false.
DFA with single final state has the same powers as DFA with more than one final state.
I was confused by what definition of "power" have they used. Generally, we always use power as a term to represent the class of languages a mach... |
I have trouble understanding how to apply the master theorem in the following problem:
$$T_2(1) = 1; T_2(n) = 4T_2(2^{\log \lfloor \frac{n}{2}\rfloor}) + \sqrt{n} \text{ for } n > 1.$$
My professor first rewrote this problem as
$$ T_2(n) = 4T_2(\lfloor \tfrac{n}{2} \rfloor) + \sqrt{n} \text{ for } n > 1, $$
which I d... |
Suppose I have an AVL tree with a pointer to the minimal element. I'd like to conduct a search for some key x, which is the $k$-smallest key in the entire tree.
I can do this by "climbing" up the tree's left branch, comparing x with the current key. As long as
(x > curr.key) && (x > curr.parent.key)
I keep climbing ... |
A binary matrix of nxm is given, you have to toggle any column k number of times so that you can get the maximum number of rows having all 1’s.
for eg, n=3, m=3,
1 0 0
1 0 1
1 0 0
if k=2, then we will toggle column 2 and 3 once and we will get rows 1 and 3 with 1 1 1 and 1 1 1 i.e. all 1’s so... |
The following is Dijkstra's algorithm for finding the shortest path in a graph. I know something wrong happens if I replace d[u] + weight(u,v) < d[v] with d[u] + weight(u,v) <= d[v]. What would be an example of the algorithm working incorrectly with that replacement?
def dijkstraShortestPath(G,s,t):
d[v] = Infinity f... |
I'm currently following a course and we have to prove that a restricted version of the 3-SAT decision problem where each literal appears at most once is solveable in polynomial time.
I think such a problem is always satisfiable since we can just assign any sub-expression the needed truth value without it interfering wi... |
Consider the following predicate formulas.
$F1: \forall x \exists y ( P(x) \to Q(y) ).$
$F2: \exists x \forall y ( P(x) \to Q(y) ).$
$F3: \forall x P(x) \to \exists y Q(y).$
$F4: \exists x P(x) \to \forall y Q(y).$
Answer the following questions with brief justification.
(a) Does $F1$ logically imply $F2$?
(b) Does $F... |
CS community!
I'm more of a practical programmer than a computer scientist, so I need your help to find a solution (or at least point me into the right direction) to an extremely practical problem related to cooking food in the oven.
Problem
I have N ovens and I have multiple various ingredients to cook in them.
Each i... |
The following is a natural language description of a first order theory from Worboys. Only Axiom 11 and the Theorem 4 are written in mathematical notation.
Theory 1
Aland, Bland, Cland, and Dland are countries.
Eye, Jay, Cay, Em, and Ell are cities.
Exe and Wye are rivers.
City Eye belongs to Aland.
City Jay belon... |
I need to group cars (and their passengers) with other cars, and I don't know how to approach this problem.
If I have, for example, 3 cars. Car A with 7 seats and 2 passengers (3/7 because of the driver). Car B, 2/2. Car C, 1/3.
The most wasteful clustering would be [A, B, C]. But car C has room to pick up the driver a... |
From Wiki - Superscalar processor:
(Line 1): superscalar processor is a CPU that implements a form of parallelism called instruction-level parallelism within a single processor. In contrast to a scalar processor that can execute at most one single instruction per clock cycle, a superscalar processor can execute more t... |
Suppose that we have a grammar with the following rules:
$$S \to Aa\ |\ b\ |\ \varepsilon\\
A \to Ad\ |\ c$$
From looking at it I already know that $First(S) = \{b, \varepsilon, c\}$. My question is:
How to determine $First(A)$?
For instance, by looking at the rule $S \to Aa$ we know that $First(S)$ must include $Fir... |
I want to construct a DFS and a BFS spanning trees for the graph below. The root is node a. At each step the next edge to be traversed should be the cheapest one.
DFS:
My understanding that to the construct this DFS where each next is the cheapest one, the resultant spanning tree would be:
{(a,c), (c,h), (h,g), (g,f... |
Systems of formal logic generally have inference rules that
require certain expressions to be syntactically the same
in multiple steps. Typically two steps are involved, as
for modus ponens, where the rule works with two steps of
the form "A" and "A => B", where A and B are arbitrary
boolean terms. Such systems also ... |
Take:
KP recurrence relation
$ max { [v + f(k-1,g-w ), f(k-1,g)] } $ if w <= g and k>0
CCP recurrence relation
$ min {[1 + f(r,c-v), f(r-1,c)]} $ if v <= c and r>0
I don't understand (much as I've researched) exactly what the reasoning is behind KP comparing in both cases (take the element/don't take it)... |
I'm taking a programming languages course and had a question regarding the typing rules for a recursive let rec expression in a static typing system.
To be more specific, we're using the textbook Essentials of Programming Languages (3e) - Friedman & Wand.
To give some rough background, here's how the author describes ... |
How does the language $L=\{a^nb^mc^nd^m \mid n \geq1, m\geq1\}$ abstract the problem of checking that the number of formal parameters in the declaration of a procedure agrees with the number of actual parameters in a use of the procedure?
I simply didn't get what each of the variables $a,b,c,d,n$ and $m$ will represen... |
What is the best way of counting the number of multiples of number A that perfectly divides the number B.
This is the sub problem for one of the questions I am solving on codechef.
This is the best I could come up with.
int func(int A,int B){
int res = 0;
int i = 1;
while(A * i <= B){
if(!(B %(A * i... |
On https://regexr.com/, using the default JavaScript (Browser) engine, the languages $L(a^*|b^*)$ and $L(b^*|a^*)$ are not the same.
The first one matches only $a$'s and the second one $b$'s.
Is this a bug?
Or does the site something different than evaluating regular expressions, as I learned them in class?
|
Given an arbitrary algebraic equation, say for example the likelihood of the bernoulli distribution:
$$\prod_{i}^{n}\theta^{x_i}(1-\theta)^{1-x_i}$$
And some arbitrary factorization constraints, say:
$$f(x)g(\theta)e^{\phi(\theta)^{T}u(x)}$$
Can I factor the equation into the form above where f, g, and phi are functio... |
Can you to find for me a context free grammar for the following language?
$$\{w\in\{a,b\}^*: \#_a(w)=2\#_b(w)\} $$
Here $\#_a(w)$ counts the number of $a$'s in $w$.
|
I'm reading Multithreading (computer architecture) - Wiki, aka hardware threading, and I'm trying to understand the second paragraph:
(p2): Where multiprocessing systems include multiple complete processing units in one or more cores, multithreading aims to increase utilization of a single core by using thread-level p... |
I am looking for an algorithm to find the shortest distance from multiple nodes to one end node. For example let $v_1,v_2,\dots,v_r$ be the nodes on a graph with distance $d_1,d_2,\dots,d_r$ to the end node $v$. I want the shortest $d$ to $v$.
|
I'm new to AI, and have a hard time to understanding how to count the total states are examined in the most wins heuristic for tic-tac-toe two plys deeper(9-grid)? Need help
|
I'm trying to prove the following.
There exists a strongly connected orientation of a connected, undirected graph $G$ if, and only if, $G$ has no bridge.
(An orientation of an undirected graph is a directed graph made by replacing each edge $uv$ with exactly one of the directed edges $(u,v)$ and $(v,u)$; a directed g... |
There are plenty of resources online discussing 3-SAT reductions to Independent Set or Vertex Cover problem. I am unable to find a resource which states that a satisfiable assignment to 3-SAT results in a vertex cover or an independent set which is optimum for the graph induced by 3-SAT in its reduction.
Say, I have a... |
I was trying to implement data structure over set of rectangles that can perform two types of operations.
Update operation, add new rectangle with sides parallel to x and y axis and positive coordinates to the set.
Query operation, for some rectangle check if there is some rectangle intersecting with this rectangle.
... |
Given a graph G, with all positive weights, find the shortest cycle length in O(V^3)
My idea is, negate al the edges, apply floyd-warshall algorithm and then for all $i$, find the largest $M[i][i]$ where $M$ is the final distance matrix, and then negate $M[i][i]$ and return.
Could this work? I know floyd can be used... |
I need to prove that
In a simple graph $G$, if all the $n$ vertices have a degree of at least $4$, then the number of edges is at least twice the number of vertices.
I already know that $\deg(n) = 2E$.
Then for the question
$$\deg(n) \ge 4 = 2E$$
but then I couldn't solve further.
|
I need some guidance in an assignment I'm doing.
I'm at complete loss, he says the the MAXIMUM INDEPENDENT SET problem is NP-hard and then asks me to prove that there is no polynomial time for the same algorithm and it also guarantees that some inequality holds, which I also don't understand, since $A(G)$ returns the s... |
Problem of determining whether a context sensitive language is context free is undecidable.
How to prove it
|
I'm looking for an algorithm to count and enumerate (separately, if differing complexity) all the reconvergent pathsets in a simple, directed, non-weighted graph, which may contain cycles. That is, for every vertex $v_i$ of in-degree >1, determine if any pair of its direct ancestors have a lowest common ancestor $u_i$ ... |
Based on the question below, can someone please explain to me the reasoning behind why the maximum number of edge is 5/2|V|? I don't find the particular reasoning in the solution to be that helpful for why the maximum number is 5/2|V|.
|
Let's start with the formalism:
Let $W$ be the total weight of our bag, $1,...,n$ be our elements, $w_1,...,w_n$ their corresponding weights, and $v_1,...,v_n$ their corresponding values.
As is known, the knapsack problem for integer weights can be solved by dynamic programming (or equivalently, using recursion + mem... |
I'm studying constrained Turing Machines.
There's a theorem that proves that both infinite and semi-infinite tape TM have the same computational power. The theorem that proves this by emulating a TM1 with infinite tape with a multi-track tape TM2, where one track emulates the right part of the TM1 tape and the other tr... |
For the question below, it is asking to prove the lower bound on the worst case is log(n). I have no problem proving this and the solution makes 100% sense to me. However, there is a comment at the bottom of the solution which asks why we had to assume that if the loop does not return early, then it runs for omega log(... |
I believe in order to make a Turing machine have the same power as a DFA (by power I mean all languages which a DFA can decided so can the Turing machine) we just don't allow any use of backtracking or rewriting, that is you can only move right and read the string in the order it is presented.
To simulate a PDA however... |
I was reading the following and found the following paragraph that I didn't understand:
Let us also consider a set Σ of typed λ -constants, that is, pairs σ : t,
where t is some type. Like for type assignments, we assume that Σ
does not contain constants with multiple types and let Σ(σ) denote
the type t such th... |
The goal is to store sorted unsigned integer intervals that can overlap only in the boundaries, e.g., |0–10|10–50|100–110|110–200|. This structure will be created by some insert operations (the order matters) in the start and than queried by a lot of queries. The query is specified by interval and the result is all int... |
I have been informed parser parses unambiguous context free grammars of $DCFL$.
I was wondering if there could be a parser which could make a parsing table for unambiguous grammars of $NCFL$?
Note: This has been discussed here briefly in comments.
|
Like in the title the following equation:
$F(n)=F(n-1)+F(n-2)+f(n)$, with $F(0)=0, F(1)=1$
$f(n)=f(n-1)+f(n-2)$, with $f(0)=0, f(1)=1$
I don't know how to solve this. The $f(n)$ is basically just $F(n)$, but
then I have
$$F(n)=F(n-1)+F(n-2)+F(n) \Rightarrow F(n-1)+F(n-2)=0$$
and I cannot go anywhere from this.
|
I need to build a sorting (comparator) network using comparators for a specific permutation on a set $x_1, \dots, x_n$. The solution should not be a general sorting network that sorts every permutation. I should build the smallest possible sorting network for the given permutation (the depth of the network should be $O... |
So I'm lost on this one. We're given a turing machine and an initial tape. Tape is infinitely long in both ways, but all the blanks are taken out. The head is the leftmost nonblank. So the question is: If the Turing machine
halts on this input, then give the output sequence; if it does not halt, then answer “does not ... |
I was wondering if there is an algorithm to derive $p$ and $q$ or is it simply trial and error?
Consider the following RSA crypto-system with public key $(437,13)$. Since the numbers are so small, it is possible to break the crypto-system and determine the private key. What is the value of the two primes $p,\,q$ with ... |
I was reading this and I was trying to understand the definition of $(S,\Sigma)$-CCC. The first requirement says:
a mapping [[_]] : S → |C|, associating some object [[s]] ∈ |C| to
any s ∈ S;
which I find very confusing and having a hard time understanding what it means. What is $S$ and what is $\Sigma$?
why do all ... |
Does a mathematical modelling on Christofides algorithm exist, is it even possible to create one?
|
For the 8 puzzle problem, it has been proved that if h(n) = number of tiles on wrong place. h(n) is an admissible heuristic as every tile which is in wrong place must be moved out at least once.
But if h(n) = number of tiles on correct place. h(n) is not an admissible heuristic. Can anybody please explain.
|
Hey I am new to graph theory and this question has me stuck for hours.
What is an example of undirected graph with n nodes where the number of simple cycles is exponential in n.
I was looking at complete graphs, but here's the catch: the total number of edges should be in theta of n.
Please help! I need to prove the co... |
Does a priority queue Queue<K,V> always sort its elements based on the value of each element or its key?
I know than the priority in the queue is based on the key, and that the element with the highest priority has the minimal key (Correct me if I am wrong) But I am not sure about wether the pq sorts based on value.
|
There are two problems that need to be solved. Both problems use a compatibility matrix $C$, where $C[a, b]$ is how compatible students $a$ and $b$ are.
(1) Given an $n \times n$ compatibility matrix $C$ for $n$ students, and $r$ rooms with sizes $s_1, s_2, \dots, s_r$, where $n$ is the sum of room sizes, and a target ... |
So I learned that there are some problems that cannot be solved in computer science but I want to know why is it important to understand the unsolvable algorithm and how should I deal with it.
|
The invariance theorem of kolmogorov complexity states that for two different languages with complexity functions $K_1$ and $K_2$, we have
$$\exists c.\forall s. K_1(s) \le K_2(s) + c$$
Here is an apparent paradox I found. Let the two languages be Binary Lambda Calculus and (an idealized version of) Perl, with complexi... |
Why are random numbers important to the study and application of computer science? I am new to computer science. So I am studying random numbers right now.
|
Although hardware based “true” random number generators are available, software-based pseudo-random number generators still remain the predominant method for generating random numbers in use today. Why do developers continue to rely on pseudo-random number generators?
|
I use the A* search algorithm to to search for the shortest path from S to G.
The evaluation function is $f(n) = g(n) + h(n)$.
Since node A and B have the same estimated total cost, I choose to go node A.Then, the $f(n)$ of B is 8, C is 7, G is 10. After expanding C, $f(n)$ of G is 7. Therefore, the path is S-A-C-G w... |
I have just read a Luby’s paper on the very basic idea of the LT codes, which may be of interest for me.
For my application, encoding k information symbols is done in a process that generates a big table T of size k’.
Then, for every information symbol s, choose d indices in the table $x_1,\ldots,x_d$ and add s to $T[x... |
There are n cities [1, 2, 3, .... n] and k available pumps. These pumps can be installed in k cities. The cities are all in a straight line.
How do I need to install these so that the average distance between the cities and the nearest pumps is minimized?
What I am thinking is that dividing is this:
Suppose there are 6... |
Source: http://examples.gurobi.com/traveling-salesman-problem
I don't get this part: (look at the source)
$$\sum_{i,j\in\{1,2,3\},i\neq j} x_{ij}=3>2=|\{1,2,3\}|-1$$
I get that $x_{ij}$ is equal to 3, but why the "> 2" ?
And what is the deal with subtracting 1 from a set? How do you even do that?
How come $|\{1,2,3\}... |
Undirected graph is given which has M edges and N vertices we have to convert every edge from $u-v$ to $u\to v$ or $v\to u$ such that the total indegree of every vertex is even.
For example, consider a graph which has the edges 1-2, 1-3, 2-4, 3-4. We can direct it as 1→2, 1→3, 2←4, 3←4, so indegrees of 1,2,3,4 are resp... |
Suppose that I have two photos, I1 and I2 and I want to find a set of corresponding points between the two photos to define a homography between them. There are many algorithms for this purpose, namely SIFT which is scale invariant. The problem is that when there's a pattern in both photos (like repeated windows), SIFT... |
How can I prove that $\Box(P\rightarrow Q)\rightarrow (\Diamond P\rightarrow\Diamond Q)$ is valid in linear temporal logic (LTL)?
|
The language was $L =\{a^n b^{n+1} : n\geq0 \}$.
This is my attempt:
I believed $L$ can also be expressed as:
$L =\{a^n b^{n}b : n\geq0 \}$
This implies that the number of $b$'s is always greater than the number of $a$'s. Thus, the complement is
$L' =\{w: w\in\{a,b\}^*: n_a(w)>n_b(w)\}$ or $L' =\{w: w\in\{a,b\}^*: ... |
Let $L = \{M: M\text{ halts on only one of 1100 or 0011 or 0011 or 1000}\}$. I'm trying to determine whether $L$ is decidable.
I don't think it's even recognizable, but I'm not sure. Regardless, I think I can show it's undecidable. Suppose $L$ is decidable by machine $D$. Then we can construct machine $S$ that decide... |
I understand hash function and inverted page table, but then the book I read describes something called hashed inverted page table (use hash to accelerate the finding because IPT is large), with TLB used. I don't understand why there is an arrow point to itself inside the hash table? Could anyone explain the mechanism?... |
Given an n variable boolean DNF formula and a number k, does this formula has satisfying input combination greater than k?. (0<=k<=2^n).
Where input is infinite number of n tuples where repeating tuple is possible.
For exampl. F(a,b) =ab + a'b. Input set is (11,00,11,01) and k=2.
Answer is 3 here so decision says yes... |
My question is what makes the Byzantine Generals Problem possible to solve in some cases where traitors exist, for example in the case where there are 4 generals with 1 traitor?
If the generals must either all attack or all retreat at the same time, then surely the traitorous general can simply say "yeah sure we'll att... |
How do one solve the following integer program?
$$
\begin{align*}
\text{minimize} \quad &\sum_{(i,j) \in E} d_{ij} x_{ij} \\
\text{subject to} \quad & \sum_{j \in V} x_{ij} = 2 \;\; \forall i \in V \\
&\sum_{i,j \in S, i \neq j} x_{ij} \leq |S|-1 \;\; \forall S \subset V, S \neq \emptyset \\
&x_{ij} \in \{0,1\}
\end{a... |
I think I have worked out a DFA that doesn't accept the substring "111," but I don't know how to account for accepting even length strings. Here is what I have so far. Any help would be greatly appreciated!
|
Is this language context-free? $\Sigma$ = {a,b,#}, L = {x1#x2#...#xk : k$\geq$2, every $x_i \in$ {a,b}* and xi $\neq$ xj for every pair i $\neq$ j} I think it is not, because the PDA can't memorize every word to be unequal to every other word.
|
I would like to learn about different approaches to formal verification of software programs that goes beyond what Wikipedia has to offer. Ideally one would not only get an overview but also recommendations which books and articles to read next.
My goal is to be able to judge what parts of formal verification I could a... |
I'm working my way through software foundations. In the Chapter titled "Tactics", I'm able to prove this theorem in Coq:
Theorem silly_ex :
(∀ n, evenb n = true → oddb (S n) = true) →
oddb 3 = true →
evenb 4 = true.
Proof.
intros H1 H2. apply H2.
Qed.
Even though I was able to get through the exampl... |
I'm reading chapter 3(growth functions) of CLRS and in giving an example of proving theta for a standard quadratic function the book gives the following value for $n_0 = 2 \cdot max(|b|/a, \sqrt{|c|/a})$ .
I'm confused regarding what "max" means in this context. The quadratic function is $an^2 + bn + c$ and the constan... |
The problem was from an exam, I spent much time wrapping my head up around this kind of problems, so I decided to ask for help ;(
Problem:
We implement a merge sort algorithm to sort $n$ items. The algorithm will divide the set into 2 roughly equal-size halves, and merge the 2 halves after each half set is recursively ... |
I drew these pictures to check whether I comprehended the ideas of P, NP, NP Complete and NP Hard correctly.
And then, I realized that it is not certain where undecidable problems should be placed.
Did I draw the pictures correctly? (Are all the undecidable problems including the halting problem are NP-Hard when P=NP... |
I totally understand what big $O$ notation means. My issue is when we say $T(n)=O(f(n))$ , where $T(n)$ is running time of an algorithm on input of size $n$.
I understand semantics of it. But $T(n)$ and $O(f(n))$ are two different things.
$T(n)$ is an exact number, But $O(f(n))$ is not a function that spits out a numbe... |
Let $f(n)=\Omega(n), g(n)=O(n)$ and $h(n)=\theta(n)$ then $f(n).g(n)+h(n)$ is?
My attempt:
Lets $f(n)=g(n)=n$, then $f(n).g(n)+h(n)=\Omega(n^2)+\theta(n)=\Omega(n^2)$
But given answer is $O(n)$. Now sure where I have have committed mistake or if I am missing something. How it can be $O(n)$?
|
If I have a Delaunay Graph, what is the mean geodesic distance between two randomly chosen nodes.
I know that in a small world network, it is in O(log(N)), with N being the number of nodes.
Thank you!
|
Suppose we have a list of $N$ keys where the distribution of keys follows $f(x)$.
We construct a skip list over the keys.
Now if I pick a key (e.g. 31 in the following picture), what are the Expected value of keys that it points to?
For example, key 31 points to: [38,44,55]. Considering that I know 31 has k pointers (... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.