instruction stringlengths 35 29.1k |
|---|
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... |
There are $n \leq 10^6$ kinds of cake layers, and for each kind we have a machine capable of baking it in one unit of time and nothing more. Now, a cake is a sequence of layers, more specificly a permutation of numbers $\{1,2,...,n\}$, and before doing one of layers in a cake all previous ones must have been done.
Give... |
I want to proof the P-Hardness of a language. Why is it enough to make a reduction-proof from an other, already P-Complete known language?
|
Is it true that a password consisting of the alphabet, even of common known names is much harder to find for a computer program than a short password, even though it uses numbers and other characters?
|
I have often read that Hindley-Milner extended to allow polymorphic recursion is undecidable. However is the term used what is actually meant? Or do people actually mean semidecidable when they mention that?
I ask this before I've recently found a paper where such a type system is presented and an algorithm based on th... |
Can we define a grammar for the following language?
$$L = \{a^n b^n c^{n+m} | n,m>=0\}\,.
$$
I can define one for this:
$$L=\{a^nb^n|n,m>=0\}
$$
S --> aSb | λ
or this one:
$$L=\{b^nc^{n+m}|n,m>=0\}
$$
S --> Ac
A --> bSc | Sc | λ
but I can't solve the first one, any hint?
|
More precisely: The input is set of $M$ sets (most likely stored sequentially on disk) that contain partitions of the set $\{1..N\}$. I want to efficiently (as far as memory and time complexity goes) represent this structure. Let's call this hypothetical structure $S$. I need the structure to support just a single func... |
Question: Given an $n$-bit natural number $N$, how to compute $\lceil \sqrt{N} \rceil$ using only $O(n)$ (bit) additions and shifts?
The tip is to use binary search. However, I could not achieve the required complexity (I got $O(n^2)$).
What does it mean by using only $O(n)$ (bit) additions and shifts:
This is an ex... |
Many years ago I read a GC survey paper that was updated every few years with advances; I tried to find such a paper today to point a questioner on Stackoverflow at.
However all I can find is very old survey papers that don’t include current thinking on items like hardware assistance.
|
For enumerating the minimal feedback vertex sets of a graph Schwikowski and Speckenmeyer show an algorithm "GENERATE-MFVS" in their publication "On enumerating all minimal solutions of feedback problems". It is said that it runs in polynomial time but uses exponential space in a dictionary.
insert F_q into Q and into D... |
I am currently bushing up on my data structures and basic algorithms, part of that is the Binary Tree.
I do understand the algorithms, and how to implement a binary search tree and such. I do so how smart it is that we can do lookups in O(log n) time.
I am however having a hard time finding an example of when I would u... |
I am trying to solve this particular problem from Automata Theory by Ullman, Hopcroft, it is as shown below:
Let $A$ be a $DFA$ and $a$ be a particular input symbol of $A$, such that for all states $q$ of $A$ we have $\delta(q,a)=q$.
Show that either $\left\{a\right\}^*\subseteq L(A)$ or $\left\{a\right\}^*\cap L(A)=\... |
I've seen two different concepts referred to by the term "function":
A small part of a program specified by the composition of constants and other functions as paramaters, such as the "functions" in Lisp
A set of tuples, as referred to in formal logic, which is not necessarily computable
The first concept is very fun... |
I understand the assumptions that have to be true about a property or set of properties in a Turing machine description for Rice's Theorem to apply.
But then what? If a set of Turing machines have an undecidable property, is the language itself necessarily undecidable? Or only if you can find a reduction from a known-... |
Let's consider the following problem (buckets/pails of water problem) (This problem may be known with different name. If does, please correct me).
Let $B=\{b_1,...,b_n\}$ be a set of $n$ buckets. Suppose each bucket has a maximum capacity $c_i \in \mathbb{Z}$. This also can be written as a maxium capacity function $f:... |
Can you explain to me how you get the Big O notation for the runtime of the following snippet of code?
for x = 1 to n
{
y = 1
while y < n
y = y + y
}
Can you explain the steps on how you get the big O notation for it? Also why doesn't it matter if there a bunch of statements inside a for loop when calcu... |
When I want to vocalize a hexadecimal number like 0x41, so I say "forty one in hexadecimal", "four, one in hex" or what? Or do you always have to calculate and say "65 in hexadecimal notation"? I feel like that would complicate communication if I just want to tell someone what numbers I see on the paper in fornt of me,... |
I was following the textbook by David Mackay: Information theory inference and learning algorithms.
I have question on asymptotic equiparition' principle:
For an ensemble of $N$ $i.i.d$ random variables $X^N=(X_1,X_2....X_N),$ with $N$ sufficiently large, the outcome $x=(x_1,x_2...x_N)$ is almost certain to belong to ... |
I am struggling in finding the name of this game (in order to find research papers related to it in the literature).
Given an initial word $X$ and a target word $Y$, what is the minimum number of (letter) flips needed for $X$ to reach $Y$ assuming $X$ and $Y$ having the same number of letters, we flip only one letter ... |
I know that in the case of a 16 bit word, if we have x - 115 in decimal, the smallest x that would cause overflow would be (32767 + 115 + 1)= 32883 because it would represent a number that is larger than the largest positive integer we could represent in a 16 bit word.
However, I was wondering what would the largest va... |
Say I have a full application written in Python. Is it feasible to convert the source code into C? If such a tool doesn't exist, why doesn't it? What are the constraints?
I ask this since I have been wondering why people use C for microcontrollers when they could write their code uber-fast in Python when prototyping an... |
If $\Sigma^*$ is the set of ALL strings including the empty string, then what can its complement possibly be? The empty set?
|
Must the states of a finite state machine be worked off sequentially or could you understand the different shaped parts of the key as input and the position of the pins as states?
If not all the input is right: failure state = stays locked
If all the input is right: end state = lock opens
I was inspired by this (German... |
Let $\Sigma_n = \{0, 1, ... , n-1\}$. Suppose $L \subseteq$ $\Sigma^*_n$, and let
$\qquad\displaystyle\mathcal{B}(L) = \{ x \in L : x = \textrm{lex}\max L_m, m \in \mathbb{N}_0 \}$,
where $L_m = L \cap \Sigma_n^m$ and $\mathrm{lex}\max$ denoting the lexicographic maximum.
For example, $\mathcal{B}(\{0,1\}^*) = 1^*$ a... |
I have tried to Use the Bailey–Borwein–Plouffe formula to calculate pi to 3 digits as a test trial, and recieved the digit 4, which is technically correct, as 4 is the 3rd digit of pi in base 16. I would like to get the digit in decimal, as that is the current standard for numbering things in most places, as you don's ... |
Ok so I understand how $\mathrm{ATM} = \{\langle M,w \rangle \mid \text{$M$ is a TM and $M$ accepts $w$}\}$ is undecidable.
Is this because $w$ is a variable?
What if the parameter is fixed?
Consider $\mathrm{BTM} = \{\langle M,w \rangle \mid \text{$M$ is a TM and $M$ accepts the string 101}\}$.
BTM is decidable right?... |
I could use a priority queue supporting the find-and-delete-min, and lazy-increase-key operations. The last term is my "invention". It should go like this:
The keys are held somewhere outside of the queue and get increased very often (more often than any other operation). Finding them is not the job of the queue. Ideal... |
Imagine you load this data as a 4-byte word into a register R. What is the value in R on a big endian machine and what is it on a little endian machine if you interpret the bits as a signed integer encoded in 2s complement
On a big endian machine the register R would be something like this
not considering the last s... |
Consider the following problem:
Input: a directed graph $G = (V,E,\omega)$ where $\omega : E \longrightarrow \mathbb{Z}$, two vertices $v_1, v_2 \in V$, and a weight $k \in \mathbb{Z}$
Question: Does there exist a walk from $v_1$ to $v_2$ with weight exactly $k$?
The weight of a walk is simply the sum of all edges in t... |
I'm not exactly sure what this question is asking me to do:
Show that the set of binary integers (given as strings over $\{0, 1\}$) that are divisible by $3$ is regular, by giving a DFA that recognizes it. Leading 0s are allowed. The empty string should be accepted. Briefly explain your answer.
Is this asking me to c... |
How to check if all subarrays of the array contain at least one unique element for NlogN complexity, where N is the length of the array?
For example:
3 1 2 1 2 5 6 - doesn't satisfy the property (1 2 1 2 has no unique elements)
1 2 1 3 1 4 1 5 - satisfies the property
|
I have been trying this Towers of Hanoi question since last week but never able to come with the right approach towards the solution.
The setup is the standard Towers of Hanoi, except that moving the smallest disk costs one unit of time, moving the second-smallest disk takes two units of time and so on.
What is the tot... |
What´s the technique behind the way google earth overlaps polygons on top of pictures(like the ones users assign to streets and houses) ?
It seems to be aware of perspective, and I don´t remember seeing it covered on books on computer vision.
Thanks,
Rafael
|
While studying the dynamic programing algorithm for the maximum independent set problem in trees I thought about the following simple alternative algorithm. I tried to prove it's correctness but I do not know how to attack the proof.
The algorithm iteratively finds a two vertices $u,v$ of the tree which have maximum di... |
In trying to write pseudocode for it, this is my attempt:
I'm just trying to write a pseudo-code for it and explain the run time.
So far this is what I have:
k-merge-sort(L)
{ if length(L1) <2 return L1
else
{ split L into L1, L2, L3
A1 = k-merge-sort(L1)
A2 = k-merge-sort(L2)
....
... |
For example can an approximation algorithm call a subroutine which is solving a NP-Hard problem? (like say its trying to find the longest path in some graph as an intermediate step) Is that allowed?
|
Solutions to the critical section problem exhibit three properties: mutual exclusion, progress, and bounded waiting. When do we say, or do we at least say, that operating system-implemented semaphores and monitors possess all these three properties?
An example would be bounded waiting on semaphores. In bounded semaphor... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.