logo

Comparing deleteNode and STL Erase Operations

   

Added on  2019-09-16

2 Pages485 Words494 Views
 | 
 | 
 | 
Write a program in C++ to reach a conclusion as to whether or not the deleteNode operation found in the Numberlist class (Program 17.4–Gaddis) is faster than the erase operation found in the Standard Template Library list header file. To come to an accurate conclusion, you need to make sure that both linked list data structures are made up of the exact same data.1. Clearly state the problem that you are trying to solve.2. Hypothesis – What do you believe is the answer?3. Experiment – Describe how your program tests your hypothesis?4. Results – What results did your experiment yield?5. Conclusion – Was your hypothesis correct or incorrect? Explain why or why not.STL List References –http://www.cplusplus.com/reference/list/list/erase/https://msdn.microsoft.com/en-us/library/1fef72t6.aspxNumberlist class (Program 17.4--Gaddis)// This program demonstrates the deleteNode member function.2 #include <iostream>3 #include "NumberList.h"4 using namespace std;56 int main()7 {8 // Define a NumberList object.9 NumberList list;1011 // Build the list with some values.12 list.appendNode(2.5);13 list.appendNode(7.9);14 list.appendNode(12.6);1516 // Display the list.17 cout << "Here are the initial values:\n";18 list.displayList();
Comparing deleteNode and STL Erase Operations_1

End of preview

Want to access all the pages? Upload your documents or become a member.