Update Linked List.cpp

fix: reverse check for empty list + converting tabs to spaces
This commit is contained in:
Marian Gusatu
2020-04-22 11:56:01 +03:00
committed by GitHub
parent 7ed069648d
commit d2760d1e54

View File

@@ -101,15 +101,14 @@ void reverse()
{
node *first = start;
if (first != NULL){
node *second = first->next;
while (second != NULL)
{
node *tem = second->next;
second->next = first;
first = second;
second = tem;
}
node *second = first->next;
while (second != NULL)
{
node *tem = second->next;
second->next = first;
first = second;
second = tem;
}
start->next = NULL;
start = first;
}