Most Popular

1500 questions
12
votes
1 answer

How to find a "short" walk that visits all vertices of a strongly connected directed graph

I am interested in the following algorithmic problem: Given a strongly connected directed graph $G$, I want a "short" (see below for what I mean by short) walk that starts with an arbitrary vertex $s$ and contains all vertices of $G$. Deciding if…
Michal Dvořák
  • 575
  • 2
  • 15
12
votes
5 answers

pick K random integers without repetition

Suppose we've to pick $K (\le N)$ random integers in the range $[0, N - 1]$ for very large $N$ such that there is no repetition, while also deterministically minimizing the number of calls made to the $rand()$ function. How would we do it? Assume…
bihariforces
  • 333
  • 7
12
votes
3 answers

Minimum number of clues to fully specify any sudoku?

We know from this paper that there does not exist a puzzle that can be solved starting with 16 or fewer clues, but it implies that there does exist a puzzle that can be solved from 17 clues. Can all valid sudoku puzzles be specified in 17 clues? If…
Kevin
  • 1,082
  • 10
  • 22
12
votes
2 answers

How do I test if a polygon is monotone with respect to a line?

It's well known that monotone polygons play a crucial role in polygon triangulation. Definition: A polygon $P$ in the plane is called monotone with respect to a straight line $L$, if every line orthogonal to $L$ intersects $P$ at most…
com
  • 3,179
  • 2
  • 24
  • 38
12
votes
4 answers

Operations under which the class of undecidable languages isn't closed

Do there exist undecidable languages such that their union/intersection/concatenated language is decidable? What is the physical interpretation of such example because in general, undecidable languages are not closed under these operations? What can…
user1284
12
votes
3 answers

All NP problems reduce to NP-complete problems: so how can NP problems not be NP-complete?

My book states this If a decision problem B is in P and A reduces to B, then decision problem A is in P. A decision problem B is NP-complete if B is in NP and for every problem in A in NP, A reduces to B. A decision problem C is…
rubixibuc
  • 233
  • 1
  • 2
  • 6
12
votes
4 answers

Is there an algorithm whose time complexity is between polynomial time and exponential time?

We often hear about some algorithms' running time that is polynomial, and some algorithms' running time that is exponential. But is there an algorithm whose time complexity is between polynomial time and exponential time?
lz9866
  • 315
  • 2
  • 6
12
votes
8 answers

Can any known sub-Turing-complete model of computation enumerate precisely the set of prime numbers?

I wish there were more, but the subject pretty much captures my whole question. Is there a non-Turing-complete model (some constrained term rewriting system or automaton or what have you) which is known to be able to enumerate the prime numbers, all…
Trev
  • 296
  • 2
  • 10
12
votes
1 answer

NTIME(f) subset of DSPACE(f)

As the question states, how do we prove that $\textbf{NTIME}(f(n)) \subseteq \textbf{DSPACE}(f(n))$? Can anyone point me to a proof or outline it here? Thanks!
gdiazc
  • 221
  • 1
  • 4
12
votes
3 answers

Is it possible to prove thread safety?

Given a program consisting of variables and instructions which modify these variables, and a synchronization primitive (a monitor, mutex, java's synchronized or C#'s lock), is it possible to prove that such a program is thread safe? Is there even a…
Emiswelt
  • 222
  • 1
  • 7
12
votes
2 answers

Simple graph canonization algorithm

I'm looking for an algorithm that provides a canonical string for a given colored graph. Ie. an algorithm that returns a string for a graph, such that two graphs get the same string if and only if they are isomorphic. In particular, I'm looking for…
Peter
  • 1,505
  • 14
  • 20
12
votes
2 answers

What is the closure of context-free languages under finite intersections?

Famously the intersection of context-free languages need not be context-free. On the other hand the intersection of context-sensitive languages is context-sensitive. So this leads to the question: what is the closure of context-free languages under…
gewo
  • 121
  • 2
12
votes
3 answers

How can I quickly judge whether matrix A is the inverse matrix of B?

How can I quickly judge whether matrix A is the inverse matrix of B? This is an exercise for the course I take. This question is given in the section of randomized algorithms. So I think its solution may be related to randomized algorithms.
t24akeru
  • 155
  • 1
  • 7
12
votes
3 answers

What data structure would efficiently store integer ranges?

I need to keep a collection on integers in the range 0 to 65535 so that I can quickly do the following: Insert a new integer Insert a range of contiguous integers Remove an integer Remove all integers below an integer Test if an integer is…
WilliamKF
  • 427
  • 1
  • 7
  • 14
12
votes
2 answers

How is conditional jump implemented in the CPU?

After reading the question I'm still not sure how CPU does branching. I understand that we have an instruction counter which points to the current instruction. And after performing conditional jump it either stays the same (increments as usual) or…
LNK
  • 239
  • 2
  • 5