Programming in C
4th Edition
ISBN: 9780321776419
Author: Stephen G. Kochan
Publisher: Addison-Wesley
expand_more
expand_more
format_list_bulleted
Concept explainers
Question
Chapter 10, Problem 6E
Program Plan Intro
Program Plan:
- Include the required headers.
- Define the structure
- Define the main method
- Declare the required variables
- Initialize the variable defined
- Insert the values
- Values are displayed
- Delete the value.
- Values get displayed after each deletion.
- Define the method “insertEntry()”
- Assign the position where an element needs to be inserted.
- The value are being inserted into the doubly linked list
- Define the method “DeleteEntry()”
- Variable required are being initialized.
- The values are being deleted from the doubly linked list.
Expert Solution & Answer
Want to see the full answer?
Check out a sample textbook solutionStudents have asked these similar questions
(a) Based on the function prototype of addTuition(), write the function definition for this addTuition() function that will prepare a new node of a linked list filled with the three basic information of a tuition class.
(b) Based on the function prototype of insertData() function and also how it is called by main() function, write the function definition for this insertData() function which will store data from Table Q1 in a linked list format.
(c) In the main() function, by using while loop, write C code to display print the information of all tuition classes and the average number of enrolled students, as shown in Figure Q1.
write a c++ code that will do the adding a node to a doubly-linked list in the three cases (insert a node at the beginning-middle-end). A separate function is required for each case.
Implement a function to remove all occurrences of a specific element from a list.
Chapter 10 Solutions
Programming in C
Ch. 10 - Type in and run the 15 programs presented in this...Ch. 10 - Write a function called to insert a new entry into...Ch. 10 - Prob. 3ECh. 10 - Write a function called r to remove an e from a...Ch. 10 - Prob. 5ECh. 10 - Prob. 6ECh. 10 - Prob. 7ECh. 10 - Prob. 8ECh. 10 - Prob. 9ECh. 10 - Prob. 10E
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
- 1.In a linear linked list, write a function named changeFirstAndLast that swaps the node at the end of the list and the node at the beginning of the list. The function will take a list as a parameter and return the updated list. 2. A singly linear list stores integer values in each node and has multiple nodes. Write a function using given prototype below. This function cuts the first node of the list and adds it to the end as last node. It takes beginning address of the list as a parameter and returns the updated list.struct node* cutheadaddlast(struct node* head);struct node { int number; struct node * next; }; 3.Adding the even numbers to the beginning of the list and odd numbers to the end of the list until -1 is entered from keyboard.struct node { int number; struct node * next; }; 4.Write a function that takes two parameters head (list name) and age (given student age). The function deletes node (free this memory location) by finding the second node with the given age value in…arrow_forward1. Suppose you have already developed an SLL ADT. You have to search a specificelement of the linked list. If you find the element in the list then you have to swapits previous node with its next node. Otherwise, simply print the message “Datanot found”. Now write a function in your SLL ADT with this functionality.arrow_forwardC++ Create a generic function add_bookends(ls, e) that adds a copy of element e to the front and back of list ls.arrow_forward
- Need help with making a function where it moves the head node to the end node of a linked list in Carrow_forward1-Write a C++ Function that returns the data of the middle node in a linked list and in case the linked list contains only one node return the data inside this node and returns the sum of all the nodes in linked list and returns the maximum data value in the linked listarrow_forward1. a function that takes in a list (L), and creates a copy of L. note: The function should return a pointer to the first element in the new L. [iteration and recursion]. 2. a function that takes in 2 sorted linked lists, and merges them into a single sorted list. note: This must be done in-place, and it must run in O(n+m).arrow_forward
- Write in C++ Now, what if Sam wants to insert Eevee after Pikachu but he doesn't know where Pikachu is located in his list. Let's help him search for a Pokemon by its name and insert another Pokemon directly after it. Write a function secondPlace() that takes six parameters and inserts a new Pokemon into a list right after another specified pokemon. Once you find the specified Pokemon, use the insertAfter() function from the previous sub-question to add the new Pokemon. The function should return the new number of strings in the array. Note The same Pokemon may appear in the list multiple times (Sam has a bad memory). Assume that Sam wants every instance of the Pokemon he is searching for to be followed by the Pokemon he is attempting to insert. If the array is already full or if the number of strings that are going to be added to the array plus the current number of strings exceeds the total size of the array, the array should remain unchanged. Assume all inputs are lowercase…arrow_forwardSuppose you have two objects of Doubly Linked List D1 and D2. Each object is representing a different Doubly Linked List. Write a function to concatenate both doubly linked lists. The concatenation function must return the address of head node of concatenated Doubly Linked List, and it must take two Node* parameters. You need to keep in mind all exceptional cases for example what if either one of the doubly linked lists is empty? Perform this task on paper, take a clear picture of solution and paste it in answer section.arrow_forwardSuppose a node of a doubly linked list is defined as follows: struct Node{ int data; struct Node* next; struct Node* prev; }; Write the function definition of the function deleteElement as presented below. This function deletes a node at position n from a doubly linked list. struct Node* deleteElement(struct Node* head, int n){ //write the function definition }arrow_forward
- Write a C++ Function that returns the data of the middle node in a linked list and in case the linked list contains only one node return the data inside this node then returns the sum of all the nodes in linked list then returns the maximum data value in the linked listarrow_forwardConsider the following function that takes reference to head of a Doubly Linked List as parameter. Assume that anode of doubly linked list has previous pointer as prev and next pointer as next.void fun(struct node **head_ref){struct node *temp = NULL;struct node *current = *head_ref;while (current != NULL){temp = current->prev;current->prev = current->next;current->next = temp;current = current->prev;}if(temp != NULL )*head_ref = temp->prev;}Assume that reference of head of following doubly linked list is passed to above function 1 <--> 2 <--> 3 <--> 4 <--> 5 <-->6. What should be the modified linked list after the function call? Note: solve as soon as possiblearrow_forwardcompare and contrast static array-based unsorted list and static array-based sorted list, There is a function binary search in the sorted list one. Which two public functions are using the binary search function so that it can be faster than utilizing a linear search?arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning