instruction stringlengths 35 29.1k |
|---|
Why are these two architectures incompatible?
|
I'm trying to sort out in my mind the different ways of assigning semantics to a programming language. There are two main methodologies: operational semantics and denotational semantics (I asked a previous question on the relationship between the two).
It seems to me that an operational semantics is the same as definin... |
I teach a randomized algorithms course, and many of the cool applications are to streaming computation. I can have students implement these algorithms in Python or C++, but I feel it would be much cooler to have them do it in a streaming environment. Unfortunately, as far as I can tell, IBM Streams and Google's BigQuer... |
is this formula valid ??, if it is not what interpretation could i use ?
(∀ x: P(x) -> ∀ x: Q(x)) -> ∀ x: (P(x) -> Q(x)).
PS : i know that the other implication is valid.
|
I'm researching the topic of succinct tree representations right now and came across this presentation. On slide 17 there is an example of heap-like notation of a BST (using BFT bit-vectors) and the author claims that the amount of bits needed to represent a tree of $n$ elements (without their values) is exactly $2n+1$... |
Since parity game solving is in TFNP ("Total Function Nondeterministic Polynomial") (and the decision version is is NP ∩ coNP), I wonder whether it is contained in PLS ("Polynomial Local Search") or PPA ("Polynomial Parity Argument")? Add PPP ("Polynomial Pigeonhole Principle") if you want, even so this would probably ... |
I am a university level student of Computer Science having a great passion to study Mathematics. I have a firm belief that Computer Science or Theoretical Computer Science is a direct branch of Mathematics and Logic and also of the opinion that a Computer Science degree has always to be Math oriented as a matter of fac... |
Setting:
regular expressions with backreferences
unary language (1-symbol alphabet)
Is the following problem decidable in this setting:
Given a regular expression with backreferences, does it define a regular language?
For example, (aa+)\1 defines a regular language, while (aa+)\1+ doesn't. Can we decide which one ... |
I am unsure how to calculate what happens when you put a superposition as the control qubit into a cNOT gate or what happens when you put a superposition as the target qubit into a cNOT gate. I know what matrix represents the cNOT and I know that each superposition would be represented by $\alpha |00\rangle + \beta|01... |
I'm in a data structures course, but our current unit discusses recursion and not data structures, and I need to implement breadth-first recursion for the purpose of finding the shortest path through a maze. Is there a way to do this just using the basic structure of recursive calls and base cases? Or will I need data ... |
Is there any difference between expected polynomial time and randomized polynomial time algorithm?
|
I want to know if I want to draw up a finite state machine, say for example binary strings and I want a finite state machine that accepts only one kind of binary string e.g: 0110. Do I, for each state have to account for another symbol of the binary language being read during transition. Like for the first transition, ... |
I'm confused in trying to solve the following problem:
Find the number of comparisons made by Horspool's string search algorithm in the following case:
String: 001001001001
Pattern: 111
Attempt 1
The shift table value for 0 as per the algorithm should be 3 i.e. length of the pattern, because 0 is not part of the patter... |
Consider terms built from elements of $\mathbb Q$ and the operations $+,\times,-,/$, and $\sqrt[n]{\,\cdot\,}$ for each natural number $n$. Given the promise that two terms are well-formed -- that is, there is no division by zero, and no even roots of negative numbers -- is there an algorithm which decides when the two... |
I need to find whether this language is context-free or not:
{u#v | u,v belong to {a,b,c}* and u is a substring of v}, over alphabet {a,b,c,#}
I suspect that it's not, and am trying to approach it via Pumping Lemma, but then I noticed that: any examples like a^n#a^n will not work, cos we can always make vwx in the sec... |
Datalog is not Turing complete. It does however have the wonderful property of not being order sensitive. What problems can be solved in Datalog? Where does it fit in the Chomsky hierarchy, i.e. what abstract machine does it model?
|
Is there a rule that either every DFA contains or not, a loop(cycle in graph terminology)?
I do not seem to be able to generalize this idea in either direction.
Also if either of these is true, can we assume through DFA - NFA equivalence that the same is true for NFAs?
|
I am building a genetic algorithm to solve a "classroom map" problem. The goal is to place correctly students depending on several factors (shortsighted students, turbulent students...).
Here, the genomes is the classroom layout, each classroom has a fixed blackboard and tables positions, what varies is the position of... |
Problem:
Propose a plan (pre- and post-condition, invariant, dimension function) for searching a value in a 3D-array.
Solution:
This is the first solution I've foreseen:
$[\text{Ctx}\ C: m\geqslant 0\wedge\ n\geqslant0\ \wedge\ p\geqslant0\ \wedge\ b[0..n-1,0..m-1,0..p-1]$
$\{\text{Pre}\ Q: T\}$
$\{\text{Inv}\ P: 0\leq... |
More generally, how those translating softwares, for example, an assembler, like nasm, know how to transform in machine code the number "10", from this command: add marks, 10.
I know there is other things that needs to be comprehended about compilers, but I can't find some intuitive explications, like the addition of t... |
I was trying to implement a stack-based Virtual Machine (e.g. like JVM or some early version of Lua) for some benchmarks in order to test its performance against a Register-based VM.
I originally implemented it as having a global stack for all values and an array of instructions, where for the sake of simplicity, no fu... |
In my Artificial Intelligence class, in a section on Uninformed Search Algorithms, the textbook for the class (and as was discussed in lecture) the running time for Breadth First Search is listed as being: $O(b^{d+1})$ with the following explanation:
Normally (or at least in my experience thus far in Algorithms) I've ... |
I had used an existential quantifier within an implication, as below:
$$\exists ~ \sigma_{opt}~~~ \wedge~~~ n \in R^{+}~ ,~0<n<1 \rightarrow ~~ \sigma_{opt} = n$$
I've, recently, found that it is illegal to do that and just universal quantifier could be used in this situation. Could anybody explain the reason?
|
Picture
procedure MatchExistsA
for i = 2 to n
for j = 1 to i-1
if a_j = a_i then return true
return false
procedure MatchExistsB
BubbleSort(list)
for i = 1 to n-1
if a_i == a_i+1 then return true
return false
I calculated the worst-case running time of each algorithm using Θ notation, an... |
I am studying how Floyd-Warshall works and came across this doubt.
In the code:
for(int k = 0; k < V; k++)
for(int i = 0; i < V; i++)
for(int j = 0; j < V; j++)
Matrix[i][j] = min(Matrix[i][j], Matrix[i][k] + Matrix[k][j]);
I can see I can not change order of k because it is the intermediate ve... |
We have two production lines - product and container (two integer arrays product_list[N] and container_list[M]).
If the volume of a container is equal or larger than that of a product, then we could put the product into that container.
We want to put as many products into containers as possible.
We can pick any initial... |
I am required to write a factorial function in ARM assembly language that takes an integer $ n $ as input and returns the value of $ n! $. However, I can only use the $ 4 $ basic arithmetic operations $ + - * / $ (so no if-else or loop or recursion). Can anyone suggest a hint to do that? I can only do if I am allowed t... |
Which of the choices displayed is not a possible order in which Depth-First search could mark the vertices of the graph displayed as visited ?
|
I believe that they can't, but I couldn't find any existing framework for parsing expression grammars akin to the pumping lemma that would allow me to prove it.
The language I'm talking about is
$$\{ww\mid w\in\{a, b\}^*\} $$
Can you help me prove it, or find a PEG grammar that parses the language?
|
Can someone explain me how do I execute sum query from Index 0 to Index I given the binary value of that Index I. There are some trivial question that I want to know :
Do we have to remove last set bit and all the bits following it.
How many times do I have to access the temporary array made for the data structure i.... |
I am looking at a "practice test" for a Theory of Computation class. It was a test in a previous year.
I am asked to prove that, given L1 and L2 are regular, the union and difference are both regular.
It seems to me that for the union, since all the members of each separate set are regular, and the union consists exac... |
I'm reading Cover's "Elements of Information Theory" and I have a problem with the definition of uniquely decodable code.
A code is said to be singular if there exist two elements that map to
the same string. In other case it is said to be non singular.
Let $C$ be a code. The extension of $C$ is the homomorphism $C... |
I was given this as a homework exercise, yet I don't know whether my solution is sound:
Given a complete binary search tree where blocks are formed in order of the value of the nodes. What would the amount of IOs be to reach any leaf from the root?
I think I can define the amount of IOs recursively as follows:
se... |
I know that a graph G' is a subgraph for G if V(G')⊆V(G) and E(G')⊆E(G).
Today my professor wrote that G' is a subgraph for G if G' is a graph and V(G')⊆V(G), and then he told us that this definition is equivalent to the one we've seen before (= the first line in this post).
However, I don't think that these definition... |
We were asked the following question in our exam:
Solve or bound the recurrence T(n) = 2T(n − 3) for n>3 provided T(1) = T(2) = T(3) = 1.
How do I go about solving this type of recurrence? For a normal recurrence of the form T(n) = 2T(n - 3) + cn, I would have considered cn to be the root and then solved the remaind... |
So, a paper showed up on arXiv: https://arxiv.org/abs/1609.09562
The above states in the abstract that it contains a proof that $NP = PSPACE$
Since $NP \subseteq PH \subseteq PSPACE$, that would mean that $PH$ collapses, right? Well, the paper makes no mention of this and this seems pretty significant because "if $\mat... |
I have a long string that contains data formatted in the following way:
var str = "parent /n /t child /n /t child /n /t /t grandchild /n parent";
If you print this out you get a tree structure like directories. I am trying to figure out a way/algorithm to individually extract every parent and child and children of the... |
If I want to read any websites and get some information as names (or dates) on some part of the site as a human. What solution I could use in order to get these datas using deep learning or machine learning?. Is it possible?.. it is not necessary artificial inteligence? .... or maybe it might be as a part of a Phd thes... |
I have a question about rounding error. I have created a function to approximate exp(x) by summing the terms of its taylor series until the sum stops changing. (That is, 1 + x + x^2/2! ...).
This function works well for seemingly any positive value of x that i have tried, but when i try for instance -30, it does not ... |
I have the following problem.
Let $\Phi$ be an admissible numbering of the single-parameter partially-recursive functions. That is, $\Phi(i, x) = f_i(x)$ with $f_i$ the $i$th partially-recusive function with one parameter. Denote with $f(x)\!\uparrow$ that $f(x)$ is undefined in the sense that its computation does not... |
How would I go about solving this?
|
In Language with $\log \log n$ space complexity?, the following non-regular language is described:
$$L = \{b(0) \# b(1) \# \dots \# b(2^k-1) \mid k\in \mathbb{N}\}$$
where $b(i)$ is the $k$-bit binary representation of $i$. This can evidently be computed in $\log \log n$ space, where $n$ is the length of the string, us... |
I'm plenty familiar with the Halting Problem for Turing Machines. It occurred to me after reading several posts on this site that it would be interesting, educational and useful to start a list of equivalents to the Halting Problem in terms of Computer Security. I think this might help students of computer science and ... |
I have a complete undirected graph with $V$ vertices and $\frac{V(V - 1)}{2}$ edges. Then, I remove $K$ edges $(a_i, b_i)$. I want to know if the graph is still connected after performing all the operations (so I want to delete those edges and then answer the question). Is there any faster way to do this than performin... |
Recently, I am reading the book [1]. I am trying to solve the following problem:
1.3 Proving Euler's claim. Euler didn't actually prove that having vertices with even degree is sufficient for a connected graph to be Eulerian--he simply stated that it is obvious. This lack of rigor was common among 18th century mathema... |
We want to compute the clustering coefficient $C$ for an undirected graph $G = (V, E)$.
The clustering coefficient $C$ for a graph $G$ is the average over all local clustering coefficients $C_i$, whereby $C_i$ is the local clustering coefficient of a vertex $v_i$ such that $i$ is a generic index and $v_i$ is a member o... |
I have a connected undirected graph with V vertices and V(V - 1)/2 edges. Then, I remove K edges (a[i], b[i]). I want to know if the graph is still connected after performing all the operations (so I want to delete those edges and then answer the question). Is there any faster way to do this than performing BFS/DFS alg... |
There's a famous and elegant reduction from the maximum bipartite matching problem to the max-flow problem: we create a network with a source node $s$, a terminal node $t$, and one node for each item to be matched, then add appropriate edges.
There's certainly a way to reduce maximum flow to maximum bipartite matching ... |
I have a set $S$ of pairs $(x_1,x_2)$ with $x_1,x_2 \in X$ for some set $X$.
I want to know whether this defines a total relation on $X$. In other words, whether:
If $(a,b)$ in $S$ and $(b,c)$ in $S$, then $(a,c)$ in $S$. (transitivity)
Exactly one of $(a,b)$ and $(b,a)$ is in $S$ unless $a=b$, in which case they are... |
Assume, an extension of the lambda calculus with terms $t$ and values $v$ is defined in big-step operational semantics with evaluation relation $t \Downarrow v$.
It is intuitive to assume that $\beta$-equivalence holds, e.g.
(λx. t) unit $\equiv_\beta$ t when x is not free in t
It is however unclear to me, how $\equiv... |
I've got a real-world issue that I'm trying to come up with a dynamic programming algorithm to solve. It's similar in appearance to the knapsack problem, but it has more constraints, which has got me stumped. A simplified version of the problem:
Suppose I need to fill a basket with an arbitrary number of items c. The i... |
Is A mapping reducible to B if B = A?
Let's say A is undecidable but Turing-recognizable and also Turing reducible to its complement.
|
I was trying to understand the Wikipedia proof for NP-completeness of subgraph isomorphism by reduction from the clique problem. It's really just one sentence:
Let $H$ be the complete graph $K_k$; then, the answer to the subgraph isomorphism problem for $G$ and $H$ is equal to the answer to the clique problem for $G$ ... |
In discrete math, I have read that lattice is a generalized form of boolean lattice. But those places where boolean algebra is mentioned, they don't tell about lattices (digital logic, binary,...). Whether the meet and join is same as and and or in boolean logic? If we are thinking in terms of lattices how you define 1... |
I'm having trouble proving, or understanding why a two-head one-way finite memory machine could accept a non-regular language– for instance, $(w \mid w \in (a,b)^{*}, w= a^i b^i, i\geq 0)$.
For clarity, a two-head one-way finite memory machine works as follows – it has a finite control and a read-only input tap... |
I am trying to solve n-queen puzzle with an additional stronger condition that no 3 queens can be on the same line.
Right now my algorithm is,
Generate a random permutation of [1..n].
Store "swaps" as "moves" such that it reduces number of conflicts.
Pick a "move" with non-uniform distribution on number of reduced con... |
Is there a difference between an execution model and a computation model? Or the two terms refers to the same things?
Thanks in advance.
|
Consider the regular expression $(a^*b^*)^*$
Does this mean that there are zero or more occurences of the term $(a^*b^*)$ before the term is expanded or that there are zero of more occurences of the term $(a^*b^*)$ after the term itself has been expanded?
Here is an example of what I'm try to say
zero or more occurence... |
I'm trying to learn how communication works in a butterfly network.
The following is a butterfly network of order 3. I'm given the following description:
Each processor is connected to an output switch in rank 0 and to an input switch in rank k (in this case 3). In other words the switch in column j and rank 0 gets i... |
What's the complexity of the above? It's part of a larger problem where the (1/2) comes from the probability of that happenening, so the worst case is:
T(n) = T(n/2) + c
but the average case is:
T(n) = (1/2)T(n/2) + (1/2)c
Our professor told us that the answer to the worst case is O(n), and that the average case is O(n... |
Here is insertion sort:
for i = 1 to length(A)
x = A[i]
j = i - 1
while j >= 0 and A[j] > x
A[j+1] = A[j]
j = j-1
end while
A[j+1] = x
end for
My lecture notes say that the total number of basic computation steps is about
$$T = 1 + ( 5 + t_1 \times 3 ) + \dots + ( 5 + t_{n-1} \times... |
I've been working on finding a regular expression for the following language for quite some time now ($\Sigma =\text{{0, 1}}$):
$
\text{L = {w | the difference between the number of 0's and 1's in each prefix of the word is less than or equal to 1}}$
I haven't been able to find an expression for this particular langu... |
HSV colors are composed of a triple of numbers: hue $\in [0, 360)$ (in degrees), saturation $\in [0, 1]$ and value or brightness $\in [0, 1]$. RGB colors instead are more well-known and are also composed of a triple of numbers all of them in the range $[0, 1]$ or in a byte $[0, 255]$.
I was trying to implement an algor... |
So as learned every DFA is an NFA. I feel like I understand DFA much better than NFA, so I try to convert my regular expressions to DFA, but I want to understand both sides.
For example a|b (a Union b):
However, are we losing anything if we eliminate the epsilon from these expressions, every DFA is an NFA right so wh... |
We can simulate the PDA and parse the language with the following operations (vaguely):
Read the input symbol and top of stack - $O(1)$
Check all the transition rules (must check all for non-determinism) - $O(|Transition rules|)$
Update the stack and the set of states - $O(1)$
Due to non-determinism, the problem si... |
Say you are a program, and you are given some source code but you don't know in what language, it can be C++/Java/Python/Lisp/... all you know is that it is highly structured and LR(1) parse-able, and you want to make some guesses on the corresponding syntactic tree.
How would you try to achieve this, and would you hav... |
I would like to discuss an algorithm to build a "hand" calculation for riichi mahjong game.
I will simplify terms to focus on the algorithm and not on the game specific terms.
Let's imagine that we have a card deck with three suits. Each suit contains cards from 1 to 9 and each card has four copies.
So card deck looks... |
I have a CFG:
S -> $T$
T -> T+T|T-T|T/T|(T)|CX|I
X -> XX |C|N|_|@
C -> a|b|c|....|z|A|B|C|...|Z|_
N -> 0|1|2|....|9
I -> NI|N
Here @ means epsilon.
The above is a valid arithmetic expression in C++.
I have to convert this to a deterministic PDA (does not read @). I do know there exists an algorithm to convert it to NPD... |
I have an algorithm that supposedly solves the matrix chain multiplication problem in $O(n^2)$ time. I have tested it only on trivial cases and they turned out to be correct.
By no means, am I a genius, but I was wondering if you guys could point out where this algorithm lacks.
The algorithm:
Base case:
MCM(A) = 0... |
I need to calculate the edit distance between many pairs of binary trees. Unfortunately this is computationally expensive.
The trees are stored as a flattened list of indices into node and terminal lookup tables. The particular flattening structure is the pre-order encoding format (pseudo code: flat(tree) = [id(root)] ... |
is there any unambiguous grammar on alphabet={a,b} that can produce strings which have equal number of a and b (e.g. "aabb" , "baba" , "abba") ?
|
I have been trying to learn more about amortized analysis. Recently I came across the Disjoint Sets or Union-Find structures. I am using union by rank and path comparison. The potential of such data structures is sum of $\phi(x)$ for all nodes where
$$\phi(x) = \begin{cases}
0, & \text{if }\mathrm{rank}(x)=0 \\
\alp... |
I have a quick question on implementing the Bhandari algorithm. I do not have the textbook where the algorithm is originally given (Bhandari, Ramesh (1999). Survivable networks: algorithms for diverse routing), and the online resources I've found are a little ambiguous on this point...
Say I want to obtain k disjoint ... |
When a computer stores a variable, when a program needs to get the variable's value, how does the computer know where to look in memory for that variable's value?
|
In Pascal For-do loops, there is a rule stating that one cannot modify the counter variable inside the body of the loop.
To exemplify the rule, take the following Pascal for-do, which is not valid, since the counter variable is being modified inside the loop's body:
for i := 0 to 10 do i := i + 1;
My question is: Is ... |
So I'm almost done teaching myself category theory. One of the main take-aways for me is that type constructors (higher-kinded types) are endo-functors.
But it this always the case? What's throwing me off is Haskell's Functor typeclass:
class Functor f :: * -> * where
fmap :: (a -> b) -> (f a -> f b)
If all type co... |
If we have an union-find(disjoint-set) data structure and we are doing an union by rank and path compression for a find operation, how would the depth and height of every node change after the find operation?
I am trying to find the amortized cost of the find operation using the potential function:
$$phi(x) = \sum_{x} ... |
I need to prove the following language is not regular, I think I need to use the pumping lemma. The trouble I am having is that there is multiple variables and I am not used to that.
Could someone tell me if the pumping lemma is the correct proof by contradiction of
$$L = \{a^iba^j|i\ge2j\ge0\}$$
I took $xyz = a^{2p+1... |
Given a string, how to get the its prefix similarity? I use an example to explain what I mean by string prefix similarity. Say, s = "ababaa". We take all its suffixes, that is, "ababaa", "babaa", "abaa", "baa", "aa", "a". Then we count their common prefix length with original string. In this case, it is 6 + 0 + 3 + 0 +... |
let's say that I have:
M - Main point - given by coordinates (lat, long)
C - Collection of points - also given by coordinates (lat, long)
R - Radius - maximum search distance
I'm trying to find all points that are within a radius from main point (neighbors).
algorithm(main_point, collection_of_points, radius) --> ne... |
Recently, I am reading the Fleury's Algorithm part of the document [1]. There is a sentence on page 3 of this document:
Note that, when the algorithm terminates, we must return to $v_{start}$ because every vertex has an even degree.
I don't understand why we must return to $v_{start}$. Could anyone please teach me?
... |
I'm going to try to design an algorithm to find all the rational roots of a polynomial equation in range [a, b]. Can someone please tell me which algorithm currently solves the problem with lowest worst-case complexity? This algorithm will be for a general purpose computer(Turing Machine).
|
What is the optimal way to cut B chocolate bars to share equally between N people?
Here is an example of different cuts for B = 5 chocolate bars and N = 6 people.
Strategy 1: cut each chocolate bar in 6 equal parts and, then, give 5 parts for each person. Number of cuts: 5 x 5 = 25.
Strategy 2: cut 3 bars in 2 equal p... |
I am writing a compiler for a simple subset of standard ML (just for fun) and I am stuck on how to represent the core language (I should mention that I write it in Haskell probably).
Basically what I have already is an expression type that looks like the following:
data Expr' e
= Let Name e e
| Fn Name e
| Val Va... |
I need to define the data-flow analysis equations to determine the value dependencies of an statement.
For example:
a = 9
b = a + 7
c = b * 2
the value of c depends on the value of a.
I'm sure this is a well known problem in data flow analysis, can any one point to the equations solving this? Static Single Assignment... |
On the A taste of linear logic paper, the author claims that:
A rule consists of zero or more judgements written above a line, and one
judgement written below. If all the judgements above the line are derivable, then the judgement below is derivable also.
He then proceeds to show the following rules:
He then descr... |
Before the Question:
Greene, Parnas and Yao presented a scheme which, for binary data chosen uniformily a random,
retrieves all points within Hamming distance r of a given point in time $O(d n^{r/d})$ using $O(d n^{1+r/d})$.
The scheme is based on Turán's graph and the complete description can be found
here.
I was r... |
I'm studying for an algorithms exam and came upon the problem :
for (i = 0; i < n * n; i++) {
i++;
for (j = 0; j < (log(n) * log(n) * log(n)); j++) {
j++;
}
}
I figure that line 1 costs $ c_1(n^2) $, line 2 costs $ c_2(n^2 - 1) $, line 3 costs $ \sum_{j=0}^{n^2} \log(j)^3 $,... |
I found a problem in the dynamic programming section of hackerrank but its not clear why dynamic programming should be used to solve it. The problem is as follows:
Nikita just came up with a new array game. The rules are as follows:
Initially, there is an array, , containing integers.
In each move, Nikita must pa... |
Circuit complexity has connections to many questions in complexity theory.
For a couple examples, Ryan Williams shared some in a recent talk and Section 3 of these notes gives simple relations to $\mathbf{P}$ vs. $\mathbf{NP}$ and $\mathbf{P}$ vs. $\mathbf{BPP}$.
More can be found in the textbook Boolean Function Compl... |
Recently, I was asked to design an algorithm that counts the number of triangulations in a simple polygon without Steiner points. This is pretty simple to do in $O(n^3)$ time using dynamic programming, where $n$ is the number of vertices in the polygon. However, I would like to know if there is an $O(n^{3-\epsilon})$ a... |
If A is not mapping reducible to B then A is not mapping reducible to the complement of B?
Is this true?
|
Is there a proof for the lower bound of the problem to create a sorted list of sums for a given list of integers with length n.
In this [thread][1] people discuss solving this problem by sorting the list of integers first and then creating the sums. However none of the solutions seems to be faster than $O(n^2 \log n)$... |
Consider a simple language:
$$t ::= plus ~ t ~ t ~ | ~ gen ~ t ~ | ~ except ~ N ~ t ~ | ~ N$$
with N constructors plus, gen and except, N being the natural numbers, and $G = \{t_n\}$ a finite, ordered set of terms.
These terms can be evaluated using a small step operational semantics:
$$\frac{G ~ \vdash ~ t_1 \rightarr... |
The classical 0,1 knapsack problem with weights $w$ and unit value for all items $x$:
$
max \displaystyle\sum_{i} x_i, x_i \in \{0,1\}
$
subject to
$
\displaystyle\sum_{i} w_ix_i \leq W
$
for a maximum weight $W$.
Recall that the weights in this version can be negative: we will simply select all items with zero or nega... |
I want to go RD parsing with Shunting Yard for expression (for the sake of easier operator precedences and less left-recusion), is that considered no-good because nobody did that before?
|
I need to describe an algorithm that finds a maximum matching in a given undirected and unweighted graph. The runtime needs to be linear and is a 2-approximation, that is, the matching size (number of edges) should differ from a maximum matching size not more than a factor of two.
The problem I have is coming up with a... |
In CLRS's Introduction to Algorithms,
The following procedure implements quicksort:
QUICKSORT(A; p; r)
1 if p < r
2 q D PARTITION(A; p; r)
3 QUICKSORT(A; p; q-1)
4 QUICKSORT(A; q+1; r)
To sort an entire array A, the initial call is QUICKSORT(A; 1;
A.length). The key to the algorithm is the PARTITION procedure,
... |
The question is to design a DFA that accepts a language in which the count of substring "$110$" is no less than the count of substring "$011$". For example, $110$, "0101", "0111101110" is good but "011011" is bad.
The restriction of the language equivalently means whenever a "011" is encountered, only this pattern "$0... |
I'm reading that 'Prewitt' filter is high-pass filter, which means that it can sharpening the image (via edge highlight).
But I'm not sure to implement the sharpening process (not just edge detection) to the original image in this case.
So I mimic Laplacian process :
x-direction 1st order derivate is define as :
f(x+1... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.