Question: 1. Explain why some items in an array might have to be shifted when a given item is inserted or removed. 2. When the programmer

1. Explain why some items in an array might have to be shifted when a given item is inserted or removed.

2. When the programmer shifts array items during an insertion, which item is moved first: the one at the insertion point or the last item? Why?

4. An array currently contains 14 items, and its load factor is 0.70. What is its physical capacity?

3. Write a code segment that searches a Grid object for a negative integer. The loop should terminate at the first instance of a negative integer in the grid, and the variables row and column should be set to the position of that integer. Otherwise, the variables row and column should equal the number of rows and columns in the grid.

4. Describe the contents of the grid after you run the following code segment: matrix = Grid(3, 3) for row in range(matrix.getHeight()): for column in range(matrix.getWidth()): matrix[row][column] = row * column

5. Write a code segment that creates a ragged grid whose rows contain positions for three, six, and nine items, respectively.

3. Write a code segment that transfers items from a full array to a singly linked structure. The operation should preserve the ordering of the items.

2. Describe one benefit and one cost of a doubly linked structure, as compared to a singly linked structure.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!