Most Popular
1500 questions
12
votes
2 answers
Linear time labeling algorithm for a tree?
I have an undirected tree whose vertices I want to label. The leaf nodes should be labeled one. Then, assume the leaves were removed. In the tree that remains, the leaves should be labeled two. This process continues in the obvious way until all…
Bob Whiz
- 123
- 5
12
votes
3 answers
What is the difference between Multiprogramming and Multitasking
I am finding it difficult to clearly differentiate between Multiprogramming and Multitasking.
My primary source has been Wikipedia, but the WP article seems to be a little at odds with some less reputable sources (like my college professor).
As I…
jsj
- 680
- 3
- 8
- 12
12
votes
1 answer
Difference between the languages accepted by two DFAs with different initial state/accepting states?
Recently, I asked a question on Math SE. No response yet. This question is related to that question, but more technical details toward computer science.
Given two DFAs $A = (Q, \Sigma, \delta, q_1, F_1)$ and $B = (Q, \Sigma, \delta, q_2, F_2)$ where…
Nobody
- 450
- 1
- 5
- 19
12
votes
3 answers
What is the meaning of 'breadth' in breadth first search?
I was learning about breadth first search and a question came in my mind that why BFS is called so. In the book Introduction to Algorithms by CLRS, I read the following reason for this:
Breadth-first search is so named because it expands the…
SherlockHolmesKePapa
- 243
- 2
- 8
12
votes
2 answers
Finding the language generated by a context-free grammar
This is a question from the Dragon book (I apologize for translation mistakes, I don´t have the English version on hand):
What language is generated by this grammar?
$S \rightarrow a S b S \mid b S a S \mid \epsilon$
I don't know what I'm…
dan
- 223
- 1
- 3
- 8
12
votes
1 answer
Why use heap over red-black tree?
Heap supports insert operation in $O(\log n)$ time. And while heap supports remove min/max in $O(\log n)$ time, to remove any element (non min/max) heap takes $O(n)$ time.
However, red-black tree supports insert/remove both in $O(\log n)$ time. We…
Wonjoo Lee
- 123
- 1
- 5
12
votes
4 answers
Does the complexity of strongly NP-hard or -complete problems change when their input is unary encoded?
Does the difficulty of a strongly NP-hard or NP-complete problem (as e.g. defined here) change when its input is unary instead of binary encoded?
What difference does it make if the input of a strongly NP-hard problem is unary encoded? I mean, if I…
user2145167
- 703
- 5
- 14
12
votes
1 answer
The "CPS" approach has done great harm to performance in SML/NJ; reasoning desired
In a comment to Learning F#: What books using other programming languages can be translated to F# to learn functional concepts? Makarius stated:
Note that the "CPS" approach has done great harm to performance in
SML/NJ. Its physical evaluation…
Guy Coder
- 5,181
- 2
- 30
- 65
12
votes
2 answers
Non-Parametric Methods Like K-Nearest-Neighbours in High Dimensional Feature Space
The main idea of k-Nearest-Neighbour takes into account the $k$ nearest points and decides the classification of the data by majority vote. If so, then it should not have problems in higher dimensional data because methods like locality sensitive…
Strin
- 1,515
- 1
- 11
- 16
12
votes
2 answers
Word factorization in $O(n^2 \log n)$ time
Given two strings $S_1, S_2$, we write $S_1S_2$ for their concatenation. Given a string $S$ and integer $k\geq 1$, we write $(S)^k = SS\cdots S$ for the concatenation of $k$ copies of $S$. Now given a string, we can use this notation to 'compress'…
Timon Knigge
- 327
- 1
- 9
12
votes
3 answers
Decidable languages and unrestricted grammars?
Turing machines and unrestricted grammars are two different formalisms that define the RE languages. Some RE languages are decidable, but not all are.
We can define the decidable languages with Turing machines by saying that a language is decidable…
templatetypedef
- 9,302
- 1
- 32
- 62
11
votes
1 answer
Not able to convert from NFA to DFA
I have a simple problem of making a DFA which accepts all inputs starting with double letters (aa, bb) or ending with double letters (aa, bb), given $\Sigma =\{a, b\}$ is the alphabet set of the given language.
I tried to solve it in a roundabout…
Anurag Kalia
- 503
- 2
- 11
11
votes
4 answers
What does the leading turnstile operator mean?
I know that different authors use different notation to represent programming language semantics. As a matter of fact Guy Steele addresses this problem in an interesting video.
I'd like to know if anyone knows whether the leading turnstile operator…
Jim Newton
- 315
- 4
- 11
11
votes
2 answers
How to prove that $n(\log_3(n))^5 = O(n^{1.2})$?
This a homework question from Udi Manber's book. Any hint would be nice :)
I must show that:
$n(\log_3(n))^5 = O(n^{1.2})$
I tried using Theorem 3.1 of book:
$f(n)^c = O(a^{f(n)})$ (for $c > 0$, $a > 1$)
Substituing:
$(\log_3(n))^5 =…
Andre Resende
- 113
- 3
11
votes
4 answers
What's the difference between user registers and kernel registers?
I am reading Operating Systems: Three Easy Pieces, but I can't fully understand the following paragraph. It's from the 6th chapter of the book. I think it's self-contained, so I quote here.
Note that there are two types of register saves/restores…
Bicheng
- 225
- 2
- 7