Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

HELP WITH C++ CODE.......... How would I implement this code. void List::insert(int index, Planet * p){ //inserts an element at index, increasing the List size

HELP WITH C++ CODE..........

How would I implement this code.

void List::insert(int index, Planet * p){

//inserts an element at index, increasing the List size by 1

//if the insert index is out of bounds, you should append to the end of the list

}

Here is the header file for doubly linked list...

#ifndef LIST_H #define LIST_H #include "Planet.h" #include class Node { friend class List; //allow list class to access private fields private: Planet *planet; Node *next; Node *prev; public: Planet* getPlanet(){return this->planet;} Node(Planet * p); };

class List{ private: Node *head; Node *tail; public: List(); ~List(); void insert(int index, Planet * p); Planet * read(int index); bool remove(int index); unsigned size(); };

#endif

Would appreciate any help!!

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

Practical Issues In Database Management A Refernce For The Thinking Practitioner

Authors: Fabian Pascal

1st Edition

0201485559, 978-0201485554

More Books

Students also viewed these Databases questions

Question

Identify conflict triggers in yourself and others

Answered: 1 week ago