Most Popular

1500 questions
14
votes
3 answers

Dijkstra's algorithm on huge graphs

I am very familiar with Dijkstra and I have a specific question about the algorithm. If I have a huge graph, for example 3.5 billion nodes (all OpenStreetMap data) then I clearly wouldn't be able to have the graph in memory, so the graph is stored…
dimitris93
  • 335
  • 3
  • 9
14
votes
2 answers

Why can't we find shortest paths with negative weights by just adding a constant so that all weights are positive?

I'm currently reading introduction to algorithms and came by Johnson’s algorithm that depends on making sure that all paths are positive. the algo depends on finding a new weight function (w') that is positive for all edges and keeps the correctness…
Mr.Me
  • 243
  • 1
  • 2
  • 7
14
votes
5 answers

What is the difference between $\log^2(n)$, $\log(n)^2$, $(\log n)^2$, $\log (n^2)$ and $\log \log n$?

In research articles (e.g. this one's abstract), I often see the complexity of an algorithm expressed using a somewhat ambiguous notation: $\log^2(n) = ?$ $\log(n)^2 = ?$ $(\log n)^2 = (\log(n)) \times (\log(n))$ $\log(n^2) =…
Suzanne Soy
  • 251
  • 1
  • 2
  • 5
14
votes
3 answers

How to prove P$\neq$NP?

I am aware that this seems a very stupid (or too obvious to state) question. However, I am confused at some point. We can show that P $=$ NP if and only if we can design an algorithm that solves any given instance of problem in NP in polynomial…
padawan
  • 1,455
  • 1
  • 12
  • 30
14
votes
5 answers

Daily Applications of Type Theory

I want to understand type theory but I have to know first how I can apply it. Could there be more non-obvious applications of type theory aside from in type systems in programming? Could there be other applications, let's say in personality…
14
votes
1 answer

If $n^{\log n}$ is not polynomial or exponential, then what this function is called?

I just found this sentence on page 6 of Garey and Johnson's "Computers and Intractability". Any algorithm whose time complexity function cannot be so bounded is called an exponential time algorithm (although it should be noted that this definition…
user777
  • 759
  • 4
  • 20
14
votes
3 answers

How much complexity difference can there be between finding a solution to a Sudoku puzzle and PROVING that the solution is the unique solution?

So usually Sudoku is $9 \times 9$, but this question extends to $n^2 \times n^2$ puzzles with $n > 3$ as well. There are many polynomial time deduction rules that can make progress in finding a solution to a Sudoku puzzle. But then sometimes…
user2566092
  • 1,741
  • 10
  • 18
14
votes
2 answers

Are CPU architectures biased towards procedural runtimes?

Are there any changes that could be made to CPUs to make them perform better for concurrent runtimes like Rust? For instance, are there changes to branch prediction implementations or cache sizes that would help concurrent runtimes? I have the…
14
votes
3 answers

undecidable problem and its negation is undecidable

A lot of "famous" undecidable problems are nonetheless at least semidecidable, with their complement being undecidable. One example above all can be the halting problem and its complement. However, can anybody give me an example in which both a…
14
votes
1 answer

Difference between regular expression and grammar in automata

I am new to automata, and I have been given a brief introduction to regular expressions only yesterday. I have read the various rules which to define a regular expression. But I am unable to differentiate between regular expressions and grammar of a…
Charu Bansal
  • 143
  • 1
  • 1
  • 8
14
votes
1 answer

Is determining if there is a prime in an interval known to be in P or NP-complete?

I saw from this post on stackoverflow that there are some relatively fast algorithms for sieving an interval of numbers to see if there is a prime in that interval. However, does this mean that the overall decision problem of: (Does there exists a…
Ari
  • 1,661
  • 10
  • 23
14
votes
2 answers

Can someone explain this diagram about Slab Allocation?

I'm trying to understand how Slab Allocation works and why it is different or better than ordinary paging. I found this diagram which I believe would be helpful if it had more explanation. Some questions: What do the 3KB and 7KB items represent?…
CodyBugstein
  • 3,017
  • 11
  • 31
  • 46
14
votes
1 answer

Why do Shaefer's and Mahaney's Theorems not imply P = NP?

I'm sure someone has thought about this before or immediately dismissed it, but why does Schaefer's dichotomy theory along with Mahaney's theorem on sparse sets not imply P = NP ? Here's my reasoning: Create a language $L$ which is equal to SAT…
Ari
  • 1,661
  • 10
  • 23
14
votes
3 answers

Is 2-SAT with XOR-relations NP-complete?

I'm wondering if there is a polynomial algorithm for "2-SAT with XOR-relations". Both 2-SAT and XOR-SAT are in P, but is its combination? Example Input: 2-SAT part: (a or !b) and (b or c) and (b or d) XOR part : (a xor b xor c xor 1) and (b xor c…
Albert Hendriks
  • 2,481
  • 16
  • 35
14
votes
1 answer

Approximation of minimum bandwidth on binary trees

Minimum bandwidth problem is to a find an ordering of graph nodes on integer line that minimizes the largest distance between any two adjacent nodes. The decision problem is NP-complete even for binary trees. Complexity Results for Bandwidth…