Questions tagged [check-my-answer]

Questions asking us to check whether your solution is correct only are considered off-topic (per http://meta.cs.stackexchange.com/questions/597/). Please pinpoint your doubt and provide a specific question to which a meaty answer can resolve your doubt whether your answer is correct or not.

112 questions
10
votes
0 answers

Can we say McCarthy and Hoare had the same objective in the 60s regarding a mathematical theory of computation?

I don't think there's any way to ask a very precise question here, so this might be considered opinion based. Nevertheless, it seems the question is clear enough because I'm asking whether these two initial steps towards a theory are trying to…
R. Chopin
  • 237
  • 1
  • 9
7
votes
2 answers

Existence of Efficient Set Difference Algorithm

As a foreword, I'm not asking what the algorithm is, just whether one can possibly exist (though, if it does already exist and someone knows what it is, that'd be great). Basically, given two sets $S$ and $T$, I want to compute the two set…
Drew McGowen
  • 223
  • 2
  • 7
5
votes
1 answer

Simpler proof of Rabin's Compression Theorem?

I was doing a presentation on Rabin's Compression Theorem, when someone in the audience brought up a point I have no answer to. Rabin's Compression Theorem states that every reasonable complexity class has a problem that can be solved optimally in…
5
votes
3 answers

If $f$ and $g$ are increasing functions, are we guaranteed that $f=O(g)$ or $g=O(f)$?

Given two increasing functions $f$ and $g$ with values in the natural numbers, is it always the case that either $f\in O(g)$ or $g\in O(f)$. If the statement is true, then can anyone provide a counterexample for when any of the two conditions in…
Andrew Brick
  • 263
  • 1
  • 2
  • 8
5
votes
0 answers

Prove: Self-organizing list that uses Move-to-Front is 2-Competitive

Preparing for my finals in my "advances algorithms" course. Usually there is a question to prove one of the theorems that was given over the course. I'm currently trying to write a full proof of the following statement: Self-organizing list that…
5
votes
2 answers

String of minimum length in $\{a, b\}^*$ not in a regular expression

I'm doing an exercise in my book, the question is to find a string of minimum length in $\{a, b\}^*$ not in the language corresponding to the given regular expression. a. $b^*(ab)^*a^*$ My answer: $aab$ b. $(a^* + b^*)(a^* + b^*)(a^* + b^*)$ My…
4
votes
1 answer

Prove: if $\delta_D(q0, w) = p$ then $\delta_N(q0, w) = {p}$

In my textbook, it presents the theorem, "A language L is accepted by some DFA if and only if l is accepted by some NFA". My textbook explains that the "if" portion of the proof is given by the subset construction and theorem if $D=(Q_D, \sigma,…
maddie
  • 237
  • 3
  • 11
4
votes
2 answers

Solve recurrence relations

A) Solve this recurrence where $T(0)=0$ and write it in O-notation: $T(n)= {2 \over n} (T(0)+T(1)+...+T(n-1))+c$ So, I started to calculate: $T(1)=2(0)+c=c$ $T(2)=1(0+c)+c=2c$ and so on, which gives me that $T(n)=nc$ This I can prove by…
Wanderer
  • 289
  • 1
  • 3
  • 8
4
votes
2 answers

Proof for LeetCode: 11. Container With Most Water problem

UPDATE: I abandoned this initial approach in favor of a more powerful invariant I worked out after posting. I've detailed that one in an answer below. I'm new to algorithm correctness proof-writing but am keen to improve my skill there. I have a…
scanny
  • 206
  • 1
  • 7
3
votes
1 answer

Context Free Grammar for language L

Can someone help with this: $L=\{a^ib^j \mid i,j \ge 1 \text{ and } i \ne j \text{ and } i<2j\}$ I'm trying to write a grammar for this language? I tried this: $S \to S_1 \mid S_2 \\ S_1 \to aXb \\ X \to aXb \mid aaXb \mid aab \\ S_2 \to aYb \\ Y…
3
votes
1 answer

Any finite Graph G with all V have at least degree of 2, is it true that every vertex is necessarily contained IN a cycle?

As title, (note: this questions is asking weather or not all vertices are contained IN a cycle not asking if the G contains a cycle. My attempt is that: So this graph would be an counter example that disprove that every vertex is contained in a…
user94430
3
votes
2 answers

If $L$ is a regular language, how to prove $L_1 = \{ uv \mid u \in L, |v| =2 \}$ is also regular?

If $L$ is a regular language, prove that the language $L_1 = \{ uv \mid u \in L, |v| =2 \}$ is also regular. My idea: $L$ can be represented as a DFA and then you could add 2 consecutive transitions from every final state for the letters of…
3
votes
2 answers

Sorting an "almost sorted" array in sub linear time

I am given an "almost sorted" array with the condition that each element is no more than $k$ places away from its position in the sorted array. I need to show that it is impossible to sort this array in sublinear time asymptotically. My proof is to…
AmirB
  • 319
  • 2
  • 10
3
votes
1 answer

Proof or refute $n^n = \Omega(n!)$ with the help of Stirling's approximation

I'm trying to proof/refute the following equation: $$n^n = \Omega(n!)$$ Generally I would try to use Convergence Criteria and or l'Hôpital's rule to solve such a problem. $$\lim_{n\to \inf}{{f(n)}\over{g(n)}} = K$$ However, in this case $n!$ is…
wpp
  • 213
  • 1
  • 2
  • 5
3
votes
1 answer

Minimum number of oracle call to solve Simon problem by a (NDTM) non-deterministic Turing machine?

Simon's problem is a computational problem used to demonstrate an oracle separation between BQP and BPP classes. It is known that the minimum number of oracle calls to be made by the BQP machine is $\Omega(n)$. For the BPP machine, the lower bound…
1
2 3 4 5 6 7 8