Question: Implement a new function in dlinkedlist.c that builds a Dlist from user input, using the existing functions getint and addToEnd. /I Prompt the user for
Implement a new function in dlinkedlist.c that builds a Dlist from user input, using the existing functions getint and addToEnd. /I Prompt the user for a sequence of integers and build the // corresponding doubly-linked list. End the sequence with -1. Node buildDlist) // TODO Implement the following four functions in dlinkedlist.c .int findLargest (Node start) .int findSmallest (Node start) . void printBackward (Node start) . void swapNodes (Node start, int a, int b) At the bottom of dlinkedlist.c, add a main function that tests your code. For example, use buildDlist to make the doubly-linked list: 01020304050NULL. The run several tests on your new functions, like this: int main) Node h buildDlist printf("Forward: " print(h); printf ("Largest : "); int large-findLargest(h); printf("%d ", large); printf("Smallest:; int small findSmallest(h); printf("xd In", small); printf( "Backward: " printBackward(h); printf("Swap 10 40: "); swapNodes (h, 10, 40); print(h); printf("Swap 10 40: "); swapNodes (h, 1, 40); print(h); printf("Swap 10 5e: "); swapNodes (h, 1, 50); print(h); printf("Swap 20 30: "); swapNodes (h, 20, 30) print(h); printf("Swap 20 3:"); swapNodes (h, 20, 30) print(h)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
