Most Popular

1500 questions
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,205
  • 4
  • 68
  • 113
53
votes
3 answers

Contrasting Peterson’s and Dekker’s algorithms

I am trying to understand the algorithms by Peterson and Dekker which are very similar and display a lot of symmetries. I tried to formulate the algorithms in informal language like follows: Peterson's: "I want to enter." …
gbag
  • 709
  • 1
  • 6
  • 9
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

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
  • 657
  • 1
  • 5
  • 9
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
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
  • 951
  • 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,107
  • 1
  • 20
  • 38
51
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,077
  • 2
  • 10
  • 8
51
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
  • 715
  • 5
  • 6
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.
  • 159,275
  • 20
  • 227
  • 470
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,066
  • 3
  • 35
  • 63
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,219
  • 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
  • 29,754
  • 5
  • 64
  • 121
49
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,127
  • 1
  • 17
  • 33
48
votes
6 answers

Learning Automated Theorem Proving

I am learning Automated Theorem Proving / SMT solvers / Proof Assistants by myself and post a series of questions about the process, starting here. Note that these topics are not easily digested without a background in (mathematical) logics. If you…
Guy Coder
  • 5,091
  • 2
  • 29
  • 64