Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Use this structure typedef struct StudentListNodestruct f int id; char name32] struct studentListNodestruct *next; StudentListNode; and write functions to maintain a singly-linked list. Here are

image text in transcribed

image text in transcribed

Use this structure typedef struct StudentListNodestruct f int id; char name32] struct studentListNodestruct *next; StudentListNode; and write functions to maintain a singly-linked list. Here are four functions to write: int insertstudent(StudentListNodeist, int id, char "name) This will insert a new record in the list, sorted (ascending) by student id. Check to see whether there is already a record in the list having that id If there is, don't insert a new record and return 1. Otherwise, create a new list node, put the list node in the correct place in the list, and return 0. int findstudent(StudentLstNode *Iist, int id, char *name) Find the record having the specified id. If there is one, then copy the name from that record to the name parameter and return 0. Otherwise, just return 1. int deletestudent(StudentListNode **list, int id) Delete the record from the list having an id that matches the specified id. If there isn't one, then just return 1. Otherwise, delete the record from the list and return 0. int printlist(StudentlistNode list) Print the records from this list. Print them one to a line, in in this form: lid name l id name lid namel If the list is empty, then print this: (empty list) Part I For insertion, there are three cases: 1. insert into empty list 2. new node goes in the middle of the list 3. new node goes at the front of the list For deletion, there are three cases: 1. delete first node in list 2. delete node from middle of list 3. delete last node in list For each of the cases for insertion and deletion, describe, using pseudocode, what the function needs to do. Make sure you describe what has to happen to the "next" pointers for list nodes for each of the three cases. Part lI Do the actual implementations in C of the four functions above. Put your structure definition and function prototypes in slist.netid.h, and put your code in slist.netid.c

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

Data Access Patterns Database Interactions In Object Oriented Applications

Authors: Clifton Nock

1st Edition

0321555627, 978-0321555625

More Books

Students also viewed these Databases questions