1. Engineering
  2. Computer Science
  3. implement a new function in dlinkedlistc that builds a dlist...

Question: implement a new function in dlinkedlistc that builds a dlist...

Question details

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: 0艹10艹20艹30艹40艹50艹NULL. 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\n, 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)
Solution by an expert tutor
Blurred Solution
This question has been solved
Subscribe to see this solution