Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Modify our Doubly Linked List code to include following index (rank) based acces

ID: 3604633 • Letter: M

Question

Modify our Doubly Linked List code to include following index (rank) based access operations

int RetrieveAt(int index)
void DeleteAt(int index)

void Swap(int index, int index)


index starts at 0 (just like array's subscript)
If the index is out of bound, RetrieveAt returns -999, DeleteAt does nothing, do nothing in Swap.

Write your own testing program to test the modified class

__________________________________________________________________DLinkeList.h_________________________________________________________

____________________________________________________________________________________________________________________________________

____________________________________________________________________DLinkedList.cpp____________________________________________________

____________________________________________________________________________________________________________________________________

Explanation / Answer

Hi, Please find my implementation for int RetrieveAt(int index) method.

Since you have mentioned that to do nothing for other two methods, so I have not implemented other methods.

int RetrieveAt(int index) {
if(index >= length || index < 0) {
return -999;
}

Node *temp = head;
int count = 0;
while(count < index) {
temp = temp->next;
count++;
}

return temp->data;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote