Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions