Write a void function that takes a linked list of integers and reverses the order of its nodes. The function will have one call-by-reference parameter that is a pointer to the head of the list. After the function is called, this pointer will point to the head of a linked list that has the same nodes as the original list, but in the reverse of the order they had in the original list. Note that your function will neither create nor destroy any nodes. It will simply rearrange nodes. Place your function in a suitable test
Trending nowThis is a popular solution!
Chapter 13 Solutions
Problem Solving with C++ (9th Edition)
Additional Engineering Textbook Solutions
Web Development and Design Foundations with HTML5 (9th Edition) (What's New in Computer Science)
C How to Program (8th Edition)
Introduction to Java Programming and Data Structures, Comprehensive Version (11th Edition)
Starting Out With Visual Basic (7th Edition)
Java How To Program (Early Objects)
Starting Out with Python (3rd Edition)
- Write a function, to be included in an unsorted linked list class, called replace_item, that will receive two parameters, one called olditem, the other called newitem. The function will replace all occurrences of olditem with newitem ( if olditem exists !! ) and it will return the number of replacements done.arrow_forwardAdd the following functions and write a program to test these functions in the class linkedListType: a. Write the definition of a function that returns the data of the kth element of the linked list. If such element is not exist in the list, exit the program. b. Write the definition of a function that deletes the kth element of the linked list. If such element is not exist in the list, exit the program and display message as output. (Subject:Data stracture and algorithm )arrow_forwardAdd the following functions and write a program to test these functions in the class linkedListType: a. Write the definition of a function that returns the data of the kth element of the linked list. If such element is not exist in the list, exit the program. b. Write the definition of a function that deletes the kth element of the linked list. If such element does not exist in the list, exit the program and display message as output.arrow_forward
- Write a function updateList() that takes a two-dimensional list of numbers (e.g., a list of lists containing float and int values) representing measurements and a numeric parameter n and modifies the list so that each value smaller than n is replaced by n. The function does not return any values but instead modifies the list provided as a parameter. The function is also not allowed to create a new list, since the parameter list must be modified. You should assume that the list given to the function will contain numbers and that the second parameter will also be a number (e.g., an int or float), and your function does not have to behave reasonably on any other types of parameters. Note that the list may be empty, in which case it will obviously not be changed by the function. The following shows some sample interactions with the completed function. Note that these examples are just that, and your function must work correctly on any two-dimensional list of numbers:arrow_forwardin c++ : The function insert of the class orderedLinkedList does not check if the item to be inserted is already in the list; that is, it does not check for duplicates. Rewrite the definition of the function insert so that before inserting the item it checks whether the item to be inserted is already in the list. If the item to be inserted is already in the list, the function outputs an appropriate error message. Also write a program to test your function (in the driver file).arrow_forwardMeow¹ eats a lot, and she loves to know in gory detail what she eats in every meal. As her assistant, you are going to implement a function mealCal (meal: list[str], recipes: list[str], db: list[str]) -> float that operates as follows: • The parameter meal is a list of strings, listing the dishes she is having. There may be redundant items: if Meow likes it enough, she may consume multiple servings of the same dish. For example, meal = ["T-Bone", "T-Bone", "Green Salad1"]. • The parameter recipes is a list of strings, representing a "book" of recipes. For example², recipes ["Pork Stew: Cabbage *5, Carrot* 1, Fatty Pork*10", "Green Salad1: Cabbage* 10, Carrot *2, Pineapple*5", "T-Bone: Carrot 2, Steak Meat*1"] Each item is a string indicating the name of the dish, followed by a colon, then a comma-separated list of ingredient names together with their quantities. In the example presented, the item "T-Bone: Carrot *2, Steak Meat *1" ¹a fictitious character from before 2The recipes and…arrow_forward
- in c++arrow_forwardThis exercise asks you to define some functions for manipulating linked structures. You should use the Node and TwoWayNode classes, as defined in this chapter. Create a tester module in the testnode.py file that contains your function definitions and your code for testing them. In the testnode.py file, complete the following: Complete the implementation of the length() function (not len). This function expects a singly linked structure as an argument. Returns the number of items in the structure. To test your program run the main() method in the testnode.py file. Your program's output should look like the following: 0: 0 5: 5arrow_forwardC++arrow_forward
- Links Bing Remaining Time: 1 hour, 24 minutes, 17 seconds. * Question Completion Status: Р QUESTION 8 bbhosted.cuny.edu/webapps/assessment/take/launch.jsp?course_assessment_id=_2271631_1&course_id=_2 Implement the following: 1) Define a function evenList() with an arbitrary parameter a. P 2) This function accepts any number of integer arguments. 3) evenList() stores all even numbers into a list and returns the list. 4) Call the function with 5, 6, 7, 8, 9, 10 as arguments. 5) Print the result of the function call. Make sure to precisely match the output format below. Write your code in the ANSWER area provided below (must include comments if using code is not covered in the course). Example Output [6, 8, 10] For the toolbar, press ALT+F10 (PC) or ALT+FN+F10 (Mac). BIUS Paragraph Arial QUESTION 9 Programs s 10pt Click Save and Submit to save and submit. Click Save All Answers to save all answers. く Ev Avarrow_forwardAn Unsorted Type ADT is to be extended by the addition of functionSplitLists, which has the following specifications:Function: Divides list into two lists according to the key of item.Preconditions: list has been initialized and is not empty.Postconditions: list1 contains all the items of list whose keys are less than orequal to item’s key; list2 contains all the items of list whose keys are greaterthan item’s key. - Implement SplitLists as a client function of the Unsorted list ADTarrow_forwardIn C Programming: Write a function printCourseRow() which receives a course pointer and prints all its fields as a single row. Use proper formatting so that when we print 2 or more courses as rows, the same members align below each other. Test the function, but don’t include the testing code in your homework.Upload a screenshot of a sample output.arrow_forward
- C++ Programming: From Problem Analysis to Program...Computer ScienceISBN:9781337102087Author:D. S. MalikPublisher:Cengage Learning