Most Popular

1500 questions
15
votes
4 answers

Is there a known polynomial time complexity problem with bad constants?

As you know, big O notation hides all constants. For instance, both runtimes $T_1=n$ and $T_2=10^{10}n$ are considered to be linear ($\mathcal{O(n)}$). Is there an iconic problem whose best known solution has a terrible (large) constant in the…
15
votes
2 answers

Shortest non intersecting path for a graph embedded in a euclidean plane (2D)

What algorithm would you use to find the shortest path of a graph, which is embedded in an euclidean plane, such that the path should not contain any self-intersections (in the embedding)? For example, in the graph below, you want to go from $(0,0)…
15
votes
1 answer

Find the longest path from root to leaf in a tree

I have a tree (in the graph theory sense), such as the following example: This is a directed tree with one starting node (the root) and many ending nodes (the leaves). Each of the edge has a length assigned to it. My question is, how to find the…
Graviton
  • 255
  • 1
  • 4
  • 10
15
votes
1 answer

How to reduce the number of crossing edges in a diagram?

I am working on a diagram editor. Diagrams display 2D shapes (nodes) connected with connectors (edges). I'd like to add an operation that, given a selection of nodes, "disentangles" them: it repositions them to minimize the number of crossing edges,…
reinierpost
  • 6,294
  • 1
  • 24
  • 40
15
votes
5 answers

How is non-ambuiguity different from determinism?

I am trying to understand what is meant by "deterministic" in expressions such as "deterministic context-free grammar". (There are more deterministic "things" in this field). I would appreciate an example more then the most elaborate explanation! If…
wvxvw
  • 1,388
  • 9
  • 13
15
votes
3 answers

Minimal size of contracting a DAG into a new DAG

We have a DAG. We have a function on the nodes $F\colon V\to \mathbb N$ (loosely speaking, we number the nodes). We would like to create a new directed graph with these rules: Only nodes with the same number can be contracted into the same new…
chx
  • 203
  • 1
  • 8
15
votes
1 answer

Why is compression ratio using bzip2 for a sequence of "a"s so jumpy?

library(ggplot2) compress <- function(str) { length(memCompress(paste(rep("a", str), collapse=""), type="bzip2")) / nchar(paste(rep("a", str), collapse="")) } cr <- data.frame(i = 1:10000, r = sapply(1:10000, compress)) ggplot(cr[cr$i>=5000 &…
Raffael
  • 337
  • 2
  • 7
15
votes
4 answers

Quicksort explained to kids

Last year, I was reading a fantastic paper on “Quantum Mechanics for Kindergarden”. It was not easy paper. Now, I wonder how to explain quicksort in the simplest words possible. How can I prove (or at least handwave) that the average complexity is…
15
votes
7 answers

How can a computer deal with real numbers

Computers are an exceptionally powerful tool for various computations, but they don't excel at storing decimal numbers. However, people have managed to overcome these issues: not storing the number in a decimal format, which is limited to very few…
Robert
  • 185
  • 1
  • 5
15
votes
4 answers

Push Down Automatons "guess" - what does that mean?

I realize non-deterministic pushdown automata can be an improvement over deterministic ones as they can "choose" among several states and there are some context-free languages which cannot be accepted by a deterministic pushdown. Still, I do not…
lisa
  • 253
  • 1
  • 6
15
votes
2 answers

How to prove regular languages are closed under left quotient?

$L$ is a regular language over the alphabet $\Sigma = \{a,b\}$. The left quotient of $L$ regarding $w \in \Sigma^*$ is the language $$w^{-1} L := \{v \mid wv \in L\}$$ How can I prove that $w^{-1}L$ is regular?
corium
  • 899
  • 1
  • 8
  • 9
15
votes
2 answers

Is it decidable if a language described by number of occurences is regular?

It is known that the language of words containing equal number of 0 and 1 is not regular, while the language of words containing equal number of 001 and 100 is regular (see here). Given two words $w_1,w_2$, is it decidable if the language of words…
sdcvvc
  • 3,511
  • 19
  • 28
15
votes
1 answer

Who are the legislators of Paxos?

In the seminal distributed systems paper The Part Time Parliament (the Paxos protocol), Leslie Lamport names fictional legislators who are involved in the Paxon parliament protocol. According to this writing, he notes that: I gave the Greek…
Jon Bringhurst
  • 253
  • 1
  • 6
15
votes
2 answers

Correctness-Proof of a greedy-algorithm for minimum vertex cover of a tree

There is a greedy algorithm for finding minimum vertex cover of a tree which uses DFS traversal. For each leaf of the tree, select its parent (i.e. its parent is in minimum vertex cover). For each internal node: if any of its children is not…
e_noether
  • 1,329
  • 2
  • 13
  • 19
15
votes
4 answers

Graph Has Two / Three Different Minimal Spanning Trees?

I'm trying to find an efficient method of detecting whether a given graph G has two different minimal spanning trees. I'm also trying to find a method to check whether it has 3 different minimal spanning trees. The naive solution that I've though…
itamar
  • 293
  • 1
  • 3
  • 6