Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR CPP

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 << "
";
            }
            
            else
            {
                cout << -1 << "
";
            }
            
        }
        
    }
 
PREVIOUS NEXT
Tagged: #time #search #element #linked #list
ADD COMMENT
Topic
Name
1+3 =