Two linked lists are said to be identical if they have the same date in the same order.
Eg: list A = 2->7->44 and list B = 2->7->44 are said to be identical.
A simple iterative solution for finding out if the lists are identical.
Eg: list A = 2->7->44 and list B = 2->7->44 are said to be identical.
A simple iterative solution for finding out if the lists are identical.
int
isIdentical(list a, list b)
{
for
(; a && b && a->data == b->data; a = a->next, b = b->next);
return
!(a || b);
}
No comments:
Post a Comment