Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Linked List Create set of functions for managing a linked list using C program Your linked list program must include the following functions: Requirement Conditions

Linked List

Create set of functions for managing a linked list using C program

image text in transcribed

image text in transcribed

Your linked list program must include the following functions: Requirement Conditions Function LinkedList* llist initialize(int,char*) Input Parameters An integer for setting the data type size and a string representing the name of the data type being stored Return Value An initialized linked list. Notes An initialized linked list will have the size, item size, and type set. It will not have a node attached, so the first and last pointers should be set to NULL Requirement Conditions Function bool llist add at[Linked List*, int, void*) Input Parameters A pointer to a linked list, an integer index, and a void pointer to an element. Return value True if the element was successfully added to the linked list at the given index. Otherwise false. Notes This function should insert the given element at the given index in the linked list. Requirement Conditions Function bool llist add first(LinkedList", void) Input Parameters A pointer to a linked list and a void pointer to an element Return Value True if the element was successfully added to the front of the linked list. Otherwise false. Notes This function should insert the given element on the front of the linked list. Requirement Conditions Function bool llist add last(LinkedList*, void") Input Parameters A pointer to a linked list and a void pointer to an element Return value True if the element was successfully added to the end of the linked list. Otherwise false. Notes This function should insert the given element on the end of the linked list Requirement Conditions Function void" llist get(LinkedList*, int) Input Parameters A pointer to a linked list and an int representing an index. Return value A void pointer to the element stored in the given index of the linked list. If the given index is not in the list range, return NULL. Notes This function should return the void pointer stored in the given index of the linked. This should not return a whole Node, but instead the value the node contains as data. Requirement Conditions Function int llist index of(LinkedList*, void) Input Parameters A pointer to a linked list and a void pointer to an element Return Value The index containing the element. -1 if the element is not in the list Notes This function should search the linked list for the element and return its index if found. Requirement Conditions Function void" llist remove(Linked List*, int) Input Parameters A pointer to a linked list and an int representing an index Return value A pointer to the element removed from the list. Otherwise NULL Notes This function should remove the element in the given index from the list and return it. Requirement Conditions Function void" llist remove first(LinkedList") Input Parameters A pointer to a linked list. Return Value A pointer to the element removed from the list. Otherwise NULL Notes This function should remove the element from the front of the list and return it. Requirement Conditions Function void" llist remove last(LinkedList*) Input Parameters A pointer to a linked list. Return Value A pointer to the element removed from the list. Otherwise NULL Notes This function should remove the element from the list and return it. Requirement Conditions Function bool llist destroy(LinkedList") Input Parameters A pointer to a linked list. Return Value True if the linked list is successfully deallocated. Otherwise false. Notes This function should deallocate all of the nodes, all of the node data, the type name, and finally the linked list Your linked list program must include the following functions: Requirement Conditions Function LinkedList* llist initialize(int,char*) Input Parameters An integer for setting the data type size and a string representing the name of the data type being stored Return Value An initialized linked list. Notes An initialized linked list will have the size, item size, and type set. It will not have a node attached, so the first and last pointers should be set to NULL Requirement Conditions Function bool llist add at[Linked List*, int, void*) Input Parameters A pointer to a linked list, an integer index, and a void pointer to an element. Return value True if the element was successfully added to the linked list at the given index. Otherwise false. Notes This function should insert the given element at the given index in the linked list. Requirement Conditions Function bool llist add first(LinkedList", void) Input Parameters A pointer to a linked list and a void pointer to an element Return Value True if the element was successfully added to the front of the linked list. Otherwise false. Notes This function should insert the given element on the front of the linked list. Requirement Conditions Function bool llist add last(LinkedList*, void") Input Parameters A pointer to a linked list and a void pointer to an element Return value True if the element was successfully added to the end of the linked list. Otherwise false. Notes This function should insert the given element on the end of the linked list Requirement Conditions Function void" llist get(LinkedList*, int) Input Parameters A pointer to a linked list and an int representing an index. Return value A void pointer to the element stored in the given index of the linked list. If the given index is not in the list range, return NULL. Notes This function should return the void pointer stored in the given index of the linked. This should not return a whole Node, but instead the value the node contains as data. Requirement Conditions Function int llist index of(LinkedList*, void) Input Parameters A pointer to a linked list and a void pointer to an element Return Value The index containing the element. -1 if the element is not in the list Notes This function should search the linked list for the element and return its index if found. Requirement Conditions Function void" llist remove(Linked List*, int) Input Parameters A pointer to a linked list and an int representing an index Return value A pointer to the element removed from the list. Otherwise NULL Notes This function should remove the element in the given index from the list and return it. Requirement Conditions Function void" llist remove first(LinkedList") Input Parameters A pointer to a linked list. Return Value A pointer to the element removed from the list. Otherwise NULL Notes This function should remove the element from the front of the list and return it. Requirement Conditions Function void" llist remove last(LinkedList*) Input Parameters A pointer to a linked list. Return Value A pointer to the element removed from the list. Otherwise NULL Notes This function should remove the element from the list and return it. Requirement Conditions Function bool llist destroy(LinkedList") Input Parameters A pointer to a linked list. Return Value True if the linked list is successfully deallocated. Otherwise false. Notes This function should deallocate all of the nodes, all of the node data, the type name, and finally the linked list

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

Database Processing Fundamentals Design And Implementation

Authors: KROENKE DAVID M.

1st Edition

8120322258, 978-8120322257

More Books

Students also viewed these Databases questions

Question

How would you describe your typical day at work?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago