Question: Function 7: int insert(const int index, const char word[]); Specification: Inserts the word at index in Wordlist. If Wordlist does not have enough capacity to

Function 7: int insert(const int index, const char word[]);

Specification: Inserts the word at index in Wordlist. If Wordlist does not have enough capacity to insert word, insert will resize with just enough space to allow for the addition of word. If the index is less than 0 insert into the front of the Wordlist. If the index is greater than the next available location in the wordlist insert the word as the last word in the Wordlist. If insert needed to resize then return 1, otherwise if there already enough space to insert word without resizing, return 0. If word is empty do nothing return -1. If words is nullptr, insert the word as before except return -2.

Usage: Wordlist *wordlist = new Wordlist(5);

wordlist->insert(0,"hermione"); wordlist->insert(0,""ron"); wordlist->insert(0,""harry");

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!