Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please answer in c, Im having a hard time trying to figure this out. Thank you! 3. (15pt) We use the following cell structure to

image text in transcribedimage text in transcribedPlease answer in c, Im having a hard time trying to figure this out. Thank you!

3. (15pt) We use the following cell structure to store the IDs and names of some students in a single linked list data structure typedef struct cell [ int ID; char name [20]; struct cell *next cellT, *cellPtrT Suppose somehow we have created the following two single linked lists, namely M and S, to store the IDs and names of the students who are taking Math and Science, respectively. Lists are sorted w.r.t. IDs. "A. Z. 14 Z.E NULL Now we are interested in creating a new list, say U, to store the IDs and names of the students who are taking Math or Science (or both). As you may know this operation is known as union of two sets, where each element appears only once in list U. So list U will look like as follows (note that elements in list U should be sorted w.r.t. IDs, as in the original lists): N. K W.A Z.E. P.T NULL You are asked to implement a function, cellT *union (cellT *M, cellT *S), which can be called as follows to find the union of the given two sets represented by single linked list cellT *M, *S, U; /somehow the lists pointed by M and S are created / Uunion (M, S); After your function, M and S should be intact. So do not remove the cells from M or S! When needed, create new cells for U and copy the ID and name from the cells in M or S use the next page to answer question 3 4

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access with AI-Powered 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

Students also viewed these Databases questions