Most Popular
1500 questions
65
votes
4 answers
What exactly is the semantic difference between set and type?
EDIT: I've now asked a similar question about the difference between categories and sets.
Every time I read about type theory (which admittedly is rather informal), I can't really understand how it differs from set theory, concretely.
I understand…
user56834
- 4,244
- 5
- 21
- 35
65
votes
11 answers
Human computing power: Can humans decide the halting problem on Turing Machines?
We know the halting problem (on Turing Machines) is undecidable for Turing Machines. Is there some research into how well the human mind can deal with this problem, possibly aided by Turing Machines or general purpose computers?
Note: Obviously, in…
bitmask
- 1,765
- 2
- 16
- 20
65
votes
8 answers
What is a the fastest sorting algorithm for an array of integers?
I have come across many sorting algorithms during my high school studies. However, I never know which is the fastest (for a random array of integers). So my questions are:
Which is the fastest currently known sorting algorithm?
Theoretically, is it…
gen
- 991
- 1
- 8
- 15
64
votes
6 answers
If everyone believes P ≠ NP, why is everyone sceptical of proof attempts for P ≠ NP?
Many seem to believe that $P\ne NP$, but many also believe it to be very unlikely that this will ever be proven. Is there not some inconsistency to this? If you hold that such a proof is unlikely, then you should also believe that sound arguments…
pafnuti
- 739
- 1
- 5
- 7
64
votes
8 answers
Algorithmic intuition for logarithmic complexity
I believe I have a reasonable grasp of complexities like $\mathcal{O}(1)$, $\Theta(n)$ and $\Theta(n^2)$.
In terms of a list, $\mathcal{O}(1)$ is a constant lookup, so it's just getting the head of the list.
$\Theta(n)$ is where I'd walk the entire…
Khanzor
- 1,471
- 1
- 13
- 11
64
votes
4 answers
Why are Red-Black trees so popular?
It seems that everywhere I look, data structures are being implemented using red-black trees (std::set in C++, SortedDictionary in C#, etc.)
Having just covered (a,b), red-black & AVL trees in my algorithms class, here's what I got out (also from…
Jakub Arnold
- 877
- 1
- 7
- 9
63
votes
10 answers
What is a safe programming language?
Safe programming languages (PL) are gaining popularity. What is the formal definition of safe PL? For example, C is not safe, but Java is safe. I suspect that the property “safe” should be applied to a PL implementation rather than to the PL itself.…
beroal
- 781
- 1
- 5
- 12
63
votes
14 answers
How can I explain to my parents that I study programming languages?
I am currently finishing my MSc in computer science. I am interested in programming languages, especially in type systems. I got interested in research in this field and next semester I will start a PhD on the subject.
Now here is the real question:…
effeffe
- 741
- 1
- 5
- 10
63
votes
3 answers
What exactly is polynomial time?
I'm trying to understand algorithm complexity, and a lot of algorithms are classified as polynomial. I couldn't find an exact definition anywhere. I assume it is the complexity that is not exponential.
Do linear/constant/quadratic complexities…
Oleksiy
- 733
- 1
- 5
- 6
62
votes
5 answers
Is zero allowed as an edge's weight, in a weighted graph?
I am trying to write a script that generates random graphs and I need to know if an edge in a weighted graph can have the 0 value.
actually it makes sense that 0 could be used as an edge's weight, but I've been working with graphs in last few days…
Taxellool
- 739
- 1
- 5
- 6
62
votes
6 answers
Why do we not combine random number generators?
There are many applications where a pseudo random number generator is used. So people implement one that they think is great only to find later that it's flawed. Something like this happened with the Javascript random number generator recently. …
Paul Uszak
- 1,602
- 1
- 13
- 21
61
votes
7 answers
Is a Turing Machine "by definition" the most powerful machine?
I agree that a Turing Machine can do "all possible mathematical problems". But that is because it is just a machine representation of an algorithm: first do this, then do that, finally output that.
I mean anything that is solvable can be…
Sounak Bhattacharya
- 667
- 1
- 6
- 5
61
votes
8 answers
Is Morse code without spaces uniquely decipherable?
Are all Morse code strings uniquely decipherable? Without the spaces,
......-...-..---.-----.-..-..-..
could be Hello World but perhaps the first letter is a 5 -- in fact it looks very unlikely an arbitrary sequence of dots and dashes should have…
john mangual
- 1,951
- 1
- 21
- 27
60
votes
3 answers
Why is binary search faster than ternary search?
Searching an array of $N$ elements using binary search takes, in the worst case $\log_2 N$ iterations because, at each step we trim half of our search space.
If, instead, we used 'ternary search', we'd cut away two-thirds of our search space at…
The Mean Square
- 778
- 1
- 5
- 14
60
votes
5 answers
Factorial algorithm more efficient than naive multiplication
I know how to code for factorials using both iterative and recursive (e.g. n * factorial(n-1) for e.g.). I read in a textbook (without been given any further explanations) that there is an even more efficient way of coding for factorials by dividing…
user65165
- 745
- 1
- 7
- 7