Most Popular

1500 questions
12
votes
3 answers

Why is DFS considered to have $O(bm)$ space complexity?

According to these notes, DFS is considered to have $O(bm)$ space complexity, where $b$ is the branching factor of the tree and $m$ is the maximum length of any path in the state space. The same is said in this Wikibook page on Uninformed…
user20691
12
votes
3 answers

Modifying Dijkstra's algorithm for edge weights drawn from range $[1,…,K]$

Suppose I have a directed graph with edge weights drawn from range $[1,\dots, K]$ where $K$ is constant. If I'm trying to find the shortest path using Dijkstra's algorithm, how can I modify the algorithm / data structure and improve the time…
user1675999
  • 1,027
  • 6
  • 15
  • 23
12
votes
3 answers

Chaitin's constant is normal?

According to this source, Chaitin's constant $\Omega$ is normal. Each halting probability is a normal and transcendental real number that is not computable, which means that there is no algorithm to compute its digits. Indeed, each halting…
Anon21
  • 345
  • 1
  • 9
12
votes
1 answer

Is packing a bag of presents easier for Rupert than Santa?

Or: Do we need Rupert in order to get presents at all? Routing issues aside, Santa faces the following problem (many, many times over): Given a bag with capacity¹ $C$ and a set of presents $\{p_1, \dots, p_n\}$, each with size $s_i$, he wants to…
Raphael
  • 72,336
  • 29
  • 179
  • 389
12
votes
2 answers

Does linear programming admit a strongly polynomial-time algorithm?

The linear programming problem: find a strongly-polynomial time algorithm which for given matrix A ∈ Rm×n and b ∈ Rm decides whether there exists x ∈ Rn with Ax ≥ b. I know that Steve Smale's lists some of the unsolved problems in mathematics. But…
Krebto
  • 234
  • 3
  • 13
12
votes
1 answer

Simplest complete combinator basis pair for flat expressions

In Chris Okasaki's paper "Flattening Combinators: Surviving Without Parentheses" he shows that two combinators are both sufficient and necessary as a basis to encode Turing-complete expressions without the need for an application operator or…
user23893
12
votes
5 answers

How to find the maximal set of elements $S$ of an array such that every element in $S$ is greater than or equal to the cardinality of $S$?

I have an algorithmic problem. Given an array (or a set) $T$ of $n$ nonnegative integers. Find the maximal set $S$ of $T$ such that for all $a\in S$, $a\geqslant |S|$. For example: If $T$=[1, 3, 4, 1, 3, 6], then $S$ can be [3, 3, 6] or [3, 4, 6]…
drzbir
  • 990
  • 9
  • 22
12
votes
3 answers

Trying to understand this Quicksort Correctness proof

This proof is a proof by induction, and goes as follows: P(n) is the assertion that "Quicksort correctly sorts every input array of length n." Base case: every input array of length 1 is already sorted (P(1) holds) Inductive step: fix n => 2. Fix…
FrostyStraw
  • 383
  • 1
  • 2
  • 11
12
votes
0 answers

Is extensionality for coinductive datatypes consistent with Coq's logic?

Given a coinductive datatype, one can usually (always?) define a bisimulation as the largest equivalence relation over it. I would like to add an axiom stating that if two members of the type are related by the bisimulation, they are equal in the…
Jannis Limperg
  • 241
  • 1
  • 5
12
votes
1 answer

Treewidth of k x k square grid graphs

According to some slides I found on google, the treewidth of any $k \times k$ square grid graph $G$ is $tw(G) = k$. I just started researching about treewidth and tree decomposition, and for the most part it makes sense. However, I am particularly…
saltthehash
  • 293
  • 2
  • 7
12
votes
1 answer

Find shortest paths in a weighed unipathic graph

A directed graph is said to be unipathic if for any two vertices $u$ and $v$ in the graph $G=(V,E)$, there is at most one simple path from $u$ to $v$. Suppose I am given a unipathic graph $G$ such that each edge has a positive or negative weight,…
gprime
  • 467
  • 1
  • 4
  • 13
12
votes
1 answer

Is there a data-structure for semilattices similar to a tree data-structure?

If we regard a tree as a partial ordered set, it becomes a special case of a join-semilattice. For a join-semilattice, we want to be able to compute the (unique) least upper bound of two elements (more or less) efficiently. In the case of a tree, a…
Thomas Klimpel
  • 5,380
  • 27
  • 66
12
votes
4 answers

Can every self-modifying algorithm be modelled by a non-selfmodifying algorithm?

If we have any arbitrary computer program that can modify its instructions, is it possible to simulate that program with a program that cannot modify its instructions? Edit: I am new to stackexchange so not sure if I'm allowed to ask a NEW question…
user56834
  • 3,722
  • 4
  • 18
  • 32
12
votes
5 answers

Why is b-tree search O(log n)?

B-tree is a data structure, which looks like this: If I want to look for some specific value in this structure, I need to go through several elements in root to find the right child-node. The I need to go through several elements in the child-node…
Eenoku
  • 242
  • 1
  • 2
  • 10
12
votes
1 answer

Can a RAM calculate its own Gödel number?

You can get the Gödel number of a RAM by making it a list of commands and making this list an integer. So, what I thought is something like "The RAM that would return its own Gödel number (say, $x$) would have to have the information $x$ in it, so…
palsch
  • 223
  • 1
  • 7