I'd like to know if I have the right intuition and my answer is headed the correct way.
I am given a function $ f = \{0, 1\}^* \rightarrow \{0, 1\}^* $ that is computable in space $O(\log n)$ assume that for every $x \in \{0, 1\}^*$, $f$ is length preserving, $|f(x)| = |x|$.
Define $$L = \left\{ x\#y \mid \ x, y \in \{0, 1\}^*, |x| = |y|, \ \text{and} \ f(x) = f(y)\right\}$$
I am suppose to prove that $ L \in {\sf DSPACE}(\log n) $.
Please correct me if my intuition is incorrect.
My solution would be to build a decider $M$ which is a Turing machine.
$M$ takes inputs $x$ and $y$, run the function $f$ on input $x$ and $y$ and if the lengths of the two strings are equal then accept, otherwise reject.
Now the Turing machine runs in $ O(\log n) $ because the function $f$ is computable in $ O(\log n) + O(\log n) = O(\log n) $ and comparing the length returned by the function is $ O(1) $ Thus the language is decidable by a Turing machine that is run in $ O(\log n) $ and only takes Space $ O(\log n) $.
Thanks I see the problem that lies in my algorithm and this is how I would fix the first issue.
$M $ takes inputs $ x \ and \ y $, Run $ f$ on $\ x \ and \ y $, Check to see if the number of steps taken by $f$ on both inputs is equal and check if the length determined by the function for both inputs is equal. $M$ Accepts if it satisfies both conditions, otherwise $M$ Rejects.
But I'm not entirely sure how to avoid the issue you stated about how the space complexity would be $ O(n)$ when I'm really looking for $O(log n)$
– Shadower2222 Apr 27 '13 at 05:16