Homework Solution: void insertAtindex (int insertindex, int data) { if (insertIndex > endOf[Array+1) if (endOfArray – max Size-1) resize(2*maxSize)…

    3) DELL Qu-17 pts) Consider the implementation of the List class using dynamic arrays as disussed in the clasi slides code. Consider the following version of the insertAcindex function. Assume all the other variables and functions to be the same as those in the slides lecture code. void insertAtindexCint insertindex, int data) insertindex- endOfArray+1: if (endOfArraymax Size-1) for (int index insertindex; index endotArray; index++ arrayfinsertindex] - data resize(2maxSize) array index+11-array lindex ]: erdofArray++; Consider an array of S elements with contents as follows: 10 25 45 306 Assume the array has space for an additional element and we call the insertAtindex(2, 40) to insert element 40 at index 2. What will be the contents of the array after the call to the insertAtindex function? Explain your answer.
    void insertAtindex (int insertindex, int data) { if (insertIndex > endOf[Array+1) if (endOfArray - max Size-1) resize(2*maxSize): for (int index = insertIndex: index

    Expert Answer

    3)
    DELL Qu-17 pts) Consider the implementation of the List arrange using dynamic ranks as disussed in the clasi slides order. Consider the subjoined rendering of the infuseAcabjuration discharge. Assume complete the other variables and discharges to be the similar as those in the slides dissertation order. vacant infuseAtindexCint infuseindex, int basis) infuseindex- endOfArray+1: if (endOfArraymax Size-1) ce (int abjuration infuseindex; abjuration endotArray; abjuration++ rankfinsertindex] - basis resize(2maxSize) rank abjuration+11-rank labjuration ]: erdofArray++; Consider an rank of S parts with intervenience as follows: 10 25 45 306 Assume the rank has intervenience ce an added part and we ccomplete the infuseAtindex(2, 40) to infuse part 40 at abjuration 2. What conciliate be the intervenience of the rank succeeding the ccomplete to the infuseAtabjuration discharge? Explain your retort.

    vacant infuseAtabjuration (int infuseindex, int basis) { if (insertAbjuration > endOf[Array+1) if (endOfRank – max Size-1) resize(2*maxSize): ce (int abjuration = infuseIndex: abjuration

    Expert Retort