Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please write a C program to implement a doubly linked list. If you look at the zipped folder, you will see a list.h file, which

image text in transcribed
image text in transcribed
image text in transcribed
Please write a C program to implement a doubly linked list. If you look at the zipped folder, you will see a list.h file, which will provide the functions that you need to define to implement a linked list in C. These functions should be defined in the list.c file, which is provided (but empty). /l Interface definition for linked list. /I II /* Defines the type of the elements in the linked list. You may change this if * you want! *l typedef int elem; /* Defines the node structure. Each node contains its element, and points to the * next node in the list. The last element in the list should have NULL as its * next pointer. *l struct node f elem value; struct node *next; \}; typedef struct node node_t; /* Defines the list structure, which simply points to the first node in the * list. */ struct list \{ \}. node_t t *head; typedef struct list list_t; /* Functions for allocating and freeing lists. By using only these functions, * the user should be able to allocate and free all the nenory required for * this linked list library. *l list_t *list_alloc(); void list_free(list_t *l); /* Prints the list in some format. */ void list_print(list_t l); /* Returns the length of the list. */ int list_length ( List_t*L); / Methods for adding to the list. */ void list_add_to_back(list_t *l, elen value); void list_add_to_front (list_t*l, eleem value); void list_add_at_index(list_t , e.lem value, int index); /* Methods for removing from the list. Returns the removed elenent. *l elem list_remove_from_back ( list_t tl); elem list_remove_from_front ( list_t tl); elen list_remove_at_index (list_t l, int index); /* Checks to see if the given element exists in the list. */ bool list_is_in(list_t *l, elem value); /* Returns the element at the given index. */ eleeP list_get_elem_at, (list_t *l, int index); I* Returns the index at which the given element appears. */ int list_get_index_of (list_t l, ele? value); // Implementation for linked list. // // \#include h> \#include //\#include \#include "list. h

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_2

Step: 3

blur-text-image_3

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

Database Systems For Advanced Applications 9th International Conference Dasfaa 2004 Jeju Island Korea March 2004 Proceedings Lncs 2973

Authors: YoonJoon Lee ,Jianzhong Li ,Kyu-Young Whang

2004th Edition

3540210474, 978-3540210474

More Books

Students also viewed these Databases questions

Question

Are there any questions that you want to ask?

Answered: 1 week ago