Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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*

image text in transcribed

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* 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 #include  using 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; }; 
Project 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 include clock t begin, end double time spenti begin clock(); end clock ) time spent (double) (end-begin) CLOCK PER SEC Example output: Time creating linked list: (HIDDEN) Time creating vector: (HIDDEN) Time creating vector of pointers to contact nodes: (HIDDEN)

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Oracle Database 10g Insider Solutions

Authors: Arun R. Kumar, John Kanagaraj, Richard Stroupe

1st Edition

0672327910, 978-0672327919

More Books

Students also viewed these Databases questions

Question

Explain the difference between opportunities and ideas.

Answered: 1 week ago

Question

How would you describe your typical day at work?

Answered: 1 week ago

Question

2. Write two or three of your greatest weaknesses.

Answered: 1 week ago