Question: Suppose a linked list (implemented using the array implementation) is ordered by the ABC123 ID and a node is represented by the following Node definition:

Suppose a linked list (implemented using the array implementation) is ordered by the ABC123 ID and a node is represented by the following Node definition:

#define MAX_NODES 100

typedef struct

{

char szAbc123Id[7];

double dGPA;

int iNext;

} Node;

Node nodeM[MAX_NODES];

int iHead;

int iFind, iBest, iPrecedes;

// assume the linked list has been populated with values and

// iHead points to the first node in that array.

// practice problem #1- sample invocation

printHighGPAs(nodeM, iHead);

// practice problem #2- sample invocation

iFind = searchLL(nodeM, iHead, "XYZ321", &iPrecedes);

if (iFind == -1)

printf("Not found ");

// practice problem #3 - sample invocation

iBest = getHighestStudent(nodeM, iHead);

if (iBest == -1)

printf("list is empty ");

else

printf("Best student is %s ", nodeM[iBest].szAbc123Id);

Practice Problems

1. Show the function, printHighGPAs(Node nodeM[], int iHead), which prints the ABC123 ID and GPA for students having a GPA >= 3.5 of students in the linked list that begins at iHead.

2. Modify the searchLL function from class to be passed an ABC123 ID and find the specified student in the linked list. If it is found, return the subscript to that student. If it is not found, return LL_NULL. Also, return (via the parameter list) the subscript to the node that precedes that node. If there isn't a preceding node, this should be LL_NULL.

3. Show code for the function, getHighestStudent, which is passed an array of nodes and iHead. It returns a subscript of the node for the student with the highest GPA. Return -1 if there aren't any nodes in the linked list.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!