Question: USE C + + Write a function that returns the data of the k th element of a doubly linked list. If the number is
USE C
Write a function that returns the data of the th element of a doubly linked list. If the number is negative, start looking from the end. If it is positive, then start looking from the head. NOTE: The function takes only an integer and a pointer to the head. There is no pointer to tail.
The list will not be empty. The argument will not be outside the list. will not be There is no tail. This is a doubly linked list.
For example, given the following data:
tableNode headNode Node Node Node
Example
The th item is
The th item is
struct doubly
int item;
doubly "next;
doubly "prev;
:
int getltemint doubly "head
Code to deal with when it is a positive number if
Code to deal with if it is negative number else
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
