Write code for the member method expand


In the class ArrayLinearList a linear list is represented as a one-dimensional array element. The data member size is such that the list elements are in positions 0 through size-1 of the array. The member method expand(e) inserts the element e after each element of the list. For example, if the list element[0:5] = [1, 2, 3, 4, 5, 6], whose size is 6, is expanded with e = 9, the result is [1, 9, 2, 9, 3, 9, 4, 9, 5, 9, 6, 9], whose size is 12. 

(a)
[8] Write code for the member method expand. To keep the code simple, you may assume that the array element has enough capacity and does not need to be resized. Do not assume the existence of any methods for ArrayLinearList. 

(b) [2] What is the time complexity of your code as a function of the list size?

Request for Solution File

Ask an Expert for Answer!!
Basic Computer Science: Write code for the member method expand
Reference No:- TGS0125890

Expected delivery within 24 Hours