Most Popular
1500 questions
12
votes
1 answer
Potential function binary heap extract max O(1)
I need help figuring the potential function for a max heap so that extract max is completed in $O(1)$ amortised time. I should add that I do not have a good understanding of the potential method.
I know that the insert function should "pay" more in…
andrei
- 223
- 2
- 6
12
votes
3 answers
Concrete understanding of difference between PP and BPP definitions
I am confused about how PP and BPP are defined. Let us assume $\chi$ is the characteristic function for a language $\mathcal{L}$. M be the probabilistic Turing Machine. Are the following definitions correct:
$BPP =\{\mathcal{L} :Pr[\chi(x) \ne…
DurgaDatta
- 223
- 2
- 6
12
votes
4 answers
Is Python a context-free language?
From Wikipedia: Off-side_rule#Implementation, there is a statement:
...This requires that the lexer hold state, namely the current
indentation level, and thus can detect changes in indentation when
this changes, and thus the lexical grammar is…
fronthem
- 285
- 2
- 8
12
votes
2 answers
Simplify complexity of n multichoose k
I have a recursive algorithm with time complexity equivalent to choosing k elements from n with repetition, and I was wondering whether I could get a more simplified big-O expression. In my case, $k$ may be greater than $n$ and they grow…
yoniLavi
- 245
- 4
- 10
12
votes
4 answers
Fastest way to solve a system of linear equations
I have to solve a system of up to 10000 equations with 10000 unknowns as fast as possible (preferably within a few seconds). I know that Gaussian elimination is too slow for that, so what algorithm is suitable for this task?
All coefficients and…
tmwilliamlin168
- 325
- 1
- 2
- 7
12
votes
1 answer
TCP Connection Termination - FIN, FIN ACK, ACK
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…
Jack
- 175
- 2
- 2
- 8
12
votes
3 answers
What is the difference between quantum computing and parallel computing?
Quantum computing essentially relies on the fact that qubits maintain multiple possible states simultaneously. Parallel computing too processes multiple states simultaneously. So what is the difference or how are they different?
Raghavendra Singh Dasila
- 151
- 1
- 7
12
votes
1 answer
How can ws with |w| = |s| and w ≠ s be context-free while w#s is not?
Why does (if so) the seperator $\#$ is making a difference between the two languages ?
Let say:
$L=\{ws : |w|=|s| ,\ w,s\in \{0,1\}^{*}, \ w \neq s \}$
$L_{\#}=\{w\#s : |w|=|s|,\ w,s\in \{0,1\}^{*},\ w \neq s \}$
Here is a proof and a grammer…
limitless
- 286
- 1
- 2
- 9
12
votes
1 answer
Remove minimum number of vertices to disconnect the graph
Consider an undirected graph with a source and a sink vertex. We would like to remove minimum number of vertices in that graph to disconnect any path between source and sink.
Can we do this using say a max-flow, min-cut algorithm?
babysnow
- 221
- 1
- 2
- 3
12
votes
2 answers
Why are Linearly Bounded Turing Machines more powerful than Finite State Automata?
I was under the impression that our computers, being finite, are ultimately no more powerful than (extraordinarily large) Finite State Machines. However, Linearly Bounded Turing Machines are also finite, but it seems that Regular Languages are…
Ben I.
- 1,730
- 14
- 26
12
votes
4 answers
Looking for a dictionary of math/CS notation
There is an at-times dizzying array of symbols used in math and CS papers. Yet many assume basic familiarity that seems rarely taught in one place. I am looking for a dictionary something like the following, especially from a CS perspective.
It…
vzn
- 11,162
- 1
- 28
- 52
12
votes
1 answer
Directed union-find
Consider a directed graph $G$ on which one can dynamically add edges and make some specific queries.
Example: disjoint-set forest
Consider the following set of queries:
arrow(u, v)
equiv(u, v)
find(u)
the first one adds an arrow $u→v$ to the graph,…
jmad
- 9,578
- 1
- 40
- 43
12
votes
3 answers
Finding the element that occurs the most in a very large file
I've heard this interview question asked a lot and I was hoping to get some opinions on what good answers might be: You have a large file 10+ GB and you want to find out which element occurs the most, what is a good way to do this?
Iterating and…
Pat
- 121
- 1
- 3
12
votes
5 answers
Data Science vs Operations Research
The general question, as the title suggests, is:
What is the difference between DS and OR/optimization.
On a conceptual level I understand that DS tries to extract knowledge from the available data and uses mostly Statistical, Machine Learning…
PsySp
- 261
- 1
- 2
- 7
12
votes
3 answers
What is complement of Context-free languages?
I need to know what class of CFL is closed under i.e. what set is complement of CFL.
I know CFL is not closed under complement, and I know that P is closed under complement. Since CFL $\subsetneq$ P I can say that complement of CFL is included in…
user432
- 123
- 1
- 1
- 4