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

1. Convert single linked list to be a doubly linked list. 2. Read the UProducts.

ID: 3788839 • Letter: 1

Question

1. Convert single linked list to be a doubly linked list.

2. Read the UProducts.csv file and create ADT's to store the data in the doubly linked list.

3. Use either the Bubble, Selection or Merge sort to sort your doubly linked list. Note: it is easier to swap data in a node rather than to swap the "addresses" of two nodes.

4. Write a recursive algorithm to traverse your doubly linked list forwards and backwards.

5. The interface for the Doubly Linked List should be the same as the Singly Linked list.

Explanation / Answer

Answer

1.

In order to convert single linked list to double linked list, first define the struct for double linked list as below:

struct node{
int val;
struct node *next;
struct node *previous;
}

Next, when you are traversing the single linked list, define a temperoray node initialized as head and do the below:

temp = head (of single LL)

# loop from here to down untill you reach tail of single LL

next = temp->next;

previous = temp;

temp = temp->next;