C++ Design a struct for a doubly-linked list as follows: Taie teed prev pies Nex
ID: 3740021 • Letter: C
Question
C++
Explanation / Answer
void downwardSearch(listrec2 *head)
{
listrec2 *temp = head;
while (temp != NULL)
{
printf("%d ", temp->data);
temp = temp->next;
}
}
void upwardSearch(listrec2 *tail)
{
listrec2 *temp = tail;
while (temp != NULL)
{
printf("%d ", last->data);
temp = temp->prev;
}
}
//For finding tail we can use this:
listrec2* findTail(listrec2 *head)
{
listrec2 *temp = head;
while (temp->next != NULL)
{
tail = temp;
temp = temp->next;
}
return tail;
}
listrec2 *tail = findTail(head);
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.