We investigate off-line Turing machines equipped with a two-way input-tape and one work-tape. It is shown that the Element Distinctness Problem (EDP) for m binary strings of length l = O(m/log(2) m) can be solved in time O(m(3/2)l(1/2)) and space O(m(1/2)l(1/2)) on a nondeterministic machine. This is faster than the best sorting algorithm on the computational model and optimal if time and space are considered simultaneously. For deterministic machines we give an optimal algorithm that can sort m binary strings consisting of e bits each in O(m(3/2)l) steps, provided that l = O(m(1/4)). By modifying the solution we obtain the time bound O(m(3/2)l) and the space bound O(m(1/2)l(2)) for the EDP.