Question: How would I do this? 1 Singly-Linked List Use this #define: #define MAX STATE NAME LENGTH 64 and use this structure: typedef struct StateListNode Struct

How would I do this?How would I do this? 1 Singly-Linked List Use this #define: #defineMAX STATE NAME LENGTH 64 and use this structure: typedef struct StateListNode

1 Singly-Linked List Use this #define: #define MAX STATE NAME LENGTH 64 and use this structure: typedef struct StateListNode Struct { int population; char name [MAX STATE NAME LENGTH] ; struct State List NodeStruct *next; } StateListNode; and write functions to maintain a singly-linked list. Here are four functions to write: int insert State (StateListNode **list , char *name, int population) This will insert a new record in the list, sorted (ascending) by population. When you insert, first check to see whether the length of the name string is less than MAX_STATE_NAME LENGTH. If it isn't, then just return 1. Otherwise, check whether there is already a record in the list having that name. 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 find State (StateListNode *list , char *name, int * population) Find the record having the specified name. If there is one, then copy the population from that record to the population parameter and return 0. Otherwise, just return 1. int deleteState (StateListNode **list , char *name) Delete the record from the list having a name that matches the specified name. If there isn't one, then just return 1. Otherwise, delete the record from the list and return 0. Free the memory (using free()) associated with the node that you delete. int printList (State List Node *list) Print the records from this list. Print them one to a line, in in this form: |name| population name| population |name| population (Put the pipe character before and after the name string.) If the list is empty, then print this: (list is empty) 1 Singly-Linked List Use this #define: #define MAX STATE NAME LENGTH 64 and use this structure: typedef struct StateListNode Struct { int population; char name [MAX STATE NAME LENGTH] ; struct State List NodeStruct *next; } StateListNode; and write functions to maintain a singly-linked list. Here are four functions to write: int insert State (StateListNode **list , char *name, int population) This will insert a new record in the list, sorted (ascending) by population. When you insert, first check to see whether the length of the name string is less than MAX_STATE_NAME LENGTH. If it isn't, then just return 1. Otherwise, check whether there is already a record in the list having that name. 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 find State (StateListNode *list , char *name, int * population) Find the record having the specified name. If there is one, then copy the population from that record to the population parameter and return 0. Otherwise, just return 1. int deleteState (StateListNode **list , char *name) Delete the record from the list having a name that matches the specified name. If there isn't one, then just return 1. Otherwise, delete the record from the list and return 0. Free the memory (using free()) associated with the node that you delete. int printList (State List Node *list) Print the records from this list. Print them one to a line, in in this form: |name| population name| population |name| population (Put the pipe character before and after the name string.) If the list is empty, then print this: (list is empty)

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!