instruction stringlengths 35 29.1k |
|---|
A team has decided that every morning someone should bring croissants for everybody. It shouldn't be the same person every time, so there should be a system to determine whose turn it is next. The purpose of this question is to determine an algorithm for deciding whose turn it will be to bring croissants tomorrow.
Cons... |
I got a very hard automatically clustering problem with some training data (500 samples, each with roughly 5-50 classes and 10000-20000 data points in total). What I need to do is to cluster an input into multiple classes (the number of classes is unknown).
So far I had some several clustering algorithms, each gives m... |
My task is to design a FSM whose output goes high for a single cycle whenever the pattern 0110 is detected on its input. The patterns may overlap, so an input 0110110 of would cause the output to go high twice- once for the first pattern (0110110), and once for the second pattern (0110110). a is used for the input and ... |
In FIFO: when process get cpu time and then go to IO.
What happend in the time it is in IO? another process can run?
After finishing IO it continue or "loss its turn"?
Why FIFO give priority to cpu bound process?
In RR: assume slice time is s and after (s-2) for eample it get IO, what happend with the 2 other seconds?... |
$f(n) = 3n+3$ ;
$f(n) = O(n)$
By definition :
$3n+3 \leq c_1.n$
By dividing both side by $n$
$3+\frac{3}{n} \leq c_1$
means we are getting constant range for $c_1$ for any $n$. Again it shows $c_1$'s value must be greater than $3$ at any cost.
e.g. if we take $c_1$'s value 3.5 so $n$'s value will be $6$.
Now if we pl... |
I've been reading about the differences between serializability and linearizability, which are both consistency criteria for replicated systems such as replicated databases. However, I don't know in which cases linearizability would be needed, even though it's stronger than serializability.
Could you come up with scena... |
From TAoCP, Vol. 3 by Knuth we know that expected (mean) probe counts for hash tables with open adressing and double hashing collision-resolution are:
$1 \over 1 - \alpha$ - for unsuccessful search
${1 \over \alpha} ln({1 \over 1 - \alpha})$ - for succesful search
Where $\alpha$ is load factor.
Are there expressions ... |
I am confusing with the following example.
$n^{1.001} + n\log n = \Theta ( n^{1.001} )$, why not $n\log n$?
$c_1 \le \frac{\log n}{n^{0.001}} \le c_2 $
OR
$c_1\le \frac{n^{0.001}}{\log n} \le c_2$
For me both are same. Means both are giving some constant range for $c_1$ and $c_2$.
$10 n^3 + 15 n^4 + 100 n^2 2^n = \... |
In the web draft of Arora and Barak, "Computational Complexity: A Modern Approach", the way I understand their definition of a round of interaction is that it consists of either the verifier or the prover sending a message. In other sources on the matter, it seems to me that a round consists of both the verifier and th... |
I have made a connect four game in JS and currently have a functioning minimax algorithm. The problem I'm having is that it is very, very easy to beat, even with a large depth. This is leading me to believe that I need a better heuristic function, but I cannot come up with much better than what I already have. So, I th... |
I'm wondering, what is the time-complexity of determining emptiness for 2-way DFAs? That is, finite automata which can move backwards on their read-only input tape.
According to Wikipedia, they are equivalent to DFAs, though the equivalent DFA might be exponentially larger. I've found state complexity for their complem... |
When we talk about distributed computing - it often refers to problems in biology or web search where there is a large quantity of data to process, or email where there is a large number of concurrent users.
Often in financial services, the problem space is OLTP for online banking, or overnight batch processing for su... |
For a regular language $L$, its DFA complexity is the size of the minimal DFA accepting it, and its NFA complexity is the size of the minimal NFA accepting it. It is well-known that there is an exponential separation between the two complexities, at least when the size of the alphabet is unbounded. Indeed, consider the... |
Let $A$ be an array of totally ordered elements. A subarray $A[i..j]$ is decreasing if $A[k]\geq A[k+1]$ for all $i \leq k < j$. It is increasing if $A[k]\leq A[k+1]$ for all $i \leq k < j$. It is monotonic if it's either decreasing or increasing.
We call an array is $k$ monotonic if the array can be partitioned into ... |
Full disclosure, I'm interested in what this means about transformations on NFAs, but regex expressions seem like a easy way to ask the question.
If you have a regex that uses the plus operator (match one or more) can it, in the general case, be transformed into a regex that uses only the star operator (match zero or m... |
What is the worst case running time to search for an element in a balanced binary search tree with $n 2^n$ elements?
The answer is $\Theta(n)$.
My answer:
To search an element in BST is $\log (n)$ so
$$
\begin{align*}
\log(n 2^n ) &= \log(n) + \log(2^n) \\
&= \log(n) + n\log 2 & \text{(base is 2)} \\
... |
Let $W(n)$ and $A(n)$ denote, respectively, the worst case and average case running time of an
algorithm executed on an input of size $n$.
Which of the following is always true?
(A) $A(n) = \Omega(W(n))$
(B) $A(n) = \Theta(W(n))$
(C) $A(n) = O(W(n))$
(D) $A(n) = o(W(n))$
Answer: (C).
What do all these options "mean"... |
I want to begin by saying that this is NOT a homework question. I am reading Introduction to Algorithms - the famous CLRS text to become a better programmer. I am trying to solve the problems and exercises given in the book by myself.
I am trying to solve Excercise 10.1-2 from Chapter 10 Elementary Data Structures fro... |
I understand that fuzzy clustering using FCM produces a membership matrix for the set of data points we feed to it. What characteristics will an anomalous cluster produced during this method have? (Considering I only have unlabelled data)
|
I'm studying randomized algorithms and I sometimes come across results like
(1) The algorithm has an expected $O(f(n))$ cost.
and
(2) With constant probability, the cost is bounded by $O(f(n))$.
I'm perfectly fine with statements like (2), but I'm puzzled to what extent a statement like (1) is useful:
For certain ... |
I have an assignment to do and I'm quite stuck with the following question :
Use Rice's theorem to show that
$ \qquad L' = \{ \langle M \rangle \mid \; (\exists \text{ TM } M') \; [ L(M') = L(M) \text{ and } M' \text{ has less than 29 states} ] \}$
is undecidable.
I have absolutely no idea how to proceed.
Would someo... |
Now I am confused about symbolic execution (SE) and reachability analysis (RA). As I know, SE uses symbols to execute some code to reach each branch with branch conditions. And RA can be used to find the reachability of each branch, right? When RA is used, we can extract the branch condition for each branch. If so, wha... |
My similarity search seminar topic are M-trees. I would like to give some examples about where they are practically applied, but I can't find anything googling.
Does someone know if M-trees are still used and what for? I am interested in answers regarding both practice and applied research.
|
Consider 2 stations that share the same bus. Both stations are perfect synchronized each other and when they have packets to transmit, they are starting the transmission in the beginning of a same slot. Transmission is as follows: when base $i$ has a packet to transmit attempts with probability $p_i, i=1,2$. Different ... |
This is a practice problem for a midterm in a class I'm taking:
Given a regular language $L$, describe formally a Turing machine that recognize $L$.
I'm not sure how I should do that.
|
The Kurose & Ross book uses "store-and-forward delay" as a synonym for the transmission delay of a packet over a network link.
As a newcomer to computer networks, it isn't immediately obvious to me how these two terms are synonymous. My current understanding is that if not for the store-and-forward behavior of packet ... |
I just had a CS mid-term and one of the questions was:
OOD allows ADTs to be created and used.
True
False
I answered false, but my answer was marked as incorrect. I suspect what the question means is "objected-oriented design can be used to implement abstract data types", but if that's what it means it seems very c... |
Is developing an optical character recognition system for an alphabet which has no previous ocr considered a reputable conference or journal worthy research project, given the fact that there are so many commercial ocr system? Though, lots of conference proceeding and journal entries shows up when googled, but most of ... |
Grover's algorithm uses an oracle function $f(x) \to \{0,1\}$ to find the location of a single marked element from an unordered database of $2^n$ elements with high probability. As part of an assignment I am supposed to design a variant of the algorithm that finds all of the $t$ marked elements ($t$ is known). I want t... |
I am trying to learn how to build parse trees.
This is a very simple example as I am hoping I can catch on to the concept.
$\mathtt{y=x+z}$
Wouldn't this simply require $\mathtt{(term) = (term) + (term)}$?
I'm not sure how to express my answer on here but would it only require one branch due to the $\mathtt{=}$ sign?... |
I have a constrainted optimization problem in the (Shannon) matrix entropy $\mathtt{(sum(entr(eig(A))))}$. The matrix $A$ can be written as the sum of rank 1 matrices of the form $[v_i\,v_i^T]$ where $v_i$ is a given normalized vector. The coefficients of the rank one matrices are the unknowns in which we optimize and ... |
In these notes about quantum computation by Scott Aronson, he explains that the computation classes $\mathsf{BPP}$ is contained in $\mathsf{BQP}$, but that they are not equal, and
So, the bottom line is that we get a problem -- Simon's problem -- that quantum computers can provably solve exponentially faster than clas... |
Suppose, we have an array of numbers $x_j$ and their corresponding weights $w_j$ where $\sum_j w_j \gt 1$. Now we need to find $x_m$ such that
$$\sum_{j=1}^{m-1} w_j \lt 1/2 \quad \text{and} \quad \sum_{j=m+1}^{n} w_j \ge 1/2$$
Moreover, $x_m > x_j$, $x_m < x_k$ where $j \ne k$. i.e. a solution should be like this -- ... |
I am having a little trouble understanding what is meant by a poly-time reduction.
Suppose I have two algorithms $A$ and $B$ and then I say that $A$ is reducible to $B$. Does polytime reduction mean that the algorithm that solves $A$ using $B$ as a helper runs in $O(n^k)$ for some $k$?
So for example suppose:
$A$ is an... |
There are a number of collections of network (or graph) data sets freely available on the web, e.g.
http://snap.stanford.edu/data/index.html
http://www.cc.gatech.edu/dimacs10/downloads.shtml
I am looking for dynamic network data sets, i.e. networks whose structure varies over time. They seem to be quite rare: The SNA... |
Consider the following functions
$f(n) = 3n^{(n^{1/2})} $
$g(n) = 2^{(n^{1/2}) \log n }$ // here base of $\log n$ is 2
$h(n) = n !$
Which of the following is true?
$ h (n)$ is $O (f (n) ) $
$h (n)$ is $O (g (n)) $
$g (n)$ is not $O (f (n) ) $
$ f(n)$ is $O(g (n))$
I tried this way :
To check which funct... |
I am looking for an example, which corresponds to what I've learned in my Applied Automata Theory Class:
Given a NFA $\mathcal{A}$,
a $\approx _\mathcal{A}$ quotient automaton can be bigger then a $\sim_\mathcal{A}$ quotient automaton and this can be bigger than an optimal quotient
and an optimal quotient does not n... |
I am writing a Android phone application that needs to be very power efficient, and I would like to use the most power efficient sorting algorithm. I will implement it in C for extra power efficiency. What algorithm is the most power efficient algorithm for sorting arbitrary text strings?
|
Let's say I have a finite set S with, say, 1000 elements, and a function f on some subset of S. Suppose that f has no useful mathematical properties.
What algorithm is most relevant in finding the subset of S that maximizes f?
|
I have a $D$-dimensional grid with the size $(N_1, \ldots, N_D)$, where $N_i$ are natural numbers, and a "flat block size" $M$, also a natural number. I want to find a decomposition $(m_1, \ldots, m_D)$ such that:
$\prod_{i=1}^D m_i = M$,
$R = \prod_{i=1}^D f(N_i, m_i) m_i - \prod_{i=1}^D N_i$ is as low as possible. H... |
Im sorry if this question has some trivial answer which I am missing. Whenever I study some problem which has been proven undecidable, I observe that the proof relies on a reduction to another problem which has been proven to be undecidable. I understand that it creates some kind of an order on the degree of difficulty... |
I'm seeking to write an algorithm which, given a value of N, will fill a matrix consisting of (N+1)(N+2)(N+3)/6 rows and 4 columns with the integers from 0, ... , N, subject to the conditions that:
The sum of values in any row is N
No rows are repeated (this should ensure that every such possibility is listed)
For ex... |
f(n) = 3n+3 ;
f(n) = O(n)
By definition :
$3n+3 \le c_1.n$
By dividing both side by n
$3+(3/n) \le c_1$
means we r getting constant range for $c_1$ for any $n$.
Again it shows c's value must be greater than 3 at any cost.
e.g. if we take c's value 3.5 so n's value will be 6.
Now if we plot graph ( Bcoz I w... |
I'm not terribly well-versed in CS (I only just a few moments ago learned what a k-partite graph is), so forgive me if this is an obvious question.
I'm wondering how to determine if a given graph matches a specified pattern, where this pattern is an example graph that is a k-partite graph where all inter-set edges must... |
I'm conflicted whether to post this here or in either math.stackexchange or mathematica.stackexchange.
Define a "simple zonotope" to be a regular $2n$-gon which is tiled by the following rule: all tiles are rhombi. They key point here is that rhombuses have equal side lengths (say equal to 1), but their shapes are allo... |
I've been looking for an algorithm which divides an undirected, weighted, planar and simple graph into $k$ disjoint subgraphs. Here, the graph is sparse, $k$ is fixed, and there are no negative edge weights. After cutting, each subgraph must be connected (i.e. there must be a path between any two vertices of the subgra... |
Given an NFA, is there a way to “take its complement” and obtain an NFA that recognizes the complement language?
|
I am looking for geometry algorithm.
I have an axis-aligned box $B$ and a triangle $T$ in 3D space. I want to compute an axis-aligned bounding box of their intersection.
Both $B$ and $T$ are convex polytopes and $B\cap T$ is also convex polytope. I don't need general algorithm, I need something fast and simple.
Have yo... |
A typical way of proving the greedy choice property of the fractional knapsack problem is as follows:
From Slide 5 of this link:
Given: A set of items $I = \{I_1,I_2..I_n\}$ with weights $\{w_1,w_2 ... w_n\}$ and values $\{v_1,v_2 ...v_n\}$. Let $P$ be the problem of selecting items from $I$, with the weight limit $K$... |
Updated based on comments:
In what ways can we distinguish a human being doing certain activities online and a bot programmed to do similar activities, say checking email, downloading some music files, shopping on ebay, searching on Google etc., or maybe trying to deface/hack a website, brute force a log-in password et... |
From the above image, while trying to maintain an AVL tree data structure, how would the tree look after inserting the value 10? Also, if anyone has any suggestions or simple method of rotating, feel free to share. I am a bit lost with this idea of maintaining a certain height in this data structure.
|
Given an sorted array of integers, I want to find the number of pairs that sum to $0$. For example, given $\{-3,-2,0,2,3,4\}$, the number of pairs sum to zero is $2$.
Let $N$ be the number of elements in the input array. If I use binary search to find the additive inverse for an element in the array, the order is $O(\l... |
I have implemented a neural network (using CUDA) with 2 layers. (2 Neurons per layer). I'm trying to make it learn 2 simple quadratic polynomial functions using backpropagation.
But instead of converging, it is diverging (the output is becoming infinity)
Here are some more details about what I've tried:
I had set the ... |
I found the paper "On the State Minimization of Nondeterministic Finite Automata" which, I assume, contains the Kameda-Weiner algorithm that I've been searching for. It's behind a paywall though. I'm just a hobbyist. Can someone explain it, or point me to another source?
|
I've only recently learned anything substantial about finite automata, and I've just come across some things I hadn't seen before. Specifically, that classic NFAs are ∪-NFA, and there are also these things ⊕-NFA , ∩-NFA and ⋆-NFA (I love unicode). These can all be seen in http://fastar.org/publications/PresentationFEW2... |
I've had a bit of experience programming Neural networks but I am fairly new with genetic algorithms (I'm only 17). I have a major issue that I can't understand. If a child get's one chromatid from one parent and another from another parent, then the genes are crossed over, how do you determine which alleles are active... |
Are there classes of problems that cannot be solved by an oracle machine? If so, are there specific problem examples of that class of problems?
Even the Omega number, at least the first N digits, could be computed as the Oracle could just return TRUE or FALSE for each {0,1}-digits...
|
This problem is the same as
number of ways to partition n into exactly m parts.
The recurrence given in Wikipedia has
p(n,k) = the number of partitions of n using only natural numbers ≥ k
How to find no of partitions of n which has exactly k non-zero parts? Is there a recurrence relation to solve this?
|
Is there a data structure to keep a list of elements (not necessarily sorted) that performs the Access (by index) and Insert operations in a reasonable asymptotic time?
When I say "reasonable time", I mean that it should be equal to or better than $O(\log N)$.
I'm looking for a structure similar to a dynamic array, but... |
How do you construct a DFA from a language that has a + sign? e.g. $L = \{(a+b)\}*$
|
Are there classes of problems that cannot be solved by an oracle machine? If so, are there specific problem examples of that class of problems?
Even the Omega number, at least the first N digits, could be computed as the Oracle could just return TRUE or FALSE for each {0,1}-digits...
|
According to CLRS, the Prim's algorithms is implemented as below --
$\mathtt{\text{MST-PRIM}}(G,w,r)$
for each $u \in V[G]$ do
$\mathtt{\text{key}}[u] \leftarrow \infty$
$\pi[u] \leftarrow \mathtt{\text{NIL}}$
$\mathtt{\text{key}}[r] \leftarrow 0$
$Q \leftarrow V[G]$
while $Q \ne \emptyset$ do // ... $O(V... |
When implementing a parallel version of an algorithm, what is the impact of synchronization delays on speedup efficiency? Does this depend on the platform used?
Is coarse-grained parallelism better than fine-grained parallelism in certain situations?
|
Let language $\mathcal{L} \subseteq \Sigma^*$ be regular.
A factorization of $\mathcal{L}$ is a maximal pair $(X,Y)$ of sets of words with
$X \cdot Y \subseteq \mathcal{L}$
$X \neq \emptyset \neq Y$,
where $X \cdot Y = \{xy$ | $x \in X, y \in Y\}$.
$(X,Y)$ is maximal if for each pair $(X',Y') \neq (X,Y)$ with $X'\cd... |
I am presently using an doubly linked list (C++ std::list) to hold a bunch of records that each have a unique integer identifier. The linked list is created in sorted order such that in the list, the next item always has a larger unique identifier than its predecessor.
The issue I'm facing is that occasionally I need ... |
I want to know how to calculate total number of nodes in a perfect balanced binary tree with $n$ nodes in the last level. I know the answer is $2\cdot 2^{\log n} - 1$. Just curious how this can be calculated
|
I'm trying to understand algorithm complexity, and a lot of algorithms are classified as polynomial. I couldn't find an exact definition anywhere. I assume it is the complexity that is not exponential.
Do linear/constant/quadratic complexities count as polynomial? An answer in simple English will be appreciated :)
|
This is the first time I will be studying compilers in depth. Can someone point me to best online resources (courses, articles, tutorials, video etc ) and books?
My main aim will be to do some practicals instead of just reading theory.-something where theory practical goes in parallel. So the reference must fulfill ... |
I am looking for references for the following problem:
I have a very special class of regular languages and my aim is to express (and to justify my conjecture) that this class itself is very small in some way (as a subset of the regular languages) and that the languages contained in this class are rather "bloated".
F... |
I am trying to figure out difference between fully- and quasi-reduced BDDs. I have read a lot of material but still it is not very clear. As I am trying to figure out the quasi reduced version for union between two BDDs.
The algorithm for union between two fully-reduced BDDs is
bdd Union(bdd p, bdd q)
//fully-redu... |
Suppose I have a decision problem $D$ and I encode it to a language $L \subset \{0,1\}^*$. Now, I can also encode it to a different language $L'$.
Is there any theorem relating the time complexity of $L$ and $L'$?
How does the time complexity of a problem change with different encodings of the same problem?
|
I'm curious about two things.
When we define the class called "probabilistic polynomial-time algorithm" in computer science, does it include polynomial-time algorithm with exponential space?
For example, when algorithm is considered to be given a input from domain $\{0,1\}^n$,
what if the algorithm internally querie... |
This is a question from the book Data structures using C and C++ by Tenenbaum. Not a homework problem but self-study.
Recursive definition of a+b, where a and b are non-negative integers, in terms of successor function succ defined as
succ(int x)
{
return(x++);
}
I have been thinking how is it p... |
When I work on an algorithm to solve a computing problem, I often experience that speed can be increased by using more memory, and memory usage can be decreased at the price of increased running time, but I can never force the product of running time and consumed memory below a clearly palpable limit. This is formally ... |
I get used to think exhaustive search and combinatorial search are same, but I got confused by reading a paper!
What is the difference between exhaustive search & combinatorial search ?
|
I'm trying to find an algorithm for a motion planning problem. I have $N$ points, $P_1$ to $P_N$, in $k$-dimensional cartesian space, defining $N-1$ segments. The problem is about constructing the fastest motion plan, that is, a function $p(t)$, approximating the path along the segments, bound by some constraints:
For... |
It seems that on this site, people will often correct others for confusing "algorithms" and "problems." What are the difference between these? How do I know when I should be considering algorithms and considering problems? And how do these relate to the concept of a language in formal language theory?
|
While reading a cryptography textbook, i find the definition of a function that is hard on the average.(More precisely, it is 'hard on the average but easy with auxiliary input', but i omit latter for simplicity.)
Definition : Hard on the average :
$h:\{0,1\}^*\to \{0,1\}^* $ is hard on the average if there exists a p... |
While reading the paper Holistic twig joins: optimal XML pattern matching I came across the pseudo code for liststack algorithm. (available through google scholar)
A function in the algorithm confused me, since I can understand what it is supposed to do, but can't deconstruct the notation:
$\qquad \mathtt{Function}\ \m... |
This is the first time that I'm looking in depth into the topic, although I've always been curious.
Could someone let me know about online resources (courses, tutorials, etc) and books that cover the basics of the topic?
I'd like to explore both the theoretical part and the more practical part of Data Mining.
|
According to the Wikipedia article on polynomial-time approximation schemes:
All problems in FPTAS are fixed-parameter tractable.
This result surprises me - these classes seem to be totally different from one another. FPTAS characterizes problems by how easy they are to approximate, while FPT characterizes problems ... |
Given a list of pairs $(a_1,b_1),\ldots,(a_n,b_n)$, where all $a_i \geq 0$ and all $b_i > 0$, my general problem is when we can use linear subset scan (described below) to solve the optimization problem of finding the optimal combination of pairs,
$$I^* = \hbox{argmax}_I F(\sum_{i \in I} a_i) / G(\sum_{i \in I} b_i)$$
... |
Question:
Suppose I have a
set of male people, and
a function isAncestor(person1,person2) that checks whether person1 is an ancestor of person2 in O(1) time. Eg, isAncestor(grandfather, grandson) would return true.
What are some fast algorithms for constructing a complete "family tree" by using only this informati... |
I don't "see" why the following syntax is equivalent to the second
syntax1:
E -> E + T
E -> T
syntax2:
E -> T E'
E' -> + T E'
E' ->
(it is to avoid left recursion and I am not understanding why the solution works)
How do I mathematically prove that both syntax definitions are equivalent
|
Currently, I'm delving into Analysis of Algorithms and I've discovered that I would need to improve my knowledge of Probability Theory. Any recommendation? Where do I start?
Thanks in advance!
|
I want to detect cycles in an undirected graph such that I get a list of all edges/vertices which form each cycle. For a graph G({a,b,c,d}, {a-b, b-c, c-d, d-a, b-d}) this would be {a, b, c, d}, {a, b, d}, {b, c, d}.
I have read this and I think that when the iterative pseudocode from Wikipedia finds a back-edge then I... |
I have a problem $\Pi_1$ that I want to show that is NP-hard. I know that I must find an NP-hard problem $\Pi_2$ and a polynomial time reduction $f()$ from instances of $\Pi_2$ to $\Pi_1$ such that $I_2$ is an Yes-instance of $\Pi_2$ iff $I_1=f(I_2)$ is an Yes-instance of $\Pi_1$.
What if I find a (constant sized) fami... |
Given two context-free languages $L_1$ and $L_2$, the language given by the difference of the two languages, $L_1 - L_2$, is (in general) not context-free. Is it possible to prove this without using pumping lemma?
|
I have
two red-black trees $T_1$ of black height $H_1$ and $T_2$ of black height $H_2$
such that all the nodes $N$ belonging to $T_1$ are less than (in value) all the nodes $N$ of $T_2$
and a key $K$ such that $K$ is greater than all the nodes of $T_1$ and less than all the nodes of $T_2$.
I wanted to devise an algo... |
I would appreciate an intuitive way to find the time complexity of dynamic programming problems. Can anyone explain me “#subproblems * time/subproblem”? I am not able to grok it.
Code for LCS -
public static String findLCS(String str1, String str2 ) {
// If either string is empty, return the empty string
if(nu... |
We have a switch with $2$ lines of input and $2$ output. Each line is $10 Mbps$. The size of packets is fixed and is $1KB$. The $1^{st}$ line of input is active (transferring packets) $40\%$ of the time, while the $2{nd}$ line is active $70\%$ of the time. $\frac{1}{4}$ of packets of input $1$ (with arrival) directed t... |
I'm reading the book: Formal Syntax and Semantics of Programming Languages. I don't understand this exercise:
Consider the following two grammars, each of which generates strings of correctly balanced parentheses and brackets. Determine if either or both is ambiguous. The Greek letter ε represents an empty string.
<st... |
From the Introduction section of Homotopy Type Theory book:
Type theory was originally invented by Bertrand Russell ... It was later developed as a rigorous formal system in its own right(under tha name "$\lambda$-calculus").
Can anyone explain me this sentence? I'm having trouble seeing $\lambda$-calculus as a type ... |
I have here a directed graph that I used to perform Dinic's algorithm to find maximum flow. I need to adjust this graph and this algorithm to work with dynamic trees (i.e. the Sleator-Tarjan algorithm).
I just wish I could find an image source or video that can help me visualize the steps. Something like this is really... |
Below is an algorithm for union of two quasi reduced BDDs p and q resulting in r.
bdd Union(bdd p, bdd q)
local bdd r;
1 if p=0 or q=1 then return q;
2 if q=0 or p=1 then return p;
3 if p=q then return p;
4 if Cachecontainsentry⟨UnionCODE,{p,q}:r⟩ then return r;
//p.lvl = q.lvl in case of quasi reduced BDDs
5 r ← ... |
How can I write an algorithm which inverts a 2-level BDD? It should take as input a 2L-level quasi-reduced BDD rooted at $r$ encoding a relation $R : B^L → 2^{B^L}$ and returns the 2L-level quasi-reduced BDD rooted at $s$ encoding the relation $R^{−1} : B^L →2^{B^L}$, that is, $j \in R(i) \iff i \in R^{−1}(j)$.
|
Let $k\in \mathbb{N}$ be fixed. The naive way to compute a sequence of values $a_1^k,\ldots,a_n^k$ where $a_i\in \mathbb{N}$ for all $1\leq i\leq n$ is compute $a_i^k$ individually with the exponentiation by squaring. This takes a total of $O(n\log k)$ multiplications.
Is this optimal? What if for each $a_i$, we have ... |
I need help to understand Chaitin's elegant program proof. An elegant program is the shortest program that produces a given output.
Here is the proof:
Construct a program $B$ that takes as input a number $N$ and enumerates all possible programs $P_k$ longer than $N$. $B$ runs the elegance tester $\mathrm{ET}$ on each ... |
How does one implement a space efficient data structure that satisfies the requirements below?
You have a large array
You have a filter which tells you which elements in that large array are to be deleted
Lookup of i'th element in the array should be constant time
The space formerly occupied by deleted elements in the... |
Considering a grammar that includes a dictionary or list with an optional terminal separator - e.g.:
$$
\begin{align}
obj \to & dict \\
&\mid OTHER \\
dict \to & \{ \quad \} \\
& \mid \{ \quad pairs \quad \} \\
pairs \to & pair \quad ,? \\
& \mid pair \quad , \quad pa... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.