Most Popular

1500 questions
14
votes
1 answer

If $L$ is a regular language then so is $\sqrt{L}=\{w:ww\in L\}$

I am interested in proving that $\sqrt{L}=\{w:ww\in L\}$ is regular if $L$ is regular but I don't seem to be getting anywhere. If possible I was hoping for a hint to get me going in the right direction. Thank you for your help. My idea for…
14
votes
1 answer

Proof of Karp-Lipton theorem

I am trying to understand the proof of the Karp-Lipton theorem as stated in the book "Computational Complexity: A modern approach" (2009). In particular, this book states the following: Karp-Lipton theorem If NP $\subseteq$ $P_{\backslash poly}$,…
WardL
  • 143
  • 6
14
votes
3 answers

How to create DFA from regular expression without using NFA?

Objective is to create DFA from a regular expression and using "Regular exp>NFA>DFA conversion" is not an option. How should one go about doing that? I asked this question to our professor but he told me that we can use intuition and kindly refused…
user4220128
14
votes
4 answers

What are the advantages of cuckoo hashing over dynamic perfect hashing?

Dynamic perfect hash tables and cuckoo hash tables are two different data structures that support worst-case O(1) lookups and expected O(1)-time insertions and deletions. Both require O(n) auxiliary space and access to families of hash functions for…
templatetypedef
  • 9,302
  • 1
  • 32
  • 62
14
votes
3 answers

What goes wrong with sums of Landau terms?

I wrote $\qquad \displaystyle \sum\limits_{i=1}^n \frac{1}{i} = \sum\limits_{i=1}^n \cal{O}(1) = \cal{O}(n)$ but my friend says this is wrong. From the TCS cheat sheet I know that the sum is also called $H_n$ which has logarithmic growth in $n$. So…
Raphael
  • 73,212
  • 30
  • 182
  • 400
14
votes
1 answer

What is the difference between halting, accepting, and deciding in the context of Turing machines?

Does accepting mean that the TM will read and recognize a char from the cell it's currently reading from? And is it the case that a TM halts iff the input is decidable?
sdfasdgasg
  • 533
  • 2
  • 5
  • 10
14
votes
4 answers

Self-Study of Computer Science

I am a 16 year old male who has recently been gifted a big encyclopedia on computer science by a friend of mine. I am usually not that interested in computers and technology, but computer science has started to fascinate me. I do however intend to…
kamal
  • 149
  • 3
14
votes
3 answers

What is a naive method?

I was researching dynamic programming and read the following: Often when using a more naive method, many of the subproblems are generated and solved many times. What is a naive method?
chopper draw lion4
  • 467
  • 1
  • 6
  • 9
14
votes
4 answers

How to find a minimum cut of a network flow?

I am currently reading the lecture slides from Princeton regarding network flows but I cannot understand how they manage to find out minimum cuts from a directed graph. Could someone explain how to find the minimum cut of this graph? I THINK the…
Kadana Kan
  • 151
  • 1
  • 1
  • 3
14
votes
2 answers

Time complexity of a triple-nested loop

Please consider the following triple-nested loop: for (int i = 1; i <= n; ++i) for (int j = i; j <= n; ++j) for (int k = j; k <= n; ++k) // statement The statement here is executed exactly $n(n+1)(n+2)\over6$ times. Could…
Xin
  • 141
  • 1
  • 1
  • 3
14
votes
1 answer

Counting inversion pairs

A classic application of divide and conquer is to solve the following problem: Given an array $a[1\dots n]$ of distinct, comparable elements, count the number of inversion pairs in the array: pairs $(i,j)$ such that $a[i] \gt a[j]$ and $i \lt…
Aryabhata
  • 6,291
  • 2
  • 36
  • 47
14
votes
1 answer

Floating point rounding

Can an IEEE-754 floating point number < 1 (i.e. generated with a random number generator which generates a number >= 0.0 and < 1.0) ever be multiplied by some integer (in floating point form) to get a number equal to or larger than that integer due…
Cade Roux
  • 323
  • 2
  • 7
14
votes
2 answers

Are all context-free and regular languages efficiently decidable?

I came across this figure which shows that context-free and regular languages are (proper) subsets of efficient problems (supposedly $\mathrm{P}$). I perfectly understand that efficient problems are a subset of all decidable problems because we can…
Gigili
  • 2,213
  • 3
  • 22
  • 31
14
votes
1 answer

For a Turing Machine $M_1$, how is the set of machines $M_2$ which are "shorter" than $M_1$ and which accept the same language decidable?

I wonder how come that the following language is in $\mathrm R$. $L_{M_1}=\Bigl\{\langle M_2\rangle \;\Big|\;\; M_2 \text{ is a TM, and } L(M_1)=L(M_2), \text{ and } |\langle M_1\rangle| > | \langle M_2 \rangle| \Bigr\} $ (I know that it's in…
Jozef
  • 1,727
  • 4
  • 14
  • 22
14
votes
2 answers

Are regex crosswords NP-hard?

I was fooling around the other day on this website: http://regexcrossword.com/ and it got me wondering what the best way to solve it was. Can you solve the following problem in polynomial time or is it NP-hard? Given an NxM grid with N regular…