Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C programming Implement a suit of functions using nodes and linked lists to create and maintain two types of lists: A list where all adds

C programming

Implement a suit of functions using nodes and linked lists to create and maintain two types of lists:

  1. A list where all adds and removes occur at the start of the list (a Stack)
  2. A list where all adds occur at the end of the list, and removes the start of the list (a Queue)

Requirements:

  • You must write 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);

// 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 write main.c which tests your list implementations completely
  • You muse use list.h without changing anything on it
  • each node should be a string

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

Semantics In Databases Second International Workshop Dagstuhl Castle Germany January 2001 Revised Papers Lncs 2582

Authors: Leopoldo Bertossi ,Gyula O.H. Katona ,Klaus-Dieter Schewe ,Bernhard Thalheim

2003rd Edition

3540009574, 978-3540009573

More Books

Students also viewed these Databases questions