instruction stringlengths 35 29.1k |
|---|
Wiki: https://en.wikipedia.org/wiki/Byzantine_fault_tolerance
In the paper "Reaching Agreement in the Presence of Faults", M. Pease et al. proved that there is no protocol (of some kind) to solve the problem for $n \leq 3m$, where $n$ stands for the number of generals and $m$ stands for the number of traitors. The key... |
Given an execution time $t(c_1)$ and linear speedup $s$, how do you calculate the execution time for $c_2$ processor cores?
(Assuming Gustafson's law, or in other words, $t(\infty)=0$)
My ideas:
I haven't found any references that give formulas for calculating execution time, surprisingly. However, I think you can deri... |
I am on a journey understanding Dijkstra's algorithm.
My familiarity with mathematical terms is not great, so I have put the algorithm into my own English. I understand this is not ideal, but this is part of my learning process.
What are the major areas of misunderstanding in the description below?
We maintain a list ... |
We clearly know that 2-QCNF is in $\mathsf{P}$. Since that, if I understand it right, it is possible to solve it with #SAT solver (because $\mathsf{P} \subseteq \mathsf{\#P}$). But how can we only knowing amount of positive assignments for some non-quantified formulae solve 2-QCNF? And why this doesn't hold (at least, ... |
If $X,Y$ are complexity classes in the polynomial hierarchy with $X\subseteq Y$. With abuse of notation assume $X,Y$ also as the TMs that accept languages in classes $X,Y$ respectively.
Then is it always true $X^Z\subseteq Y^Z$ if $Z$ is another complexity class?
If not what is an easy way and example to understand $X... |
1. Consider the following algorithm for deciding GCD:
“On input :
1. If z doesn’t divide x or y, reject. O(n)
2. For i from z + 1 to min(x,y) do: O(2^n)
2.1. If i divides both x and y, reject. O(n)
3. Accept.” O(1)
Analyze the al... |
I'm trying to write a Turing machine that can convert a number in binary representation to a number in decimal representation. For example if the input on the tape is 1101 the output should be be 13. Where should I start from?
|
Algorithms like Knuth's algorithm or this one, works for a range that is known in advance(like shuffling numbers 1 to 11), in this case the range will never change. You'll always get a random no. between 1 to 11.
But in my case the range can increase like if the generator generates 2 random numbers {3,5} from the range... |
Suppose we have two context-free Languages $L_{1}$ and $L_{2}$, and we form a new language $L_{3}=L_{1} \circ L_{2} = \{\alpha\beta | \alpha \in L_{1},\beta \in L_{2},|\alpha|=|\beta|\}$. Is it possible that $L_{3}$ is not context-free?
|
I have two objective functions say f1 where I have to minimize (X+Y) and another function f2 where I have to maximize (A-B). The two functions are conflicting.
I need to convert them into a minimization problem involving one single objective function using the weighed sum approach where the final form would become f3 ... |
Suppose I have a set of points in 3D which are all co-planar, and which describe the vertices of a convex polygon. I know the coordinates of all of these vertices, I know the unit normal to the plane of the polygon, and I know the order (in a right-hand sense with respect to the normal) in which the vertices go around ... |
So I never really understood the von Neumann architecture, and have started to revise it as I wasn't in school during the lessons of the CPU. Can't really get help through my teacher as they wont respond to their email.
I have learnt about the von Neumann architecture, and now I need to know how the architecture differ... |
I'm studying several disk scheduling algorithms; however, I'm kinda confused with SCAN. I understand the concept, but I don't understand the example given in the book. I think that the author made a mistake, but I want to be sure.
The example is the following:
Description of SCAN: The disk arm starts at one end of the... |
In arithmetic coding a word is coded as the binary encoding of a number in a certain interval. The interval is determined from a sequence of nested intervals according to the probability distribution on the letters of the word.
This encoding and decoding process is totally clear to me, but what wonders me is how an en... |
I am a TA for an introductory CS course, and one question given to students was how to use BFS to determine the diameter of a graph. The students were told they wouldn't be graded for efficiency, so the expected answer was a brute force algorithm where they ran BFS from every node to every other node and returned the m... |
I'm trying to apply homotopy type theory as a theoretical foundation for describing how database query plans solve relational algebra queries. I'm modeling the problem as, given a set of input function types and constraints on composing them, and a goal function type, find a composition of the input functions which ha... |
So class P is the class of languages that are decidable in polynomial time on
a deterministic single-tape TM.
I can show that the decider for a language L* runs in polynomial time.
So is it true that this language in class P?
STARCLOSED DFA = { | A is a DFA, and L(A) = L(A)*}
|
Just out of curiosity:
Do there exist algorithms for which the Big-O cannot be found out?
I have done a quick search in the google search bar:
"Big o, impossible to evaluate"
"algorithms without big o"
And these gave results which were unsatisfactory. Mostly, teaching me how to find the big o. Nothing I haven't learned... |
Given two entangled qubits in the state ${|00⟩+|11⟩\over \root \of 2}$, I have trouble getting the way of applying a 1-qubit gate (let's say a Hadamard) to 1 of the entangled qubits (let's say the first one). Actually I have several questions:
Following this link, Ran G. says that "You can apply a quantum gate on any ... |
I want to use Android's gyro/accelerometer/magnetometer to predict (over a very short time interval) how image points corresponding to a fixed object will change (without trying to scan for them in the image). In particular, suppose we have an object of known size with model points $v_1, \dots, v_N$. In this question... |
Wikipedia defines straight-line programs in the following manner:
In mathematics, more specifically in computational algebra[disambiguation needed], a straight-line program (SLP) for a finite group G = 〈S〉 is a finite sequence L of elements of G such that every element of L that belongs to S, is the inverse of a prece... |
Here are some sequences:
'0.66666'
[3,0,1,2,2,2,0,1]
'banana'
'bandana'
'11221122'
I would like to find the index and length of the substring in each which is repeated (even if partially) for the most terms and which repeats until the end.
I wrote a function in JavaScript that successfully returns the
expected output:... |
I am reading about Representative Grammars from book, where I encountered the following grammar:
$$ E \rightarrow E + T \ | \ T $$
$$ T \rightarrow T * F \ | \ F $$
$$ F \rightarrow (E) \ | \ id$$
The above grammar is left-recursive, which is bad. So in order to eliminate left recursion, they changed it to the followin... |
Can someone help me prove that $L = \{ a^ib^jc^k | i < j \ and \ i+2j+3 < k \}$ is not a context free language?
I've tried applying the pumping lemma for CFGs and proving case by case (taking x=uvw, at first v is int $a^+$, then v is in $a^+b^+$ etc.but I'm failing to find a contradiction). Any help is welcomed.\
PS: ... |
For languages $L_1, L_2$ over some alphabet $\Sigma$, we define
$$ \textit{Shuffle}(L_1, L_2) = \{a_1b_1a_2b_2 \cdots a_nb_n : n \geq 1 \wedge a_1, \ldots , a_n \in L_1 \setminus \{ \varepsilon \} \wedge b_1, \ldots , b_n \in L2 \setminus \{ \varepsilon\}\}$$
I think that RE are closed under shuffle, I tried to use th... |
Given integers $d$ and $l$, compute the number of grid points $x \in N^d$ that satisfy $\sum_i x_i^2 \leq l$ (i.e. $||x||_2^2 \leq l$). (Think of $l$ as $r^2$).
The problem is obviously in #P. Is it in P or a smaller class? What if in place of $l_2$ we use $l_p$?
|
I have some good basics -I think- in computervision (using openCV) and am considering to build a quadcopter to create a 3D maps while flying.
I would like to place a camera on each side of the quadcopter (ie, left, right, front and back) to continuously provide +/- 360 degrees images. Then stitch those four images toge... |
I am having a hard time determining the Big-O notation based on the runtime of the algorithm. I would really appreciate it if any one of you could give me some hint/ or tips in answering the question.
|
If $T_n = \{ \langle M \rangle \mid M \mbox{ is a Turing machine and } |L(M)| = n\}$ where $n$ is $0,1,2....$
I need to show that if $n \geq 1$, $T_{n+1}$ reduces to $T_n$. I know I need to create a machine where that machine accepts $|L(M)|-1$ strings, which I could then use to verify with $T_n$. I'm just confused as ... |
I have been searching for matching algorithms similar to the Gale Shapley, or stable marriage algorithm, but with no luck.
The question is if there are other algorithms that are similar to the GS and used for the assignation of persons or items based on preferences?
|
I studied the subject of building a lexical analyzer using finite automata, through the classical way: Regular Expression -> NDA -> DFA. And I found it elegant, and a more solid approach for building a lexer.
Now my question is, what are other benifits from building a lexer this way, rather than the "ad hoc" way?
|
Given a directed graph $G = (V, E)$ with all edge weights being non-negative and two disjoint subsets of nodes $S, T \subseteq V$, design an algorithm to find the shortest paths among $S$ and $T$, (formally, $\min\{d(s,t): s \in S, t \in T\}$) in $O(m \log n)$ time, where $|V| = n$ and $|E| = m$.
|
It is known that any (deterministic, single-taped) Turing-machine that runs in time $o(n\log n)$, decides a regular language (e.g., see this link). Thus, there exists an equivalent Turing-machine that runs in time $O(n)$. In other words, if $t(n)=o(n\log n)$ then $$\mathsf{DTIME}\left(t\left(n\right)\right)\backslash\m... |
Given a set S of integers, the task is to partition the set into subsets such that:
Total number of partitions is maximized
Each partition has sum at least K
This looks like a variant of bin-packing problem, in which the bin has to filled upto a minimum capacity and the objective is to maximize the number of bins. I ... |
I've seen both ways of counting the bits when determining where to place the parity bits in a 1 bit error correction Hamming code. Some people count the bits starting from the left, others do it by starting from the right.
When to use one or the other? Does this depends on the Endian ordering?
|
I am training a Variational Autoencoder (type of convolutional neural network), and have been plotting cost over time. The result is a noisy curve, shown here:
I would like to write a function that gives the probability that the cost function has bottomed out, i.e. that its slope going into the future is zero. Due to t... |
I was asked to construct a Turning Machine that computes the increment of a binary string by 1- The Turing Machine receives a binary string and accept a string which is an increment by 1 of the input, written to the left of the head . I was given the fact that the head first reads the MSB.
I thought of an Idea but I do... |
Consider the following problem:
We have an extremely large set of nodes, $\pi_0, \ldots, \pi_{N - 1}$ with $N$, e.g., in the order of millions. Each node has a boolean variable $b_0, \ldots, b_{N - 1}$. Some of the nodes will have $b_i = \top$, others will have $b_i = \bot$.
Now, I need a procedure that can scale to th... |
I want to build a context sensitive grammar for the language $\{a^{2^n}\mid n\geq 0\}$. I think it should be something like this
\begin{align*}
S &\to aA \mid a\\
aA&\to aaaA \mid aa
\end{align*}
|
I am trying to create a data structure for handling the subsets of the real line of the form $[x,y)$. That is, suppose $X \subseteq \mathbb{R}$ and the data structure supports two types of operations: $add(X, [x,y))$ and $remove(X,[x,y))$. Each of these two queries return the number of disjoint semi-intervals in $X$. F... |
In "Big O", common notations have common names (instead of saying, "Oh of some constant factor"):
O(1) is "Constant"
O(log n) is "Logarithmic"
O(n) is "Linear"
O(n^2) is "Quadratic"
O(n * log n) is ???
Is it just "n log n" or does it have a special name like the above?
|
What is the formal name in type theory of the operation that creates a "matrix of types" from product types (such as std::tuple in C++)?
For example if we consider std::tuple<int, float, char> t1 and std::tuple<std::string, double> t2 (in C++, but the same question remains for any product type in any language), what w... |
Given a simple graph $G$, A subset of vertices $V_G$ is called "very independent" if there is no edge between each pair of the vertices in $V_G$ and for each pair $v,v'$, there is no vertex which is connected to both $v$ and $v'$.
In other words, a very independent subset is an independent subset of vertices like $V_... |
The problem: Let a formula in $\varphi\in 2kCNF$ where there's an assignment $\alpha$ such that for every clause, $l$ in $\varphi$, $\alpha$ satisfies at least $k$ literals of $l$. Suggest a randomized algorithm for finding a satisfying assignment for such $\varphi$.
So basically I've read about the $WALKSAT$ algorit... |
I wonder whether there is a known relativization barrier against proving $LogCFL\neq PSPACE$. Hence I'm looking for a language $A$ for which $LogCFL^A=PSPACE^A$.
One could try $A:=TQBF$, where $TQBF$ is the $PSPACE$-complete problem to decide true quantified Boolean formulas. But relativising space-bounded classes is a... |
A language is in $\mathsf{Almost\text{-}PSPACE}$ if there is a (deterministic) $\mathsf{PSPACE}$ Turing machine with an oracle $A$ that accepts the language with probability $1$ when the oracle language is chosen uniformly at random [1,2]. (That is, the language accepted by the oracle is determined by tossing a fair co... |
I am wondering if KMP algorithm can find multiple matches in a given string when there is an overlap.
Here is an example.
Word to Search from (S): abcabcabc
Search word (W): abcabc
If you look at "W", it matches "S" from index 0 as well as from index 3
(abcabc)abc
abc(abcabc)
When I looked at the pseudo code on... |
I am having trouble understanding the class $coNP$. We defined
$$coNP = \left\{ \overline{A} : A \in NP \right\}$$
As far as I know, a language $A$ is in $NP$ if, and only if, a non-deterministic turing machine $M$ exists, which outputs $1$ if $w \in A$ and $0$ if $w \notin A$. But if this is true, then a turing machin... |
I've been studying recently some variations of the CORDIC, and it seems to me that the logic behind at least the basic cordic or the redundant CORDIC is very similar to the logic used to design digit recurrence for the division (using redundant digit set). Is this statement correct?
At each iteration they have to guess... |
For a school project I am doing on linear programming, I've implemented the simplex algorithm in Python.
I was hoping to check the complexity on a number of matrices.
Preferably, they would have to be in standard form ($Ax=b$ and $x\geq0$) (or easily put into standard form) and would have to have a finite inf (to avo... |
The question is not related to the homework
I was working on a homework, and the specification was to generate a random tree with n elements(n being in the thousands for the assignment) and asked me how many of the trees generated were RBT. I have been iterating to the millions now, so I began to wonder what was the pr... |
I'm trying to derive an algorithm or procedure I would use to have a human interactively rank a series of items based on importance by comparing a random-pairing of items at a time.
So, given an array of let's say 10 "things", I want to present two of the things, and have the user specify which is the more important of... |
Let $A(n, B, d)$, $B(n, d)$ be a {Turing machine, random-access machine, C program} with finite tape (which I'm going to denote "Turing machine*" and "random-access machine*" respectively), $n \in \mathbb{N}$. $A$ and $B$ are the same type of machine. For any $N \in \mathbb{N}$, statements where $n \leq N$, don't matte... |
Construct a Turing Machine
to increment any binary number
.
(for
example, if
the
input
is
10010 then the output will be 10011
and if the input 111 then the output will
be 1000
|
I'm reading through the Khan Academy course on algorithms. I'm taking a quiz and finally got the right answer (all 3 of the options are true).
For the functions $\lg n$ and $\log_8 n$, what is the asymptotic relationship between these functions. Select all that apply.
[ ] $\lg n$ is $O(\log_8 n)$
[ ] $\lg n$ is $... |
So when I play a video, that means the video is moved from backing store to main memory. Then if I remove my laptop's battery all of sudden, that means the video should get lost as main memory is volatile. Why doesn't this happen though?
|
Suppose that we have a formula A which is valid in all states of Kripke structure and some transition relations. Is it generally possible to derive if formula A is common knowledge between particular agents directly from the structure?
|
Suppose that $G = (V, E)$ is an undirected graph, and $G$ is promised not to contain $C_{k-1}$.
Goal is to find any $C_k$ in $G$ using an efficient algorithm. Efficient, in this scope, meaning that finding all cycles and excluding all $C_{m>k}$ is out of question.
First thing comes in mind is to use depth-first search,... |
Let $L$ be a regular language with alphabet $\Sigma = \{a,b,c\}$.
Prove that the following language is regular:
$\{w | w \in L \text{ and } w \text{ starts with } abc \}$.
I wonder what proof strategy I can use to prove this.
|
Are there NLP algorithms dealing with detecting the repeating
patterns in a a list of texts from which a topic keywords
and other associative keywords can be derived?
I will show it as an example:
You have a search query "vegan food for something health"
(where something is a part of body you need an advice about).
The... |
I'm trying to build a complexity analysis tool and I need an algorithm for constructing the control flow graph (to get cyclomatic and eventually essential complexity). I couldn't find any pseudocode online so I just got down to writing it. Using recursion seems to have been a bad way to go; my code handles most simple ... |
My question is
Accept all strings containing “ 011 ” or “ 001 ” as a substring and should not contain “ 010 ” as substring
for the following languages over the alphabet {0,1}
i have solve it but , i have doubt if i can make the string contain 010 as substring goes to dead state ?!!!
|
Yes, this is homework.
I need help knowing how to begin this problem:
Let A be an algorithm that finds the kth largest of n elements by a
sequence of comparisons. Prove by contradiction that A collects enough
information to determine which elements are greater than the kth
largest and which elements are less tha... |
This is the question:
A spreadsheet keeps track of student scores on all the exams in a course. Each row of the spreadsheet corresponds to one student, and each column in a row corresponds to his/her score on one of the exams. There are r students and c exams, so the spreadsheet has r rows and c columns. Devise an al... |
Designing CFG for the following language $\{a^nb^m \hspace{0.2cm} | \hspace{0.2cm} n\ge0, m\ge0, n\le m \le 2n \}$ is easy.
$S \to aSb \mid aSbb \mid \lambda$
Then how about this? Language $\{a^nb^m \hspace{0.2cm} | \hspace{0.2cm} n\ge0, m\ge0, n<m<2n \}$.
It is somewhat difficult for me. I have no idea how to exclud... |
I am trying to convert a regular language to a context free grammar. The language is $L=\{a^n b^m c^k |n=m\ or\ m\le k\}$, my solution is: assume $m,n,k\ge0$
$S\to AS|BS|\lambda$
$A\to aAb|Ac|ab$
$B\to Bc|Bbc|aB$
Is this correct? Can somebody explain why it is correct or not correct?
|
Here is a code point: U+091D. The symbol it represents in UTF-8 is झ. In hex the symbol requires three bytes: e0 a4 9d. But it looks like the number 091D requires two bytes. So why do we need three bytes to encode the symbol? Probably due to
the restriction of the Unicode code-space to 21-bit values in 2003
Please se... |
I've been reading that to terminate a TCP connection 3 handshakes are required: FIN, FIN ACK, and ACK. However, when closing a connection, Wireshark displays FIN ACK, FIN ACK, ACK; it never displays FIN by itself.
However, when establishing a connection Wireshark clearly displays the three handshakes: SYN, SIN ACK, ACK... |
Since logical memory maps to the RAM (physical memory) it has be stored somewhere right and it will obviously take large bunch of memory of itself. Where is it stored?
|
I have to prove with the pumping lemma that $L$ is not regular or to give a regular expression for that.
Let $L$ be all combinations of commands such that in the complete drawn result no line is drawn above another. At the starting point the pen is down.
The turtle graphic is created by the following commands:
u - ... |
According to this wikipedia link, under the title "Success probability of the contraction algorithm":
Number of possible cuts in a graph is $2^{n-1}-1$, while maximum number of minimum cuts is ${n}\choose{2}$, where $n$ is number of vertices.
My question:
Why number of possible cuts differ from maximum number of minimu... |
I read one of those popular papers on cubical type theory, but no wonder I could only see formulas and diagrams without being able to recognize them at all.
So here's what I want. I want a deep enough explanation of what composition, Kan filling and gluing have to do with homotopy type theory. I don't expect there coul... |
As seen here:
It works same like multiprogramming with fixed partition and also the memory is contiguous as well. How is it different and especially non-contiguous? What's happening here?
|
Is there a way to support adding characters in the middle and update the hash in O(1) ?
All I have is the hash of ABBDE and I want to get the hash of ABBCDE.
|
Here $M$ denotes a turing machine.
By set theory, $L = \overline{E_{TM}} \cap \overline{L_0} \cap \overline{L_1}$ where $L_i=\{\langle M \rangle \mid |L(M)|=i\}$. And I know that $\overline{E_{TM}}$ is recognizable.
That is about all I know at this point. I suppose I need to use mapping reducibility to prove $L$ is not... |
Let $A=(a_{ij})$ and $B=(b_{ij})$ be $n \times n$ integer matrices. Then $AB=(\Sigma_{k=1}^n a_{ik}b_{kj})_{ij}$. I am interested in finding the most efficient algorithm for computing the product of the entries of $AB$,
$\Pi_{i,j=1}^n (\Sigma_{k=1 }^n a_{ik}b_{kj}$).
Certainly, the most straightforward way of doing th... |
I am a beginner in coq and want to prove the following theorem t1. First I used induction i and destruct j, but it got bogged down in the middle.
I would like some hints for this problem.
Function f takes two arguments of nat and returns Prop (e.g., f 2 4 = x 2 ∧ x 3 ∧ x 4 ∧ x 5).
Theorem t1 shows that a head of funct... |
My question is related to the space-time complexity to find the values of n and c by considering this question.
AS we have seen that there are multiple solution for the above equation is possible. But I am confused which one we have to consider.
In solution1: nO = 5 and c = 101 ; this states that we are considering ... |
I have a problem with this following question:
Prove that the language $\{uw : |u|=2|w|\}$ is regular.
I tried to give this regular expression $(uw²)^*$ to resolve it.
|
Given a representation $g$ (e.g. the Gödel number) of a Turing machine $B$, a universal Turing machine $A$ can simulate $B$.
If $B$ is restricted to using at most $n$ memory cells of its tape and the memory cells of $A$ and $B$ can assume the same number of states, how much space does $A$ require at least to simulate a... |
Does it exist an algorithm to find a median of table with a complexity nlog(n)
Thank
|
For advancing the
address input of the RAM, we provide the
signal “strobe”.
Can anyone explain this in a bit more detail?
Thanks.
|
Here is an imgur folder with the projects description (my apologies for the awfully wrinkled paper): http://imgur.com/a/a2vQM
There are a set of pegs, numbered from 0 to n - 1. Each peg can have a connection to another peg with a rubber band.
Basically, the program is given an adjacency list with all of the pegs and th... |
I'm trying to solve a recurrence using the master method:
$T(n) = 10*T(n/3) + n^2\log^5n$
I set up the comparison
$n^2\log^5n$ and $n^{\log_3 10}$
and reduced them to:
$\log^5 n$ and $n^{\log_3(10/9)}$
I'm struggling to understand how these functions compare asymptotically.
From one side I understand that in general p... |
The definition of the universal Turing machine is
$$
U(\langle M \rangle,p)=M(p)
$$
where U is a universal Turing taking two inputs $\langle M \rangle$, the binary encoding of a Turing machine, and $p$ a binary program.
What happens in the case where we feed the null Turing machine to the UTM.
$$
U(0,p)=?U(p)?
$$
Will... |
I have a dataset of about 26,000 words along with their gender tags [m, f or any]. Which ML algorithm should I use for Gender Tagging/Classification purpose. How should I go about it? What should be the input features?
Given a word , it's Part Of Speech tag and in some cases the singularity I am trying to predict the g... |
I have a list of people's locations on a world map and want to pair nearby people up such that the number of pairs is maximized.
For example, subject to the constraint that paired people are within d=10 miles of each other, I might find 742 pairs from a list of n=3000 people's locations.
Possible considerations:
alr... |
I would like to see the proof or a refernce to it. I feel it is obvious but my tutor insists the other way (agnostic PAC is a subset of PAC, and there are problems in PAC that are not angostic PAC).
|
I am working on a project where I refer to the RAM model, I explain what it is, but I am not sure who defined it first.
The wikipedia article is not very explicit about it, and the first citation is from 1946.
Goldstine, Herman H., and von Neumann, John, "Planning and Coding of the Problems for an Electronic Computing ... |
Basically I want to prove that the set of all c-compressible binary strings is recognizable.
My goal is to construct a turing machine $N$ such that, given an input string $x$, $N$ accepts $x$ if there exist a turing machine $M$ and a string $s$ such that $M(s) = x$, and $|\langle M \rangle|+|s| \leq |x|-c$. Since both ... |
I am trying to more deeply understand the difference between Hidden Markov Models and Bayesian Network? The general idea is that HMMs have a single variable which has probabilities of entering different states, known and unknown, whereas the Bayesian network relates multiple random variables.
So, given that, what would... |
In the introduction of Distance-Sensitive Bloom Filters the authors state:
The relative Hamming distance between two Bloom filters (of the same size, and created with the same hash functions) can be used as a measure of the similarity of the underlying sets.
This statement is followed by a reference to another paper,... |
There are two nice tree constructions, that use a stack in a similar manner:
Construct a binary search tree from a pre-order traversal (e.g. see http://www.geeksforgeeks.org/construct-bst-from-given-preorder-traversal-set-2/)
Construct a Cartesian tree from an array of numbers (e.g. https://en.wikipedia.org/wiki/Carte... |
I have an undirected graph which may or may not contain a 'bridge'. I'm defining a bridge as a relatively narrow connection between two larger clusters. Take for example the following graph:
A----B
\ /
\/
C
|
D
|
E
/\
/ \
F----G
In this example D would be considered the 'bridgiest' node, because it c... |
I have a Compiler Design course this semester but unfortunately the professor teaching this course have some issues with text book which is Compilers, Principles, Techniques & Tools by Alfred Aho and others.
For the section Intermediate Code Generation there is a slide which introduce a method to do so. I provide a pho... |
I have an algorithm here and it wants me to calculate the complexity:
for (i=1;i<n;i++)
for (j=1;j<i*i;j++)
if (j%i==0)
for (k=0;k<j;k++)
sum++;
First of all, I think that i have different complexities for best, average and worst case but I don't know how to find them. I have one though and I sa... |
I have the following grammar:
S -> Xb | Y
Y -> X | a
X -> S | c
Here the lowercase letters are terminals.
I have an algorithm to find the cycle in this grammar. It is S->Y->X->S and in fact there is a smaller cycle buried in there, namely S->X->S.
I've tried to devise an algorithm to remove these cycles, without too... |
I'd like to prove that $\sqrt n\log{\sqrt n}=\Theta(n)$ but I'm not sure how to do it.
This is my attempt:
$$
\lim_{n \to \infty}\frac{\log{\sqrt n}}{\sqrt n}=0 \Rightarrow \log{\sqrt n}=o(\sqrt n) \text{(Little o)}
$$
Therefore:
$$
\sqrt n\log{\sqrt n}=o(\sqrt n\cdot \sqrt n)=o(n)
$$
But this is too much as I need th... |
In Brin and Page's paper "The Anatomy of a Large-Scale Hypertextual Web Search Engine", they describe the variable "d" in the PageRank algorithm as the probability that a random surfer requests a new random page. On the next line, they state:
One important variation is to only add the damping factor d to a
single pa... |
I need to write an algorithm which will sort an array $A[1..n]$ with $\sqrt n$ distinct elements in $\Theta(n)$ time and $\Theta(\sqrt n)$ space?
The solution must use hash-tables and advanced data structures including any variation of trees is not allowed.
I thought of the following:
1 Sort(A, n)
2 init B[2][sqrt(... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.