Is this code good to clone a linked list?
public linkedList clone()
{
linkedList lst1 = new linkedList();
Node tmp = head;
for (int i = 0; i <= count; i++)
{
lst1.Add(tmp.data);
tmp = tmp.next;
}
return lst1;
}
also can you guys suggest any other easy way to clone a linked list