INPUT: Two lists L1 and L2
QUESTION: Do L1 and L2 represent the same list?
(That is, do L1 and L2 contain the same numbers, each appearing exactly the same number of times?).
My Solution:
temp = head->L1
while search_L2(temp) == true
temp = temp->next
if search_L2(temp) == false
OUTPUT: L1 does not represent L2
Is this a correct algorithm?
Could this algorithm be a randomized algorithm (possibly using hash functions?). If so, how is it possible?
2006-11-25
07:01:18
·
3 answers
·
asked by
ff3101
1
in
Computers & Internet
➔ Programming & Design