Answered step by step
Verified Expert Solution
Question
1 Approved Answer
c++ problem Use the code provided to you under lab 6(or copy it from the end of the question), read and understand how it works.
c++ problem
Use the code provided to you under lab 6(or copy it from the end of the question), read and understand how it works. Create a main.cpp file to test the functionalities provided to you. Add to the linked List class the functionalities required below. Test each new functionality added in the main before proceeding to the next. 1- 2- toString() member method that will print the values stored in each node. Example: If your linked list contains the numbers 6, 8 and 1 respectively, the toString) function should print [6, 8,1] removeValuelint val) member method that takes an int value. This method should remove all nodes containing the value passed to the function. For example: if your linked list contains the numbers 1, 4, 6, 4, 7, 8 and removeValue(4) was executed, your linked list should contain 1, 6, 7, a- b- printDuplicates() member method that will print values repeated more than once consecutively. For example, if your list contains 1, 4, 4, 6, 1,5 this function should print: 4 transferFrom () member method that accepts a second linked list as a parameter and that moves values from the second list to this list. It should append the elements in the second list to the first list and empty the second list. For example, suppose two lists store these sequences of values: list1: [8, 17, 2, 4] and list2: [1, 2, 3] The call of list1.transferFrom(list2); should leave the lists as follows: list1: [8, 17, 2, 4, 1,2,3] list2: [ c- d- e- sortlist() member method that will sort the linked list. Example: if your linked list contains the f- reverselist() member method that will reverse the linked list. Example: if your linked list contains B checkRange(int max, int min) member method that returns true if all elements in a given list are numbers 6, 8 and 1 respectively, the sortList() should fix the List to 1, 6, 8 respectively. the numbers 6, 8 and 1 respectively, the reverselist() should fix the list to 1, 8 and 6 respectively. within a given range (min, max), false otherwise. For example: if min was 2, max was 7 and the list was 1, 6, 9 and 2, we should return false since 1 is smaller than 2. h- evenNodes() member method that recursively return the number of even nodes. - oddNodes() member method that recursively return the number of odd nodes. Node.h Node public: int elem; // element in the node Node next; // Node(; Node (int data); pointer to the next element Node.cpp #include #include Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started