Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please, explain each blank Page 3 Problem 2 (30 points): Manipulating Linked Lists Prof. Lumetta needs your help! He has gathered his books into a

please, explain each blank image text in transcribed
image text in transcribed
Page 3 Problem 2 (30 points): Manipulating Linked Lists Prof. Lumetta needs your help! He has gathered his books into a linked list of book t structures, defined as shown below. The next field links one book to the next in the list. typedef struct book_t book_t; struct book_t char* title; char" author char* call_number; int due_date; book t next; Prof. Lumetta needs to separate a linked list of "books" (book t's) into two separate lists based on their due dates (the due data field). Help Prof. Lumetta by completing the function on the following page. The function signature is as follows: book_t* collect_books (book_t** listp, int due_by); The function takes two parameters: listpa pointer to a pointer to the first book in the original linked list of books due by the date used to separate the list The function must separate the original listinto two separate linked lists, each correctly terminated, as follows: All books with due date field less than or equal to due by should be removed from the original list and collected into a new list. The order of these books in the new list does not matter. The function must return a pointer to the first book in the new list. Any book with a due data larger than due by should remain in the original list. The order of these remaining books must not change. The function must update the value to which liatp points to indicate the first book in the original list with a due date larger than due by. Problem 2, continued: /* structure definition replicated for your convenience */ typedef struct book t book_t; struct bookt char" title; chart author char* call number: int due date; book_t* next; /* Complete the function by filling in the blanks. */ book_t* collect_books (book_t** listp, int due_by) book_t* collected; book_t* book; while ( book -*listo; if (due_by

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions

Question

Conduct an effective performance feedback session. page 360

Answered: 1 week ago