instruction stringlengths 35 29.1k |
|---|
Say I have a very large, arbitrary number of variables, each of which I can assign to be type A, B, or C.
The types come with expenses: Type A's are the least expensive, and C's are the most expensive, but their expense varies from variable to variable.
For example {A, C, C} may actually be more expensive than {C, A, A... |
We are given a bipartite graph of $n \leq 200$ vertices in both the first and the second partite set. Let $U$ be some set of vertices in the first set, and $V$ those vertices from the second that are conected to some of the vertices from $U$. If for every choice of $U$ we have $|U| \leq |V|$ (Hall's condition) then the... |
It seems to me that when the outermost|toplevel function is itself an expression to be evaluated (i.e.: a higher-order function returning the function to be applied at top-level), then normal-order evaluation "gets stuck".
For example $(\lambda x . (\lambda y . (y^x)) 2) (5+1)$ is such that I have to evaluate $\lambda ... |
I asked two questions about NP-hard problems here Relationship between an NP-hard problems with the subsets of them? and here https://cs.stackexchange.com/questions/30018/does-this-manner-of-proof-for-being-np-hard-is-true but unfortunately maybe I could not describe my question clearly. Therefore here I will do it.
As... |
I've got a System, which is defined as follows:
A limited number of stations is given (n), which can offer different services (for now there are two services). A station can either offer one of the services or both (maybe it will be extended one day, then it should work with x different services and a station can offe... |
Find the approximate number of messages (n) that need to be tried
before finding two that had the same message digest (size k) with probability 0.8.
You need to find n as a function of k . What is n when k= 2^(160) ?
please guide me how to start to solve this question
|
One way of looking at regular expressions is as a constructive proof of the following fact: it's possible to construct the regular languages by starting with a small set of languages and combining them via a small, fixed set of closure properties. Specifically, if we start with the empty language, the language containi... |
I would like to find out how to prove this statement. Thank you.
Well I think that I proved one part of the statement, but my proof doesn't really look elegant.
My proof of $(L\cup M)^* \subset (L^*M^*)^*\!$.
We know that $\epsilon, L \in L^*$ and $\epsilon, M \in M^*\!$. Hence $L \subset L^*M^*$ and $M \subset L^*M^*... |
With the recurrence relation:
$$ T(n) = 2T\left(\frac{n}{2}\right) + \frac{n}{\log(n)}$$
The "sum for all levels" in the recurrence tree is:
$$ \sum_{i=0}^{\log n -1} \frac{n}{\log n - i} = \sum_{i=1}^{\log n} \frac{n}{i} = n \sum_{i=1}^{\log n} \frac{1}{i}$$
Inside the analysis of the recurrence, $\sum 1/i$ appe... |
Let us say for instance I am doing string processing that requires some analysis of two strings. I have no given information about what their lengths might end up being, so they come from two distinct families. Would it be acceptable to call the complexity of an algorithm $O(n * m)$ or $O(n + m)$ (depending on if we us... |
Pruned fast Fourier transforms compute only a specified subset of the result indices in faster time, although sometimes with a slower implementation constant (because FFT is generally so optimized). They can also exploit sparsity in the input vector to further accelerate computation.
On http://www.fftw.org/pruned.html... |
Wikipedia says that weakening is a structural rule where the hypotheses or conclusion of a sequent may be extended with additional members and that contraction is a rule where two equal (or unifiable) members on the same side of a sequent may be replaced by a single member (or common instance). However, I can't seem to... |
How are Signed integers different from unsigned integers once compiled?
I already know about twos compliment and the like but my question is how can you tell the difference when looking at 8 bit integers when in binary eg 10000001 if this is a signed integer it would be equal to -127 but if it is unsigned it would be e... |
I'd like to know the name and the algorithm for the following problem which I'm guessing is a classic, but is slightly different from graph connectivity.
Consider a undirected graph G=(V,E). What is the minimum number of vertices which removal (vertices and their adjacent edges) makes the resulting sub-graph empty of ... |
The ABD algorithm in paper: Sharing Memory Robustly in Message-Passing Systems can emulate single-writer multi-reader atomic registers in message-passing systems, in the presence of processor or link failures.
Looking into the details of this algorithm (in Figure 2, page 133), I found that it implicitly assumes the "c... |
I'm implementing the algorithm presented in "Improved Parameterized Upper Bounds for Vertex Cover" paper (PDF).
I'm a bit stumped by the General-Fold procedure.
What it should do is reduce the number of vertices (and) edges in the graph by finding specific structures (almost-crowns) and replacing them with a single ver... |
Does there exist a simple approximation to the minimum vertex cover problem that aims to find a smaller (or equal) set to the minimum?
Usual algorithms seems to aim to find an approximation such that the output is a cover, but may have more vertices than the minimum cover. Instead, I want a smaller set - I don't mind i... |
An array $\mathcal{A}$ of $n$ distinct integers $\{a_1,a_2,\ldots,a_n\}$ is given. I'm asked to design a randomized (esp. Las Vegas) algorithm to make a Binary Search Tree out of these elements, such that the height of the tree is $\lceil \log{_{2-\epsilon}n}\rceil$, where $\epsilon=\frac{2}{9}$.
If we had to make a pe... |
I'm having trouble showing how to solve this problem in particular the part where it asks "To Show that the following pseudo-code fragment finds the value of the polynomial..."
How do I exactly show that? I don't understand what that would entail and my professor isn't exactly that helpful he says to prove it for all ... |
Given a polynomially computable continuous function which is a composite of m strictly monotone functions, can we guarantee the existence of polynomially computable inverse?
The function I have in mind is a rational function and all the coefficients (in the numerator and denominator) are positive integers but are unkn... |
You have $n$ sticks of arbitrary lengths, not necessarily integral.
By cutting some sticks (one cut cuts one stick, but we can cut as often as we want), you want to get $k<n$ sticks such that:
All these $k$ sticks have the same length;
All $k$ sticks are at least as long as all other sticks.
Note that we obtain $n + ... |
I am really struggling with determining the decidability of languages and cant figure out whether this problem is decidable or not.
I have a language
$\qquad\displaystyle
L = \{ (R(M_1), R(M_2)) \mid L(M_1) \cap L(M_2) = \emptyset \}$,
where $R(M_1)$ and $R(M_2)$ are representations of Turing machines $M_1$, resp $... |
Consider a four stage pipeline, and each stage has delays D1, D2, D3 and D4, so the total delay because of the various stages should be N * (D1 + D2 + D3 + D4) where N is the number of instructions, but I see that this is not the case, I see here that the delay is calculated as N*max(D1,D2,D3,D4) , why is only the max ... |
Let
$$
PAL = \lbrace x \in \lbrace 0, 1, \# \rbrace^* | x = rev(x) \rbrace
$$
How do I show that a turing machine deciding $PAL$ must use space $\Omega(\log n)$?
I have a feeling that I need to use crossing sequences when crossing the middle of the input tape, but I'm not sure how to relate that to space.
|
I'm working with graphs of a very large size (> 60k vertices), and want to speed up B.C. measurements. It is defined here: http://en.wikipedia.org/wiki/Betweenness_centrality The algorithm that I am using to compute B.C. is Brandes' algorithm: http://www.inf.uni-konstanz.de/algo/publications/b-fabc-01.pdf
For undirecte... |
The Chomsky-Schutzenberger representation theorem states that a language $L$ is context-free iff there is a homomorphism $h$, a regular language $R$, and a paired alphabet $\Sigma = T \cup \overline{T}$ such that $L = h(D_\Sigma \cap R)$, where $D_\Sigma$ is the Dyck language over $\Sigma$. This is a necessary and suff... |
Somewhere on Internet I read : Whenever word size is greater than memory cell size, then there is a need for accessing multiple memory cell
Example:
for 16 bit processor:
MOV AX [2000]
To transfer memory content, we need to transfer 16 bit data , so we need to access 2 memory cells
M[2000 H]
&
M[2001 H]
But I didnt ge... |
I have a table that contains only bits. I would like to be able to do the following two queries:
SET any bit to 0 or 1;
GET the number of bits that are set to 1 from the beginning of the table up to a specifique index i.
Is there a data structure that is more efficient than a binary indexed tree, i.e. a Fenwick tree?... |
I have for example 10 planes with their equation: Ax + By + Cz = D and a list of 3D points.
Those plane can make regions, some of them closed, and others not, the task is to count the number of points in each region.
I just need some ideas about how to solve, or if there is an algorithm for that.
|
I'm familiar with the Steinhaus–Johnson–Trotter algorithm, which allows for the iterative yielding of permutations of a sequence by performing a single swap per iteration. It has the behavior, however, that it tends to swap elements further along the sequence early in the iteration. For 4 elements, my understanding i... |
I have a weighted digraph graph $G = (V,E)$ where the weights are positive and negative integers. The graph $G$ is not necessarily acyclic.
The question is: given 2 nodes $v_1$ and $v_2$, is there a path from $v_1$ to $v_2$ with a weight $w$.
I would like to know if there are any known complexity results for this prob... |
For the following two instruction
[Note: MOV Destination, Source ]
i1 : MOV R1, R2
i2 : ADD R2, R3
Since i1 is reading from R2 and i2 is writing to R2 there is a WAR data dependency and by register renaming like below we can remove this hazard
i1 : MOV R1, R2
i2 : ADD R4, R3
What are the other possible situations wh... |
The problem of deciding whether an input is a palindrome or not has been proved to require $\Omega(\log n)$ space on a Turing machine. However, even storing the input takes space $n$ so doesn't that mean that all Turing machines require space $\Omega(n)$?
Of course, there's no contradiction here, since any function tha... |
Here is the regular expression I made for it
This is my first answer, used the naive method aka don't know what am doin' method.
$$
\epsilon \cup a^* \cup (a^*b) \left((a| b^*a) | \left( (a|(b^*a))ba^*\right) \right) ^*
$$
this is my re-worked answer, with the state removal method.
$$
\left( a^* \cup (b)(a \cup bb^*a)... |
I'm trying to understand CTL formulae, and until now I've understood everything (or at least I thought I did). I have the following Kripke strucure:
Now given the following CTL formulae A(g U EG (b v y)) , which states does it satisfy?
I know that the answer is {s1,s2,s3} (according to lecture notes), but I don't unde... |
I started with POS: (a+b+c)(a+b'+c)(a'+b+c)(a'+b+c')
and after a long while, I got: ab+ac'+a'b'+a'c+b'c'+bc
and then I'm not sure how to simplify this. I thought maybe I can cancel the ab with a'b', and b'c' with bc and end with ac'+a'c but it doesn't seem to be right if I look at the truth table...
|
I'm trying to compare two functions, such as f(n)=n^n and g(n)=n^10^10. I'm unsure if f(n) is O(g(n)) or vise-vera where g(n) is O(f(n)). From my understanding, n^n can be worse than n! and although g(n) is being raised to a large constant, it can be bounded by f(n) if multiplied by a certain constant. I am new to this... |
Suppose we have a polynomial time algorithm for computing a function (we think of as existing on rational numbers between $0$ and $1$ of limited binary length n). We know that this function is made up of $m$ strictly monotone functions or equivalently that it has up to $m-1$ maxima/minima. Can we find these maxima in t... |
I was wondering if finding if a graph has k or more isolated nodes is a NP-Complete problem. I found the following problem:
Prove that the following problem is NP-Complete. Given a set of T
transactions: $T = \{t_1,t_2,\dots,t_m\}$ where each transaction $t_i$ is a
pair of banks $(b_{i1},b_{i2})$. Find if, given ... |
I understand that for something like Linear search, this would be the key comparison:
if(itemToFind == a[i])
return i;
If I put this method into another method, say a Sorting method, do I still count the linear key comparison plus the sorting key comparison? Or do I only care about the sorting key comparison?
Exa... |
$f_1$, $f_2$, $g_1$, and $g_2$ are functions such that:
$$f_1 = \Theta(f_2)$$
$$g_1 = \Theta(g_2)$$
I was able to prove that:
$$\frac{f_1}{g_1} = \Theta\biggl(\frac{f_2}{g_2}\biggr)$$
But I can't understand why the following statment is not necessarily true:
$$f_1 - g_1 = \Theta(f_2 - g_2)$$
|
I was fooling around the other day on this website: http://regexcrossword.com/ and it got me wondering what the best way to solve it was.
Can you solve the following problem in polynomial time or is it NP-hard?
Given an NxM grid with N regular expressions for the columns and M for the rows, find any solution to the gr... |
Let's say we have the following grammar
expr1 ::= ... // Actual definition doesn't matter
expr2 ::= ... //
expr3 ;:= ... //
foo ::= expr1 | expr2 | expr3
When it comes to parsing foo we note that foo could be parsed in parallel.
p1 = task parse( expr1 )
p2 = task parse( expr2 )
p3 = task parse( expr3 )
Question
W... |
I don't quite understand the concept of spatial locality in cacheing. I understand that on a cache miss, not only the specific address we want is loaded into the cache, but also "nearby addresses" are loaded too.
However, I can't understand WHICH addresses are loaded. I have an assignment with the following question:
T... |
I was creating an example for a casual talk on mutual information. I considered a system of two coins, which with probability 1/2 are copies of each other, and with probability 1/2 are independent.
Then $P(A=B)=1/2+1/2\times 1/2=3/4$, so $P(HH)=P(TT)=3/8$ and $P(HT)=P(TH)=1/8$.
Total information is then $E(-\log_2 p) =... |
I am trying to generate a graph (the structure with edges and nodes), that as a structure like an Order-7 triangular tiling of specified diameter around a central node.
http://en.wikipedia.org/wiki/Order-7_triangular_tiling
!http://en.wikipedia.org/wiki/Order-7_triangular_tiling#mediaviewer/File:H2_tiling_237-4.png
In ... |
I'm just starting my second year in computer science and one of my classes briefly touched upon deterministic vs. non-deterministic algorithms. This got me thinking - is there any use for algorithms which return deterministic output for certain inputs, but non-deterministic output for other inputs? Say, something along... |
There's a class of data structures where you preprocess some other data structure in order to answer queries about it more efficiently.
That includes trivial things like sorting/hashing, less trivial things like quad trees, and includes far less trivial things such as dominator trees, interval decompositions of DAGs or... |
We define the language
$$
L = \{a^nb^n : n\geq0 \}
$$
and we want to prove the following
$$
L = \mathrm{DSPACE}(\log n)\,.
$$
So we have to prove that by using $\log n$ space on the work tape of a Turing machine we can decide this language.
In this case, do we have to describe the delta function in detail, or can we j... |
Is there any efficient algorithm to convert a given truth table of a Boolean function to its equivalent algebraic normal form (ANF)?
I have seen that Sage has one implementation (official documentation):
sage: from sage.crypto.boolean_function import BooleanFunction
sage: B = BooleanFunction("12fe342a")
sage: B.algeb... |
Languages such as $\text{HALT}_{TM}$ are $\textsf{RE-complete}$ under many-one reductions. It is trivial to see that $\text{co-RE}$ has complete problems, too. S. Schmitz [1] considers some classes inbetween $\text{ELEM}$ and $\text{REC}$. They present complete problems for these classes under specifically crafted red... |
How to I show that any language in NTIME(T(n)) can be accepted by a non-deterministic 2-tape O(T(n)) time-bounded Turing machine, with modifiable input tape?
I've seen the k to 2 tape reduction for deterministic Turing machines, which increase the running time by a logarithmic factor, but I'm not sure if I can modify t... |
I've been having trouble proving the next statement:
Let $L_n=\{ww, |w|=n\}$ (the set of equal-length palindromes (EPAL) restricted to length $2n$). Prove that $L^c_n$ can be accepted by an NFA with at most $O(n^2)$ states.
What I've been trying to do is that the complement of $L_n$ is
$\qquad\displaystyle L^c_n = \... |
The Turing model of computing is widely accepted, as a Tape, Head, State register, and a finite state Table to manage transitions. The Bulk Synchronous Parallel Machine model has for its part similarity to the PRAM model, but with additional features in state management, by communication, and synchronization. So, in a ... |
The word choice of "complexity" in analysis of algorithms to describe temporal and spatial resource requirements has always struct me as an odd one. These are certainly useful and meaningful concepts. This question is concerned with the language used to describe them.
Colloquially, one would probably not say that inser... |
Or in other words, find all $v \in V$ such that there exists a path $\forall w \in V$ $v \rightarrow w$ or $w \rightarrow v$. This is for a directed acyclic graph. I need to find an $O(|E| + |V|)$ algorithm for this.
I can see how to identify if a given vertex meets these traits (perform a BFS starting at that vertex,... |
The book I'm currently reading specifies that Dynamic Power = (1/2) * Capacitive Load * (V^2) * frequency However, that is assuming it's a single-core system. I wonder if we're calculating the Dynamic Power of a dual-core system, would that be twice the formula of Dynamic Power above ?
|
Suppose we work with some particular programming language (like C++) on some particular computer. Furthermore, we want to know which values are minimum and maximum for some particular numeric data type of this language. We can't use any specific tools of our language (like numeric_limits), and have no access to languag... |
I am reading the book Structured Computer Organization (5th edition) by Tanenbaum and at a certain point, in the second chapter, he talks about data path cycle and fetch-decode-execute cycle, and I am not understanding if they are really the same thing.
The data path cycle should be the number of small and minimal step... |
I understand the notion of crossing sequences when talking about time, however how are they used to actually prove strict lower bounds for some decision/search problems?
For example, suppose that you have an array of size N and you want to find the maximum number in it.
Speaking informally, we need at least a pointer t... |
I'm still fighting with the aforementioned paper "Improved upper bounds for vertex cover" by Chen, Kanj, Xia (PDF kindly provided by Yuval Filmus).
My current problem is that it's specified that the main vertex cover algorithm VC (page 7/21) has the following header VC(G, T, k), where G is the graph to process, T is a ... |
Assume that the nodes know that the topology G is either a hypercube or a
tree. Assuming a unique initiator, design an algorithm to discover the topology. In other words, you would like a node to reach terminal state TREE if G is a tree, terminal state HYPERCUBE if instead it is a hypercube. Let n be the number of node... |
Prove that any binary tree with $n$ nodes has at least $1+\log_2 n$ levels.
I tried setting $n=8$ and plugging in $8\geq\log_2 8 = 8\geq 3$. But I'm not sure how I can prove this by induction.
|
Is the cardinality of the set of partially recursive functions greater than the cardinality of the set of recursive functions ?
|
I recently came across the concept of "forwarding pointer" and have not been able to find sources of a precise definition. In my case this was mentioned and briefly (but poorly) explained during a discussion on distributed systems.
Could you elaborate on the concept, its usual context(s) and possible other names by whi... |
Could anyone tell me from where could I get the c compiler source code.In particular the lexical analyzer for c.I searched the web but no links show how a compiler is defined.
|
My big question is the following: What is the meaning of a computation being "effectively computable" (EC) in theory and in practice?
In trying to understand these concepts further, I have a couple of sub-questions as well:
Is there a relationship between a computation being EC in theory and being EC in practice? (It... |
Nick's Class (NC) is the class of problems that can be decided in poly-log time using a polynomial number of processors.
I want to know about the exponential analogue, which would cover problems that can be decided in polynomial time using an exponential number of processors.
What I'm looking for is a name for this cla... |
We have a string $s$ containing $n \leq 100$ bits. The move we can make on it is erasing from $s$ some substring $x$, but only if $x$ is directly preceded by $x^R$, where $x^R$ means string $x$ reversed. In other words, we're choosing some even-length palindrome and erasing it's "right half".
The goal is to minimize th... |
show whether $n2^n = 2^{O(n)}$ is true or not.
In my opinion, it's false because O(n) can be n and thus the equality will be wrong, because $n2^n$ grows much faster than $2^n$
|
L = { a^n b^2n a^(n+2) : n>=1 }
So I'm trying to construct the grammar and I'm getting stuck.Some example strings would be these (spaced out to help demonstrate the patterns):
a bb aaa
aa bbbb aaaa
aaa bbbbbb aaaaa
This is what I have so far....
S -> aXbbXaaa
XbbX -> bXbbXb
The first rule says that there will always be... |
Minimize $\sum^n_{i=1} c_i x_i$ subject to $\sum^n_{i=1} a_i x_i = b$ (a single constraint), $x_i \ge 0$.
Derive a simple test for feasibility of this problem
Assuming the optimal cost is finite, develop a simple method for obtaining an optimal solution directly.
For the first part, I have $\sum^n_{i=1} a_i x_i ... |
I am practising problems on Regular Languages and I came across this question:
Prove that the language $$\{a^m b^n : m ≥ 0, n ≥ 0, m \ne n\}$$ is not
regular. (Using the pumping lemma for this one is a bit tricky. You
can avoid using the pumping lemma by combining results about the
closure under regular operatio... |
This Wikipedia table (template for "Formal languages and grammars") maps grammar to language to abstract machine for more than a dozen languages.
http://en.wikipedia.org/wiki/Template:Formal_languages_and_grammars
But I miss another relation: Lambda calculus (that can be described syntactically as a certain context fre... |
I want to:
Simplify a set of points that outlines a closed opaque image on a transparent background.
The simplified set of points should not intrude into the closed opaque image.
I use a Marching Squares Algorithm to fetch a set of points (x,y) that outlines the opaque pixels of an image. This gives a valid set of... |
I'm taking an algorithms course in which we are discussing proofs that problems are NP-Complete.
Our proofs usually take the form:
Given a problem $\Pi$,
1. Prove that $\Pi$ is NP.
2. Select an NP-C problem $\Pi'$.
3. Find a transformation $\propto$ from $\Pi'$ to $\Pi$.
4. Prove that $\propto$ is polynomial.
5. P... |
In my Operating Systems class, our professor asked us to solve the critical section problem with the following atomic operation:
int sub(int &x, int val){
x -= val;
return x;
}
The homework was already due and nobody in my class could come up with a solution. The professor's solution does not even work. Here it is... |
Can anyone explain, how Distributed Snapshot algorithms ( Example: Chandy-Lamport are implemented in the context of modern distributed systems?
Can you name an open source System implementation which uses this / these class of algorithm?
How does this theory really translate to real world?
|
Locks are usually implemented thru test-and-set and swap machine-level instructions. Are there other implementations that do not use these?
Also, can we say that all hardware level solutions to the critical section problem can be categorized into just three, namely, interrupt disabling, test-and-set and swap?
|
I have a binary tree, the node has two subtrees, every node except the the leaves, has 2 children and all the leaves are at the same level.
I want to know the worst and best case complexities when I applied centralized ranking to this type of tree. (defined above)
For the worst case, O(n^2) happens when the tree is ch... |
I was following the text book by David Mackay: information theory inference and learning algorithms, this could be found online on his website.
I have question on the source coding theorem (emphasis mine):
Shannon's source coding theorem (p81): $N$ i.i.d. random variables each with entropy $H(x)$ can be compressed int... |
Definition of $k$-sorted array: An array in which an element is at-most $k$ places away from its sorted order.
I have a question in my Algorithms assignment which asks to prove the lower bound to sort a $k$-sorted array as $\Omega(n\log{k})$. I was trying to approach this question by using the standard comparison sort ... |
Yes this is a homework problem, but I only need help setting it up, there are 7 parts to the question once I set it up:
We want to build a function Y = 2X + 3 where X denotes a 3-bit
unsigned value(x2x1x0) and Y = y4..y0 is a 5-bit value in hardware.
Contruct its truth table where input bits are x2, x1, and x0 and... |
I am going through the following document trying to understand a simple grammar for a basic subtraction example (page 4).
The example states that
Simple arithmetic expressions of arbitrary length built from the subtraction operator '-' and the numerals 0 and 1 can be described by the following grammar:
E = T "-" E | T... |
My teacher today explained us this . Consider a network and suppose that at any stage during the application of the Edmonds Karp algorithm to find the max flow, let
f = value of flow in the network at this stage
t = value of the max flow in the residual graph of this flow
F* = max possible value of flow in the origi... |
In the course of my research (condensed matter physics stuff), I stumbled over the following concept:
The class of regular languages can be defined via finite state machines (FSM):
A language $L$ is regular iff there is an FSM which accepts $L$.
Clearly every finite language is regular.
I am interested in the followi... |
Been trying to get the intuition behind why two very similar recurrence relations don't follow a pattern I would expect. They are pretty well known relations:
Relation 1 -
$T(n) = 2T(\frac{n}{2}) + n$
Relation 2 -
$T(n) = 2T(\frac{n}{2}) + n^2$
When sketching out a tree for the first recurrence, the way I was taught ... |
There are various $\mathcal O(n \log n)$ or worse solutions, but I'm looking for one that runs in $\mathcal O(n)$, or a proof that none exist.
|
I know the rules of inferences and logical equivalence but I cannot seem to validate this argument. I rewrote the first premise as $\neg p\vee q$ other from that I am stuck. Any help will be appreciated.
$$
\begin{array}{c}
p \to q \\
(q \land r) \to s \\
r \\
p \\ \hline
s
\end{array}
$$
|
I came up with the following recursive algorithm to colour the nodes of an AVL tree so that the resulting tree is red-black. The logic is that the algorithm first colours the root and, recursively, the left and right subtrees black. Since it is an AVL tree, if the root has height h, one path to a leaf takes distance h,... |
I was wondering if this problem has a name:
Given a simple graph whose edges are colored red, blue and green, $G=(V,B\cup R\cup G)$, is there a vertex-coloring $c:V\to \{B,R,G\}$ such that every edge has an endpoint with the same color?
Also, is this known to be NP-complete?
This can also be viewed as a special case o... |
When we try to find the shortest path of a directed weighted graph using Dijkstra’s algorithm, is there a relation between the number of edges/vertices of the graph and the different implementations of minimum priority queue that help us find out the running time of the algorithm?
|
With the G-S algorithm solution to the stable marriage problem, the proposers get the best possible stable matches, while the reviewers get the worst possible stable matches. This is because the proposers keep walking down the list from their best preference downwards till the stable solution is found, while the review... |
Is there any exact formula for finding number of structurally different unlabeled trees can be formed with $n$ nodes? I searched a lot and I found some approximation formulas, e.g. here.
|
Here is an algorithm that generates the next permutation in lexicographic
order, changing the given permutation in-place:
Find the largest index k such that a[k] < a[k+1]. If no such index exists, exit (the permutation is the last permutation).
Find the largest index l such that a[k] < a[l].
Swap a[k] with a[l].
Rever... |
From a security level standpoint (such as Server, DataBase, Token Code, Authorization, Authentication, etc.) in regarding the Two Step Verification, usually Apple send a total of 4 digits security code vs Google send a total of 6 digits security code. What are the main differences?
|
In the ID3 algorithm for building a decision tree, you pick which attribute to branch off on by calculating the information gain. What happens if the calculated information gain is equal for two different attributes? Can you choose either attribute as the new branch?
|
I noticed certain programs have a feature that can have a 'snapshot' of a file from a certaim time and compare it to a more recent snapshot of the file. If one's system has a snapshot of a program when 'first' downloaded and it can compare this to the program 'as it is now' and if there are any changes this might ind... |
I have been reading the book Tata (Tree Automata Techniques and Applications), and there is a sentence I have read thousands of times, yet still don't quite understand.
In the beginning of Chapter 2, the authors want to show that regular string languages and regular tree languages have very much in common:
We shall ... |
I'm looking for examples of problem which has a lower bound of $\Omega(|x|^2$) for input $x$.
The problem needs to have the following properties:
$\Omega(n^2)$ runtime proof for any algorithm - first priority is to have as simple as possible lower bound argument.
$O(n^2)$ algorithm, if possible, simple one as well.
Ou... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.