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 vests as disussed in the clasi slides sequence. Consider the subjoined statement of the suggestAcapostacy office. Assume every the other variables and offices to be the identical as those in the slides dissertation sequence. vacant suggestAtindexCint suggestindex, int postulates) suggestindex- endOfArray+1: if (endOfArraymax Size-1) coercion (int apostacy suggestindex; apostacy endotArray; apostacy++ vestfinsertindex] - postulates resize(2maxSize) vest apostacy+11-vest lapostacy ]: erdofArray++; Consider an vest of S components with variation as follows: 10 25 45 306 Assume the vest has interval coercion an additional component and we cevery the suggestAtindex(2, 40) to suggest component 40 at apostacy 2. What obtain be the variation of the vest behind the cevery to the suggestAtapostacy office? Explain your apology.

    vacant suggestAtapostacy (int suggestindex, int postulates) { if (insertApostacy > endOf[Array+1) if (endOfVest – max Size-1) resize(2*maxSize): coercion (int apostacy = suggestIndex: apostacy

    Expert Apology