Most Popular
1500 questions
54
votes
1 answer
What is the earliest use of the "this" keyword in any programming language?
I understand the this (or self or Me) is used to refer to the current object, and that it is a feature of object-oriented programming languages. The earliest language I could find which has such a concept was Smalltalk, which uses self but was…
huijing
- 651
- 1
- 5
- 7
54
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
- 653
- 1
- 6
- 7
53
votes
1 answer
Show that { xy ∣ |x| = |y|, x ≠ y } is context-free
I remember coming across the following question about a language that supposedly is context-free, but I was unable to find a proof of the fact. Have I perhaps misremembered the question?
Anyway, here's the question:
Show that the language $L = \{xy…
Dave Clarke
- 20,345
- 4
- 70
- 114
53
votes
6 answers
Keeping a String Secret in (Open) Source Code
I have finished developing an app for Android and intend to publish it with GPL -- I want it to be open source.
However, the nature of the application (a game) is that it asks riddles and has the answers coded into the string resource. I can't…
Nevermore
- 667
- 1
- 5
- 9
53
votes
2 answers
Is a push-down automaton with two stacks equivalent to a turing machine?
In this answer it is mentioned
A regular language can be recognized by a finite automaton. A context-free language requires a stack, and a context sensitive language requires two stacks (which is equivalent to saying it requires a full Turing…
Lazer
- 1,107
- 2
- 10
- 8
52
votes
10 answers
If the speed of electrical charge hasn't changed, how have computers become faster?
Everyone knows computing speed has drastically increased since their invention, and it looks set to continue. But one thing is puzzling me: if you ran an electrical current through a material today, it would travel at the same speed as if you did it…
leylandski
- 653
- 6
- 7
52
votes
6 answers
Dealing with intractability: NP-complete problems
Assume that I am a programmer and I have an NP-complete problem that I need to solve it. What methods are available to deal with NPC problems? Is there a survey or something similar on this topic?
Anonymous
- 621
- 7
- 5
52
votes
1 answer
What makes type inference for dependent types undecidable?
I have seen it mentioned that dependent type systems are not inferable, but are checkable. I was wondering if there is a simple explanation of why that is so, and whether or not there is there a limit of "dependency" where types can be indexed by…
Victor
- 725
- 5
- 6
51
votes
4 answers
Theoretical machines which are more powerful than Turing machines
Are there any theoretical machines which exceed Turing machines capability in at least some areas?
user1561358
- 961
- 1
- 8
- 10
51
votes
12 answers
How to verify number with Bob without Eve knowing?
You need to check that your friend, Bob, has your correct phone number, but you cannot ask him directly. You must write the question on a card which and give it to Eve who will take the card to Bob and return the answer to you. What must you write…
Joe
- 4,105
- 1
- 21
- 38
50
votes
6 answers
How to prove greedy algorithm is correct
I have a greedy algorithm that I suspect might be correct, but I'm not sure. How do I check whether it is correct? What are the techniques to use for proving a greedy algorithm correct? Are there common patterns or techniques?
I'm hoping this…
D.W.
- 167,959
- 22
- 232
- 500
50
votes
9 answers
Does there exist a priority queue with $O(1)$ extracts?
There are a great many data structures that implement the priority-queue interface:
Insert: insert an element into the structure
Get-Min: return the smallest element in the structure
Extract-Min: remove the smallest element in the structure
Common…
Alex ten Brink
- 9,206
- 3
- 36
- 63
50
votes
4 answers
Why can humans solve certain "undecidable" problems?
High-order pattern matching is an undecidable problem. That means there is no algorithm that, given an equation a => b, where a and b are open terms on the simply typed lambda calculus, finds a substitution S such that aS => bS, where => stands for…
MaiaVictor
- 4,199
- 2
- 18
- 34
50
votes
3 answers
Why does Dijkstra's algorithm fail on a negative weighted graphs?
I know this is probably very basic, I just can't wrap my head around it.
We recently studied about Dijkstra's algorithm for finding the shortest path between two vertices on a weighted graph.
My professor said this algorithm will not work on a graph…
so.very.tired
- 1,259
- 1
- 15
- 20
50
votes
2 answers
What is the difference between an algorithm, a language and a problem?
It seems that on this site, people will often correct others for confusing "algorithms" and "problems." What are the difference between these? How do I know when I should be considering algorithms and considering problems? And how do these relate to…
Joey Eremondi
- 30,277
- 5
- 67
- 122