Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Complete the Insert() and InsertBack() function of the Chain class. template class Chain; // forward declaration template class ChainNode { friend class Chain ; private:
Complete the Insert() and InsertBack() function of the Chain class. template class Chain; // forward declaration template class ChainNode { friend class Chain; private: T data; ChainNode* link; }; template class Chain { public: Chain() {first = 0;} // constructor initializing first to 0 // Chain manipulation operations InsertBack(const T &e); //insert e to the back of the list Insert(const T &e); //insert e to the beginning of the list II... private: ChainNode * first; } template void Chain::InsertBack(const T& e) //insert e to the back of the li: if (first) { // nonempty chain 1 //fill your code here } else first = new ChainNode(e); } template void Chain::Insert(const T& e) //insert e to the begin of the list { if (first) { // nonempty chain //fill your code here else first = new ChainNode(e)
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