instruction stringlengths 35 29.1k |
|---|
We know that if we have two languages produced by one regular grammar, then any language produced from the union, intersection, and so on would be regular.
What if we have a regular grammar that produces language A and a different regular grammar that produces language B. Then could the closure properties still be used... |
The DNG specification (page 87) describes a simple algorithm for converting a "fish-eye" photo into a regular photo (just several lines of basic geometry).
The transformation is configured using six numbers: $k_0, k_1, k_2, k_3, c_x,c_y$. Does it allow to represent identity (i.e. not changing the photo at all)? In orde... |
We were given an exam question of: Given a flow network G=(V,E) with integer edge capacities, a max-flow f in G, and a specific edge e in E, design a linear time algorithm that determines whether or not e belongs to a min-cut.
From the grading rubric we are told a correct algorithm - I got dinged for not having the cor... |
We have problem X and Y that we know is NP-Complete. Problem X uses graph G as an input and Problem Y uses graph G and constant k as an input.
Problem we are trying to reduce to, which I will call Z, is reasoning whether given a graph G and constant k, does G have X or Y.
I have been trying to solve this problem and an... |
Assuming an algorithm $A$ known to both Alice and Bob.
Alice runs the algorithm and gets a result $R$.
How can Alice prove to Bob that $R$ is the result of the execution of $A$ and not some random value (without having Bob run the algorithm himself)?
The goal is for Bob to perform less calculations checking Alice proof... |
When storing the encoded Huffman bit stream in bytes, in general, either
the final byte gets padded or
a pseudo end-of-file symbol gets used
In the former case, the number of bits padded needs to be stored somewhere, requiring another 3 bits. In the latter, you will lose some efficiency due to the additional pseudo s... |
So this a question from my book and I have to make CFG of this language but I am confused what does it mean when it says
"L contains palindromes that don’t ever have the same character occur twice in a row."
Let $\Sigma = \{a, b, c\}$.
Let $L = \{w \in \Sigma^∗| w = w_1w_2\cdots w_n \mbox{ is a palindrome and } w_i \n... |
The Wikipedia page for vEB trees (specifically the version from 27 September, 2018),
gives the following pseudocode for finding the successor element of x in the vEB tree (of universe of size M):
function FindNext(T, x)
if x < T.min then
return T.min
if x ≥ T.max then // no next element
return M... |
Given a simple undirected graph with no self-loops, $G = (V,E)$, where $V = {1,2,...,n}$, an $n × n$ matrix $A$ is said to be the adjacency matrix of $G$ if $A_{i,j}$ is $1$ if $(i, j) ∈ E$ and $0$ otherwise.
Now, suppose we define a special kind of matrix product for matrices whose entries are only 0 or 1. In this spe... |
So this a question from my book and I have to make CFG of this language but I am confused what does it mean when it says
"L contains palindromes that don’t ever have the same character occur twice in a row."
Let Σ = {a, b, c}
Let L = {w ∈ Σ∗| w = {w1, w2, . . . , wn} is a palindrome, and wi 6= wi+1 ∀ 0 ≤ i < n}.
In ot... |
In practical applications, search algorithms are often strengthened using heuristics. e.g., Deep Blue beat gary kasparov by searching through possible chess moves by "guiding" its search with human-chosen heuristics. These heuristics are not proven to be the optimal heuristics. (they're not optimal obviously).
I am wo... |
For example, in the proof of lemma 6.4.1 in the HoTT book, a function inductively defined over a function is simply applied on paths loop and refl, and then a path between loop and refl is used (presumably by congruence via f) to construct a path between f loop and f refl:
Suppose that loop = refl base. [...] with x :... |
Our course lecture slides divide architectures of distributed systems into:
object based architectures (e.g. typical distributed web application)
resource-centered architectures (e.g. torrents and magnet links)
event-based architectures (e.g. ???)
I do not understand the explanation on the slides and they don't provi... |
Theorem 7.11 in Introduction to the theory of computation 3rth edition says
Let $t(n)$ be a function where $t(n)>n$. Then every $t(n)$ time
nondeterministic single-tape Turing machine has an equivalent
$2^{O(t(n))}$ time deterministic single tape Turing machine.
I can understand that in this proof when we have a ... |
Certain special forms of the SAT problem have solution sets of a special form. For example, given any three solutions to a 2-SAT circuit, their bitwise median is also a solution. Likewise, given any three solutions to an XOR-SAT circuit, their bitwise XOR is also a solution. Lastly, given any two solutions to a HORN-SA... |
I need to prove/disprove the correctness of the following algorithm:
Let G be a simple, undirected and connected graph. The task is to find if the graph contains an odd cycle. The algorithm goes that way. First, you run the DFS algorithm on the graph, since it is connected it will result in a single tree. The for each ... |
To go with $O(n)$, we can use the linear sieve according to that $\mu(n)$ is multiplicative. But it seems that we don't have to work each $\mu(n)$ out and accumulate them together, because I only want to get $\sum_{i=1}^n \mu^2(i)$.
I am interested that is there any solutions that are faster than $O(n)$ to work $\sum_{... |
Here is the problem I have attempted to solve.
Given original principal $n$ and aggregate rate $r$, find the maximum final principal that can be yielded.
Though I know that the higher the compounding frequency is, the higher the final principal will be, a special condition applies:
Intermediate principals are rounde... |
Let $G = (V, E)$ be a connected undirected graph with $n > 4$ nodes $V = \{v_1, v_2, \dots, v_n\}$ and $m$ edges.
Let $\{e_1, e_2, \dots , e_m\}$ be all the edges of $G$ listed in some specific order. Suppose that we remove the edges from $G$ one at a time, in this order. Initially, the graph is connected, and at the e... |
I'm trying to design an algorithm for evenly fitting decimal numbers into a decimal number.
Say I have a set $N$ of decimal numbers ($N_1$, $N_2$, ..., $N_n$) and a target value $Y$. I'd like to see what combination of values of $N$ (values may be used zero to many times) add up evenly to $Y$.
I've accomplished it by s... |
The definition of vertex cover is as is:
Set of vertices such that each each has atleast one endpoint in that set.
In the above example, why can't we consider all vertices as vertex cover since all vertices are endpoints to all the edges.
|
The Problem
There is no easy way to get a permutation with a regex.
Permutation: Getting a word $$w=x_1…x_n$$ ("aabc") to another order, without changing number or kind of letters.
Regex: Regular expression.
For verification:
"Regex permutations without repetition" The answer creates JavaScript code instead of a reg... |
Corollary 23.2
Let $G = (V,E)$ be a connected, undirected graph with a real-valued weight function $w$ defined on $E$. Let $A$ be a subset of $E$ that is included in some minimum spanning tree for $G$, and let $C = (V_C,E_C)$ be a connected component (tree) in the forest $G_A = (V,A)$. If $(u,v)$ is a light edge conne... |
I have a string like this:
11,512,64,23,46,12,67,85,84
And I'm sure it's following these rules below:
Only , and 0123456789 in it.
No number will be bigger than 999, that means they are all 1,2 or 3 digits number.
Are there any simple algorithms that I can have to compress/decompress the data?
For instance, a very s... |
I have a closed 2D shape expressed as a list of points, like that:
[
{0, 5}, <-- {x, y}
{10, 5},
{15, 6},
...
]
The user has a canvas: each time he clicks on that canvas, a point will be appended to the list, and he will see the updated shape on screen.
How can insert the point between two nearest points inst... |
I'm reading the CLRS book and have a question about the following quote from the book.
In order for radix sort to work correctly, the digit sorts must be stable.
Why is stability required? Wouldn't Radix sort still produce correctly sorted output even if there was no consistency in ordering of identical values, sinc... |
So let's say I've implemented an algorithm running in $O(n^2)$ on my 3-tape TM. What kind of time complexity would I expect for a single-tape TM?
I just don't know where to get started...
|
A source emits 5 signals s1, s2, s3, s4 and s5 whose probabilities are as follows: 1/3, 1/3, 1/9, 1/9, 1/9, 1/9. How many prefix codes we can construct on A={a, b, c}? And how many are there with the same performance (efficiency)?
|
I'm trying to minimize the area of a simple (non-intersecting, without holes) polygon by adding points to it, or modifying points of its subset. Let me describe this more formally:
Let:
$P$ be a polygon consisting of points $\{x_1,x_2,...x_n,x_1\}$
$S$ be a subset of $P$, bounded by points $x_j$ and $x_k$:
$m$ be a n... |
Currently doing an Algorithms course in my 2nd year of university (I am a maths student, but thankfully at Warwick University, we have quite a flexible degree). One of the topics we cover is the divide and conquer algorithmic paradigm. Some algorithms we have studied/I have read about are mergesort, max subarray proble... |
It is often stated that the MAX-XOR-SAT problem is NP-hard, and that likewise is the MAX-2-XOR-SAT problem. However, I cannot find a reduction from SAT to either of these problems, nor a proof of NP-hardness. Is one published anywhere?
|
This is an interview question I was asked, which I don't know how to approach. I would appreciate pointers to algorithms I should look up.
You are placed on the real line, and there also are $K$ lions on the real line, which are currently sleeping. You are given the wake up time of each lion. You can walk past a lion a... |
I need to compare each index with one another and associated array value as well.
For example,
for(int i = 0; i < n - 1; i++) {
for(int j = i + 1; j < n; j++) {
if(a[i] > a[j]) { // Condition will be any
swap(a[i], a[j]); // Any action
}
}
}
Inside loops, there is a condition t... |
I am looking for some puzzles like Sokoban or 15-puzzle but more difficult to solve and satisfy the following requirements:
The number of possible moves at each step should be limited, let's say < 10.
Easy to generate a lot of levels (unique instances of puzzle). Let's say > 10**8.
One player.
Ideally has a terminate ... |
Studying for a test in a computer science class and cannot figure out the answer to this question. Any help would be appreciated!
Although the picture shows a directed graph, please treat it as an undirected graph, ignoring all the edge orientations.
|
I am trying to understand the runtime of Pollard's $(p-1)$-algorithm as presented on Wikipedia. There the author writes that it takes $\mathcal{O}(B\log B\log^2n)$ time, but I do not see why.
Here the Wikipedia version:
Inputs: $n$: a composite number
Output: a nontrivial factor of $n$ or failure
select a smoothness b... |
I am trying to complete question and would like to avoid copying answers, but I do not necessarily understand what I am doing.
I am working on the following problem:
Suppose you are consulting for a company that manufactures PC. equipment and ships it to distributors all over the country. For each of the next n weeks... |
Let's say we have given tree of $N$ nodes and $N-1$ edges, each of the $N$ nodes is assigned one integer, either $0$ or $1$. We want to count all paths between two nodes $u$ and $v$ such that on the shortest path from node $u$ to node $v$ there are odd numbers of ones ( or in other words the sum of all integers on this... |
I am trying to learn how to determine time complexity. Sometimes, I see complexity as $\log n + \log n = 2\log n$ but sometimes I see complexity as $\log n\cdot\log n$ which is $(\log n)^2$.
Suppose I need to do two binary searches to find two different elements, in one algorithm. Is this $\log n + \log n$ time, or wou... |
Assume I have the following list of companies:
Apple
Big Apple
Google
Then I have this sample string:
Big Apple is a company that is trying to be the next Google.
Given the list of companies and the sample string above, how can I find the list of companies in the sample string?
If I iterate through the list of comp... |
This was part of my interview questions.
Given a sequence of integers as an array, I have to determine whether it is possible to obtain a strictly increasing sequence by removing no more than one element from the array.
For instance,
For sequence = [1, 3, 2, 1], the output should be
almostIncreasingSequence(sequence) ... |
I've been studying some number theory, and I came across this problem:
Lagrange’s prime number theorem states that as N increases, the number of primes less than $N$ is $Θ(N/ log(N))$.
Consider the following algorithm to choose a random n-bit prime:
1) Pick a random n-bit number $k$.
2) Run a primality test on $k.$
3... |
Given a string of values $AAAAAAAABC$, the Shannon Entropy in log base $2$ comes to $0.922$. From what I understand, in base $2$ the Shannon Entropy rounded up is the minimum number of bits in binary to represent a single one of the values.
Taken from the introduction on this wikipedia page:
https://en.wikipedia.org/wi... |
First I have general question. In a circuit with both logic and D edge flip flop does hold time have to satisfy $t_{hold} < t_{setup}($D-FF$) + t_{pd-min}$(Logic),
or is it enough that $t_{hold} \le t_{setup}($D-FF$) + t_{pd-min}$(Logic) ?
Also i have a question about a specific circuit:
with the following times:
th... |
Consider the recurrence
$$ T(n) = 3 T(n-1) + 10 T(n-2) + 7 \cdot 5 ^ n, $$
with base cases $T(0) = 4$ and $T(1) = 3$.
How do I solve such a recurrence?
|
I want to compute the difference/intersection between two paths. By path I mean a list of points that can be created by the following actions on a graphics context:
move to x, y
line to x, y
Bézier to x, y
How could I do that? What's the best algorithm to compute the difference/intersection between two paths, A - B? ... |
Suppose we're given an infinite stream of integers, $x_1, x_2, \dots$.
a) Show that we can compute whether the sum of all integers seen so far is divisible by some fixed integer $N$ using $O(\log N)$ bits of memory.
b) Let $N$ be an arbitrary number, and suppose we're given $N$'s prime factorization: $N = p_1 ^{k_1} p... |
Given $n$ bins in a row (numbering from $1$ to $n$) and $2k$ balls ($n \ge 2k$), one may put all balls into bins with each bin having at most one ball (there are $\binom{n}{2k}$ configurations). Denote the indices of bins having balls as $x_1, \cdots, x_{2k}$ in ascending order ($x_1 < x_2 < \cdots < x_{2k}$). We defin... |
There are two sorted arrays nums1 and nums2 of size m and n respectively.
Find the median of the two sorted arrays.
Example 1:
nums1 = [1, 3]
nums2 = [2]
The median is 2.0
Example 2:
nums1 = [1, 2]
nums2 = [3, 4]
The median is (2 + 3)/2 = 2.5
Here is my solution:
//Find out the median of two sorted array
public class M... |
I just started learning about linear programming in my class, and I'm having some trouble understanding the MST Formulation Integer Linear Programming (Cutset Formulation).
This is the definition:
$x_{ij}$ is defined to be $1$ if the edge $ij$ is in $T$.
What exactly does the optimum value represent here? Is it the n... |
I am trying to write a recursive-descent parser for untyped lambda calculus. While researching the way of formulating the grammar, I managed to put together something like this:
without left-recursion:
TERM -> APPLICATION | ABSTRACTION
ABSTRACTION -> LAMBDA LCID DOT TERM
APPLICATION -> ATOM APPLICATION'
APPLI... |
I'm given the Bernoulli distribution of a biased coin toss with probability distribution $P_X = \{0.2, 0.8\}$ over the alphabet $\mathcal{A}_X=\{0,1\}$.
I want to sketch the normalized essential bit content $\frac1N H_\delta(X^N)$ as a function of $\delta$ for $N=1000$, where:
$X^N = \{X_1, X_2,\dots,X_N\}$ is the ou... |
I came across a serious doubt regarding the implementation of the Dijkstra algorithm and hence wanted to discuss.
For the given below graph
What should be the Cost to reach Node G from Source Vertex A?
I was getting 2, as vertex E is the last processed vertex and when it was being processed
$E.d=9,(E,G)=-7$ so $G.d=2$... |
How can I prove that this language is regular, possibly by making a finite automata for this: $(ab)^*(cb^n)^*$, where $n\ge1$?
An automaton can easily be drawn for the part $(ab)^*$, but the part $(cb^n)^*$ doesn't seem to be regular because if the Kleene closure is taken $\ge2$ times, then it will be of the form $(c... |
I want to know for what types of graph it is possible to find Hamiltonian cycle in polynomial time. It would be helpful also to show why on some types of graph finding Hamiltonian cycle would be only possible in exponential time.
|
I've heard many times people debate the possibility of a real world computation that is impossible for a Turing machine, especially in the context of a human mind. Implying that the Church-Turing thesis is wrong and that a Turing machine does not accurately model any possible real world computation. To me, it seems tha... |
Administrative normal form is a program intermediate representation in which each immediate instruction has a name. It is used in GHC and OCaml.
K-normalized form is an intermediate representation in which each instruction consists of one assignment and operation. It's used in MLKit, Min-Caml, and GoCaml.
Both A-normal... |
Given two lists of complex numbers, is there an efficient algorithm to choose one element from each list such that the magnitude of their sum is maximal?
|
Nomenclature
The term expressive in the question shall bear the same meaning as in the following sentence:
A Turing Machine is as expressive as Lambda Calculus.
Introduction
While learning Haskell, I had noticed that there are 2 ways to achieve the same effect, namely Pattern Matching and Case Expression. For example... |
so I have spent nearly 5 hours trying to simplify this particular expression but I keep going round and round in circles. I have my hard copy notes to show you where I scribbled for hours and hours to no end. so please can someone please show me how can this be done?
$$(\overline{A}+\overline{B}+E)(\overline{A}+\overl... |
Is there any generic algorithm which implements a floating point radix conversion?
Lets say we have a $p$-digit FP number
$A = \sum_{i=0}^{p-1} A_i \beta^{e-i}$
in radix $\beta$ and with $0 \leq A_i < \beta$.
How do we find the $A'_i$, $e'$ values for the $p'$-digit base $\gamma$ FP number
$A' = \sum_{i=0}^{p'-1} A'_... |
I'm trying to learn how the "failure table" is constructed in the Knuth-Morris-Pratt algorithm since it seemed nontrivial to me that you could do it in $O(k)$ time (where $k$ is the length of the pattern, $W$). To be clear, we let the failure table $T$ be a length $k$ array where $T[i]$ is the length of the longest pro... |
Let $A$ be an alphabet and $u,v\in A^{*}$ be words. If it exists $z, u', u'', v', v'' \in A^{*}$ such as: $u = u'zu'' $ and $v = v'zv''$ then $z$ is a substring (also known as factor) of both $u$ and $v$ (i.e. “common”).
Is there a fairly standard or acceptable notation to denote either:
The predicate: “$u$ and $v$ ha... |
I'm currently debating with some friends what is the Big O space complexity of this isAnagram method:
public boolean isAnagram(String firstWord, String secondWord) {
if(firstWord == null || secondWord == null || firstWord.length() != secondWord.length()) {
return false;
}
Map<Character, Integer> ch... |
I've already attempted it but I am finding it difficult to understand if this is correct.
give a context free grammar for the following:
$$ \{p^{3m+n}q^nr^2p^m\mid m,n\ge 0 \}$$
The answer i've attempted is:
$S \to XY$
$X \to pppXp \mid \ q$
$Y \to qYr \mid \epsilon$
I've been trying to understand if i need to break d... |
When reading discussions of Gödel's theorems one is always heeded that just because formal system $F$ proves a theorem $T$ that doesn't necessarily mean that when one applies the intended interpretation the theorem is actually true. After all, even if one assumes that $F$ is consistent, it might still be unsound.
But t... |
Let $x_1,x_2,x_3,x_4$ be boolean variables (i.e $x_i \in \{0,1\}$)
Consider
$f(x_1,x_2,x_3,x_4) = x_1 \wedge x_2 \wedge x_3 \wedge x_4 $
I want to write $f$ in terms of two-input NOR gates. I.e, $\mbox{NR}(x,y)= \neg ( x \vee y ) $.
What is the minimum number of NOR gates to write it?
I found that it can be done with ... |
When I search unit interval graphs in ISGCI, it says that the unit interval graphs (UIG) are equivalent to ($C_{n+4}$,$S_3$,claw,net)-free graphs.
I am confused about the definition of an $S_3$ graph.
I am aware that in some resources, $S_n$ means $K_{1,n}$, and in others $S_{n-1}$ means $K_{1,n}$.
However, in both cas... |
Past year paper question:
Let $M_i$ denote the Turing machine with code $i$ using the alphabet $\Sigma=\{a,b\}$.
Show that the following language is not recursively enumerable:
$L = \{a^i \;:\; (\exists x \in \mathrm{Lang}(M_i))\;[ xx \notin \mathrm{Lang}(M_i) ] \}$
I tried to show that we can reduce $L_e$, the set of ... |
I am trying to solve this problem listing all prime numbers less than an integer but using the smallest amount of memory.
Is it possible to solve this problem using a smaller amount of memory?
int main ()
{
int n = 10000;
for (int i=2; i<n; i++)
for (int j=2; j*j<=i; j++)
{
if (i ... |
Construct a DFA $M$ with $\Sigma = \{a\}$ and max. 11 states so that $a^{23}\not\in L(M)$ but $\{a^i|i\geq 24\}\subset L(M)$.
I don't see how it is possible? Because it's a DFA and the alphabet only contains $a$, shouldn't I only be able to look at modulo 11? I could make 1 mod 11 not accepting but then $a^{34}$ would... |
According to Wikipedia, while the 2SAT problem is polynomial, its maximization variant MAX2SAT is NP-hard. But, they do not provide a reference for this claim. Is this obvious? If not, where can I find the reduction used to prove this claim?
|
I am trying to create a regression model using a Neural Network. I am currently learning how to work with neural networks (deeplearning.ai) and so the model is not implemented using any existing frameworks like keras.
Based on what I have learned,
the model is configured to use no activation function in the output
la... |
In MAX-SAT, we are given a formula and want to maximize the number of satisfied clauses. I.e., given a formula $\phi = c_1 \cap \cdots \cap c_n$, where each $c_i$ is a disjunction, we want to find the largest $k\in\{1,\ldots,n\}$ such that, for some assignment, some $k$ clauses $c_{i1},\ldots,c_{ik}$ are true.
In MAX-M... |
I have been wondering this question because given a number $n$ with prime factors of the form $4k+3$ when we square $n$ and find a sum of two squares which should reveal these types of factors (as when we find non-trivial answers they have a gcd above 1 etc.). However, when a number solely has prime factors of form $4k... |
I'm a noob reading Michael Sipser's Introduction to the Theory of Computation, and I'm at a part where he's demonstrating how to construct finite automata that accept languages described by regular expressions. He does this by giving regular expressions, breaking them down into simpler regular expressions that represen... |
Let's say $h_1(n) \geq h_2(n)$ so that dominance is established even if $h_1$ and $h_2$ are both inadmissible/non-optimal heuristics -in whichever given search space.
Is $h_1$ still faster/better than $h_2$ or does the dominance rule only apply to admissible heuristics?
Also, if I could ask for a bit of extra help, ca... |
I am currently converting this NFA to a DFA
I have come up with the following DFA:
0 1
->A {A} {B}
B {CA}
*CA {A} {AB}
AB {CA} {B}
Although, I have no idea what to put for B. In the NFA, upon the B receiving 1 input, it goes nowhere - assumable unaccepted by the NFA. Do I send the... |
What is meant by a short pipeline?
Does that mean the instructions are split into small number of pieces OR length of a piece is short?
|
If uncomputable numbers existed, could this hypercomputation machines compute them? Could hypercomputation compute all types of uncomputable things? Even truly inconsistent things? Even things that cannot be described by any type of information (like a way of factorizing number 181 using classical mathematics, the math... |
Average memory access time = Hit time + Miss rate * miss penalty
Assume a computer with only one cache level. What is the exact meaning of hit time? Is it the number of clock cycles to access data from cache? OR Clock cycles to execute an instruction? How does the number of clock cycle per instruction come into this e... |
For a homework assignment, I have to prove that a given language $L \in coNP$.
I understand that one way of doing so, would be to prove that $\bar{L} \in NP$, i.e. give a polynomial time verifier for $\bar{L}$.
I am having trouble understanding what the complement of the language would be. eg: if
$$L = \{ (a, b, c) \i... |
We are given a set of $n$ coins with denominations $v_1,v_2,\ldots,v_n$ and a number $x$.
The coins are to be divided between to persons, with the restriction that each person's coins must add up to at least $x$.
For example, if $x=1$, $n=2$, and $v_1=v_2=2$, then there are two possible distributions: one where Person... |
In a programming class I take, we briefly (very briefly) touched lambda calculus. I think I have a pretty good grasp of the basics now, but one example given I just don't understand. Am I missing something or is the example possibly false?
$\lambda x.x \; (\lambda y.2*y) \; square \; 3$
The solution to this was $6$, be... |
I am studying computational complexity and i am trying to solve this problem.
We are given a (non-bipartite) complete graph:
G = (V, W, E)
where the vertices can be divided in two classes V and W and the edges between any two vertices are weighted either 1 or 0.
w(x, y) = {0, 1} ∀ x, y ∊ V ∪ W
We need to:
calculate a ... |
Given the following graph:
With the assumptions below:
A node on the left is linked to several nodes on the right
Nodes on the right are paired together: one is black, one is white
Each pair of nodes on the right can be swapped (black becomes white and white becomes black)
A node on the left is green if linked to onl... |
I am working on a recursive descent parser for lambda calculus. In my grammar, after removing left-recursion, I am left with the following two productions:
# APPLICATION -> ATOM APPLICATION'
# APPLICATION' -> ATOM APPLICATION' | ε
Both APPLICATION and APPLICATION' correspond to the same type of node in the AST... |
If its proven today that $P=PSPACE$ the whole polynomial hierarchy collapses. Moreover since $BQP \subseteq PSPACE$, it will also result in $P=BQP$.
However unlikely the above scenario is, hypothetically if this were the case what are the complexity classes (the most important ones) that will survive this collapse into... |
Context:
I play in a simulated online basketball league (a la the NBA) where each human player controls one of the teams. When each simulated basketball player is a free agent (that is, their previous contract with a team has expired) they field offers from teams and a group of moderators decides which team that player... |
When you have an algorithm that may skip a lot of iterations due to a hash table lookup, do you still count the iterations that are exited immediately?
Hypothetical example:
var n = input.length; //eg, [1,4,6,2,0,8]
for (var i = 0; i < n; i++) {
visited[i] = true;
for (var j = 0; j < n; j++) {
if (visited[j] ... |
I am currently studying algorithms and algorithmic design, and I am confused those terms. What is the difference between them?
Thank you.
|
I'm trying to prove (by induction) that BFS in equivalent to DFS, in the sense that they return the same set of visited nodes, but I'm stuck in the middle of some of the cases.
Let $G$ be a directed graph and $u \in V(G)$.
We want to prove that $ BFS(G,u) = DFS(G,u)$.
$\text{BASE CASE}$
$V(G) = \{u\}$
$BFS(G, u) = ... |
In compressed data, repetition of same pattern is not a lot, so, you can expect it to be with space inside to contain always. I found a way to compress data without limitation. Is it right? Am I thinking in the true way?
BigNumber = BigNumber * N + LittleBitsNumber (=>smaller than N)
Remove that bits Number from data/f... |
I chanced upon the following question online:
A company has two trucks, and must deliver a number of parcels to a
number of addresses. They want both drivers to be home at the end of
the day. This gives the following decision problem.
Instance: Set V of locations, with for each pair of locations
v, w ∈ V , a dista... |
I have a problem at work. I need to find a subset of a set of positive integers that sums to a certain value. I know there is a subset but I need to find it. Is this new problem the same as the subset sum problem?
|
A code is (statistically) self-synchronizing if, given that the transmitted string is long enough, the receiver is guaranteed to eventually synchronize with the sender, even if bit flips or slips have occurred.
Do Huffman codes have this property in general? In case not, is there a criterion for testing if a Huffman co... |
I want to design a binary tree with preallocated nodes, in order to avoid calling malloc/free every time I want to insert/delete a node. The problem is I don't know ahead of time how many nodes the tree will have, so I am thinking I need to allocate a block of nodes at a time, then allocate another block when the first... |
I have a question as follows
Consider the relations $r1(P, Q, R)$ and $r2(R, S, T)$ with primary keys $P$ and $R$ respectively. The relation $r1$ contains $2000$ tuples and $r2$ contains $2500$ tuples. The maximum size of the join $r1⋈ r2$ is :
My attempt - Suppose all value of $R$ in $r1$ are same. Then it should ... |
The traditional way to implement a SQL database is to parse the query, create a parse tree, and then evaluate it using the "volcano" model. In this model you call .next() on the root node of the tree to get the next tuple, and each node calls .next() on its child nodes, percolating the tuple up the tree.
In 2011 Effici... |
"If every element comparison (testing whether $a_i \le a_j$ ) provides at most one bit of information, argue that you need at least on the order of $\ln(n!)$ many tests/comparisons to sort the list."
This is a question on my homework at the moment. I don't understand how I'm supposed to go about arguing this as I don't... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.