Question
Below are the Contacts.cpp and Contacts.h file contents. Please read fully Contacts.cpp #include using namespace std; #include Contacts.h ContactNode::ContactNode() {} ContactNode::ContactNode(string initName, string initPhoneNum, ContactNode*
Below are the Contacts.cpp and Contacts.h file contents. Please read fully
Contacts.cpp
#include
#include "Contacts.h"
ContactNode::ContactNode() {}
ContactNode::ContactNode(string initName, string initPhoneNum, ContactNode* nextLoc) { this->contactName = initName; this->contactPhoneNum = initPhoneNum; this->nextNodePtr = nextLoc; return; }
void ContactNode::InsertAfter(ContactNode* nodePtr) { ContactNode* tmpNext = 0;
tmpNext = this->nextNodePtr; this->nextNodePtr = nodePtr; nodePtr->nextNodePtr = tmpNext; return; }
string ContactNode::GetName() const { return this->contactName; }
string ContactNode::GetPhoneNumber() const { return this->contactPhoneNum; }
ContactNode* ContactNode::GetNext() { return this->nextNodePtr; }
void ContactNode::PrintContactNode() { cout contactName contactPhoneNum
Contacts.h
#ifndef CONTACTS_H #define CONTACTS_H #includeProject 10 C++ Create a Linkedi.ist Class: class LL public: LL O2 void InsertFront (ContactNode cn) i void InsertBack (ContactNode cn) void Printlist : private: 2 ContactNode head ContactNode tail: Write a program that: 1) Creates a linked 1ist of 50000 ContactNodes (from Contacts.h and Contacts.cpp). Insert each ContactNode to the front of the 1ist. Time how long it takes to insert all of the nodes into your linked ist 2) Creates a vector. Add 50000 Contacthodes (from Contacts.h and Contacts.cpp) to your vector by inserting them one at a time at the beginning of the vector. Your vector contains Contactlodes (not pointers to contact nodes). Time how long it takes to insert all of the nodes into your vector 3) Creates a vector. Add 50000 pointers to ContactNodes (from Contacts.h and Contacts.cpp) to your vector by inserting them one at a time at the beginning of the vector. Time how long it takes to insert all of the pointers into your vector includeusing namespace std; class ContactNode { public: ContactNode(); ContactNode(string initName, string initPhoneNum, ContactNode* nextLoc = 0); void InsertAfter(ContactNode* nodePtr); string GetName() const; string GetPhoneNumber() const; ContactNode* GetNext(); void PrintContactNode(); private: string contactName; string contactPhoneNum; ContactNode* nextNodePtr; };
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