Calculate the cost of inserting 12 elements in the dynamic array using tight strategy, where the initial array size is 3 and the cost of each operation is 1 unit. Consider the constant "c" used to increase the array size is 3?
Inserting 1st Element = 1
Inserting 2nd Element = 1
Inserting 3rd Element = 1
Increasing size to 6 = 1
Copying the three elements = 3
Inserting 4th Element = 1
Inserting 5th Element = 1
Inserting 6th Element = 1
Increasing size to 9 = 1
Copying the six elements = 6
Inserting 7th Element = 1
Inserting 8th Element = 1
Inserting 9th Element = 1
Increasing size to 12 = 1
Copying the nine elements = 9
Inserting 10th Element = 1
Inserting 11th Element = 1
Inserting 12th Element = 1
Total Cost = 33
Get Answers For Free
Most questions answered within 1 hours.