Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Type in C++ programming!! Topics: Recursive Structs, Pointers and Memory Management in C. For this assignment, you will add to your multi-file C program (Program

Type in C++ programming!!

image text in transcribed

image text in transcribed

Topics: Recursive Structs, Pointers and Memory Management in C.

For this assignment, you will add to your multi-file C program (Program 04) to define, implement and use a third kind of dynamic linked list. Please refer to Lab 04 for the definition of a basic dynamic linked list.

In this assignment you will need to use the basic ideas of a node and of a linked list (of nodes) to implement two more functions which can be used to create and maintain a new kind of list.

Inorder:

  1. A list where adds and removes occur such that the list is always in (ascending) sorted order

Requirements:

  • You must add to your lists.c - given the following lists.h (which can not be modified):

// a recursive data type definition

// serves as the nodes of a list

typedef struct node

{

int id;

char* name;

struct node* next;

} node;

// create an empty list - set *node = NULL

void create_list(node** head);

// add a new node to the front of the list

void add_front(node* *head, node* new_node);

// add a new node to the end of the list

void add_end(node* *head, node* new_node);

// add a new node in the list, in (ascending) sorted order based on

// the nodes name component's value

void add_inorder(node* *head, node* new_node);

// remove and return the first node in the list whose name component's value

// is equal to the given key_name

// return NULL if no such node exists in the list

node* rem_inorder(node* *head, char* key_name);

// remove and return the node at the front of the list or NULL if empty

node* rem_front(node* *head);

// remove and return the node at the end of the list or NULL if empty

node* rem_end(node* *head);

// return the number of nodes in the list

int list_len(const node* head);

// print the data values of all the nodes in the list (from start to end)

void print_list(const node* head);

// free the entire list and set *node = NULL

void free_list(node* *head);

  • You must add to your main.c so that it tests your Inorder list implementation completely
  • You should not need to modify your Makefile
Topics: Recursive Structs, Pointers and Memory Management in C. For this assignment, you will add to your multi-file C program (Program 04) to define, implement and use a third kind of dynamic linked list. Please refer to Lab 04 for the definition of a basic dynamic linked list. In this assignment you will need to use the basic ideas of a node and of a linked list (of nodes) to implement two more functions which can be used to create and maintain a new kind of list. Inorder: 1. A list where adds and removes occur such that the list is always in (ascending) sorted order Requirements: . You must add to your lists.c- given the following lists.h (which can not be modified): // a recursive data type definition // serves as the nodes of a list typedef struct node int id; char* name; struct node* next; } node; // create an empty list - set *node = NULL void create_list (node** head); // add a new node to the front of the list void add_front (node* *head, node* new_node); // add a new node to the end of the list void add_end (node* *head, node* new_node): || // add a new node in the list, in (ascending) sorted order based on // the nodes name component's value void add_inorder (node* *head, node* new_node); 11 remove and return the first node in the list whose name component's value // is equal to the given key_name // return NULL if no such node exists in the list node* rem_inorder (node* *head, chart key_name); // remove and return the node at the front of the list or NULL if empty node* rem_front (node* *head); // remove and return the node at the end of the list or NULL if empty node* rem_end (node* *head); // return the number of nodes in the list int list_len (const node* head); // print the data values of all the nodes in the list (from start to end) void print_list (const node* head); // free the entire list and set *node = NULL void free_list (node* *head); You must add to your main.c so that it tests your Inorder list implementation completely You should not need to modify your Makefile . Topics: Recursive Structs, Pointers and Memory Management in C. For this assignment, you will add to your multi-file C program (Program 04) to define, implement and use a third kind of dynamic linked list. Please refer to Lab 04 for the definition of a basic dynamic linked list. In this assignment you will need to use the basic ideas of a node and of a linked list (of nodes) to implement two more functions which can be used to create and maintain a new kind of list. Inorder: 1. A list where adds and removes occur such that the list is always in (ascending) sorted order Requirements: . You must add to your lists.c- given the following lists.h (which can not be modified): // a recursive data type definition // serves as the nodes of a list typedef struct node int id; char* name; struct node* next; } node; // create an empty list - set *node = NULL void create_list (node** head); // add a new node to the front of the list void add_front (node* *head, node* new_node); // add a new node to the end of the list void add_end (node* *head, node* new_node): || // add a new node in the list, in (ascending) sorted order based on // the nodes name component's value void add_inorder (node* *head, node* new_node); 11 remove and return the first node in the list whose name component's value // is equal to the given key_name // return NULL if no such node exists in the list node* rem_inorder (node* *head, chart key_name); // remove and return the node at the front of the list or NULL if empty node* rem_front (node* *head); // remove and return the node at the end of the list or NULL if empty node* rem_end (node* *head); // return the number of nodes in the list int list_len (const node* head); // print the data values of all the nodes in the list (from start to end) void print_list (const node* head); // free the entire list and set *node = NULL void free_list (node* *head); You must add to your main.c so that it tests your Inorder list implementation completely You should not need to modify your Makefile

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

Advances In Databases And Information Systems 23rd European Conference Adbis 2019 Bled Slovenia September 8 11 2019 Proceedings Lncs 11695

Authors: Tatjana Welzer ,Johann Eder ,Vili Podgorelec ,Aida Kamisalic Latific

1st Edition

3030287297, 978-3030287290

More Books

Students also viewed these Databases questions

Question

I need answer in english 1 9 . Question in Chemical Engineering

Answered: 1 week ago

Question

List the different categories of international employees. page 642

Answered: 1 week ago

Question

Explain the legal environments impact on labor relations. page 590

Answered: 1 week ago