Database System Concepts
7th Edition
ISBN: 9780078022159
Author: Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher: McGraw-Hill Education
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
In C program.
/*
* dataStructure.h
*
* Provides a data structure made of a doubly-headed singly-linked list (DHSL)
* of unsorted elements (integers) in which duplicated elements are allowed.
*
* A DHSL list is comprised of a single header and zero or more elements.
* The header contains pointers to the first and last elements in the list,
* or NULL if the list is empty. The first element contains a pointer to
* the next element, and so on. The last element in the list has its
* "next" pointer set to NULL.
*
* The interface of this data structure includes several utility
* functions that operate on this data structure.
*
* Precondition: Functions that operate on such data structure
* require a valid pointer to it as their first argument.
*
* Do not change this dataStructure.h file.
*
*/
/*** Data structure ***/
/* List element (node): our DHSL list is a chain of these nodes. */
typedef struct element {
int val;
structelement*next;
} element_t;
/* List header: keeps track of the first and last list elements
as well as the number of elements stored in our data structure. */
typedef struct list {
element_t* head;
element_t* tail;
unsignedint elementCount;
} list_t;
/*** Data structure interface ***/
/* A type for returning status codes */
typedef enum {
OK,
ERROR,
NULL_PARAM
} result_t;
//dataStructure.c
/* Description: Appends a new element, i.e., a node containing "newElement",
* to this data structure pointed to by "list" and returns OK.
* If "newElement" cannot be appended, leaves the
* data structure unmodified and returns ERROR.
* Returns NULL_PARAM if "list" is NULL.
* Time efficiency: O(1)
*/
result_t list_append( list_t* list, int newElement ) {
result_t result = OK;
// Stubbing this function
// This stub is to be removed when you have successfully implemented this function, i.e.,
// ***Remove this call to printf!***
printf( "Calling list_append(...): appending newElement %d to list.\n", newElement );
return result;
}
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by stepSolved in 2 steps
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- In C program. implement list_get( list_t* list, unsigned int position ) function /* * dataStructure.h * * Provides a data structure made of a doubly-headed singly-linked list (DHSL) * of unsorted elements (integers) in which duplicated elements are allowed. * * A DHSL list is comprised of a single header and zero or more elements. * The header contains pointers to the first and last elements in the list, * or NULL if the list is empty. The first element contains a pointer to * the next element, and so on. The last element in the list has its * "next" pointer set to NULL. * * The interface of this data structure includes several utility * functions that operate on this data structure. * * Precondition: Functions that operate on such data structure * require a valid pointer to it as their first argument. * * Do not change this dataStructure.h file. * */ /*** Data structure ***/ /* List element (node): our DHSL list is a chain of these nodes. */ typedef struct element { int val;…arrow_forwardC++Create a text file storage for the list of movies and store your those movies in a linked list when you retrieved them from the text file. They must also be stored in a linked list data structure during processing. Saving back to the text file will be done when the user chooses to Exit the Program.arrow_forwardWrite a program in c++ to remove duplication if exists in the linked list. Write 2 separate functions to perform search and other to perform the duplication removal. Note: the above mentioned task is to be performed using singly linked list and in c++arrow_forward
- in c++arrow_forwardGiven an IntNode struct and the operating functions for a linked list, complete the following functions to extend the functionality of the linked list(this is not graded).arrow_forwardWrite C++ code to display all even numbers in the a doubly linked list pointed to by Dlist. Use while loop to scan all nodes from the start to the end. (Each node has three fields: a data field that contains the information, and right and left fields contain pointers to nodes on either side. Ex. p->left represents the address of the node to the left of node p) (any number of nodes in the linked list) Dlist 4 3 8 HIIN 7 1arrow_forward
arrow_back_ios
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education