Most Popular
1500 questions
48
votes
4 answers
How do O and Ω relate to worst and best case?
Today we discussed in a lecture a very simple algorithm for finding an element in a sorted array using binary search. We were asked to determine its asymptotic complexity for an array of $n$ elements.
My idea was, that it is obvisously $O(\log n)$,…

Smajl
- 1,035
- 3
- 14
- 19
48
votes
8 answers
The math behind converting from any base to any base without going through base 10?
I've been looking into the math behind converting from any base to any base. This is more about confirming my results than anything. I found what seems to be my answer on mathforum.org but I'm still not sure if I have it right. I have the…

Griffin
- 593
- 1
- 5
- 7
48
votes
10 answers
O(·) is not a function, so how can a function be equal to it?
I totally understand what big $O$ notation means. My issue is when we say $T(n)=O(f(n))$ , where $T(n)$ is running time of an algorithm on input of size $n$.
I understand semantics of it. But $T(n)$ and $O(f(n))$ are two different things.
$T(n)$ is…

doubleE
- 591
- 1
- 4
- 8
47
votes
2 answers
How does the Y combinator exemplify "Lambda calculus inconsistency"?
On the Wikipedia page for Fixed Point Combinators is written the rather mysterious text
The Y combinator is an example of what makes the Lambda calculus inconsistent. So it should be regarded with suspicion. However it is safe to consider the Y…

Ben I.
- 1,710
- 14
- 26
47
votes
2 answers
Order of growth definition from Reynolds & Tymann
I am reading a book called Principles of Computer Science (2008), by Carl Reynolds and Paul Tymann (published by Schaum's Outlines).
The second chapter introduces algorithms with an example of a sequential search which simply iterates through a list…

JW.
- 581
- 4
- 7
47
votes
12 answers
Can a computer determine whether a mathematical statement is true or not?
I was reading Introduction to the Theory of Computation by Michael Sipser and I found the following paragraph quite interesting:
During the first half of the twentieth century, mathematicians such as Kurt
Godel, Alan Turing, and Alonzo Church…

Arsalan MGR
- 581
- 1
- 4
- 6
47
votes
4 answers
Longest path in an undirected tree with only one traversal
There is this standard algorithm for finding longest path in undirected trees using two depth-first searches:
Start DFS from a random vertex $v$ and find the farthest vertex from it; say it is $v'$.
Now start a DFS from $v'$ to find the vertex…

e_noether
- 1,289
- 2
- 12
- 19
46
votes
5 answers
Iteration can replace Recursion?
I've been seeing all over stack Overflow, e.g here, here, here, here, here and some others I don't care to mention, that "any program that uses recursion can be converted to a program using only iteration".
There was even a highly upvoted thread…

Tobi Alafin
- 1,617
- 3
- 16
- 22
46
votes
6 answers
Can a public key be used to decrypt a message encrypted by the corresponding private key?
From what I have seen about usage of a pair of public and private keys, the public key is used for encrypting a message, and the private key is used for decrypting the encrypted message.
If a message is encrypted by the private key, can it be…

Tim
- 4,875
- 5
- 36
- 71
46
votes
5 answers
Why has research on genetic algorithms slowed?
While discussing some intro level topics today, including the use of genetic algorithms; I was told that research has really slowed in this field. The reason given was that most people are focusing on machine learning and data mining.
Update: Is…

FossilizedCarlos
- 571
- 1
- 5
- 8
46
votes
2 answers
Perplexed by Rice's theorem
Summary: According to Rice's theorem, everything is impossible. And yet, I do this supposedly impossible stuff all the time!
Of course, Rice's theorem doesn't simply say "everything is impossible". It says something rather more specific: "Every…

MathematicalOrchid
- 867
- 8
- 13
45
votes
2 answers
What is the difference between radix trees and Patricia tries?
I am learning about radix trees (aka compressed tries) and Patricia tries, but I am finding conflicting information on whether or not they are actually the same. A radix tree can be obtained from a normal (uncompressed) trie by merging nodes with…

w128
- 553
- 1
- 4
- 9
45
votes
7 answers
Is there anything that MUST be done on a multi-core CPU?
When considering how multi-thread-friendly our program must be, my team puzzled about whether there's anything that absolutely cannot be done on a single-core CPU. I posited that graphics processing requires massively parallel processing, but they…

Ky -
- 599
- 1
- 4
- 9
45
votes
5 answers
Difference between Parallel and Concurrent programming?
When looking at concurrent programming, two terms are commonly used i.e. concurrent and parallel.
And some programming languages specifically claim support for parallel programming, such as Java.
Does this means parallel and concurrent programming…

nish1013
- 561
- 1
- 5
- 5
45
votes
9 answers
Is UTF-8 the final character encoding for all future time?
It seems to me that Unicode is the "final" character encoding. I cannot imagine anything else replacing it at this point. I'm frankly confused about why UTF-16 and UTF-32 etc. exist at all, not to mention all the non-Unicode character encodings…

Timone
- 459
- 4
- 3