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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started