time out search element in linked list c++
void Search_Element(int searchValue)
{
Node* temp = head;
int i;
for (i=0; temp != NULL; i++)
{
temp = temp->next;
if (temp->key == searchValue)
{
cout << i << "\n";
}
else
{
cout << -1 << "\n";
}
}
}