Most Popular

1500 questions
35
votes
14 answers

Criteria for selecting language for first programming course

As a university-level CS educator, the issue of which programming language to teach in the first programming course often comes up for discussion. There are thousands of languages to choose between, and lots of religious fever (or fevour) supporting…
Dave Clarke
  • 20,205
  • 4
  • 68
  • 113
35
votes
9 answers

What is the significance of context-sensitive (Type 1) languages?

Seeing that in the Chomsky Hierarchy Type 3 languages can be recognised by a state machine with no external memory (i.e., a finite automaton), Type 2 by a state machine with a single stack (i.e. a push-down automaton) and Type 0 by a state machine…
bitmask
  • 1,755
  • 2
  • 16
  • 20
35
votes
6 answers

Do lossless compression algorithms reduce entropy?

According to Wikipedia: Shannon's entropy measures the information contained in a message as opposed to the portion of the message that is determined (or predictable). Examples of the latter include redundancy in language structure or statistical…
robert
  • 453
  • 4
  • 8
34
votes
5 answers

Adding elements to a sorted array

What would be the fastest way of doing this (from an algorithmic perspective, as well as a practical matter)? I was thinking something along the following lines. I could add to the end of an array and then use bubblesort as it has a best case…
soandos
  • 1,143
  • 2
  • 10
  • 23
34
votes
2 answers

Is there a task that is solvable in polynomial time but not verifiable in polynomial time?

A colleague of mine and I have just hit some notes of one of our professors. The notes state that there are tasks that are possible to solve in polynomial time (are in the class of PF) but that are NOT verifiable in polynomial time (are NOT in the…
Drozi
  • 341
  • 3
  • 3
34
votes
5 answers

How do computers remember where they store things?

When a computer stores a variable, when a program needs to get the variable's value, how does the computer know where to look in memory for that variable's value?
MCMastery
  • 451
  • 1
  • 4
  • 6
34
votes
1 answer

What does tilde mean, in big-O notation?

I'm reading a paper, and it says in its time complexity description that time complexity is $\tilde{O}(2^{2n})$. I have searched the internet and wikipedia, but I can't find what this tilde signifies in big-O/Landau notation. In the paper itself I…
34
votes
6 answers

Differences and relationships between randomized and nondeterministic algorithms?

What differences and relationships are between randomized algorithms and nondeterministic algorithms? From Wikipedia A randomized algorithm is an algorithm which employs a degree of randomness as part of its logic. The algorithm typically uses …
Tim
  • 4,875
  • 5
  • 36
  • 71
34
votes
5 answers

Is there an anti-Bloom filter?

A Bloom filter makes it possible to efficiently keep track of whether various values have already been encountered during processing. When there are many data items then a Bloom filter can result in a significant memory saving over a hash table. …
András Salamon
  • 3,462
  • 1
  • 20
  • 35
34
votes
4 answers

How to prove that a grammar is unambiguous?

My problem is how can I prove that a grammar is unambiguous? I have the following grammar: $$S → statement ∣ \mbox{if } expression \mbox{ then } S ∣ \mbox{if } expression \mbox{ then } S \mbox{ else } S$$ and make this to an unambiguous grammar, I…
user1594
  • 541
  • 1
  • 6
  • 9
34
votes
8 answers

What is most efficient for GCD?

I know that Euclid’s algorithm is the best algorithm for getting the GCD (great common divisor) of a list of positive integers. But in practice you can code this algorithm in various ways. (In my case, I decided to use Java, but C/C++ may be another…
Jonathan Prieto-Cubides
  • 2,219
  • 3
  • 18
  • 26
34
votes
3 answers

Why is Relativization a barrier?

When I was explaining the Baker-Gill-Solovay proof that there exists an oracle with which we can have, $\mathsf{P} = \mathsf{NP}$, and an oracle with which we can have $\mathsf{P} \neq \mathsf{NP}$ to a friend, a question came up as to why such…
Nikhil
  • 609
  • 6
  • 12
34
votes
8 answers

why don't we use machines with random access memory as our basic model of computation?

Turing machines are perhaps the most popular model of computation for theoretical computer science. Turing machines don't have random access memory, since we can only do a read where the slider is currently located. This seem unwieldy to me. Why…
user56834
  • 3,722
  • 4
  • 18
  • 32
34
votes
2 answers

What is the difference between user-level threads and kernel-level threads?

After reading several sources I'm still confused about user- and kernel-level threads. In particular: Threads can exist at both the user level and the kernel level What is the difference between the user level and kernel level?
Sheldon
  • 803
  • 2
  • 9
  • 16
33
votes
2 answers

Optimization version of decision problems

It is known that each optimization/search problem has an equivalent decision problem. For example the shortest path problem optimization/search version: Given an undirected unweighted graph $G = (V, E)$ and two vertices $v,u\in V$, find a…
bek