Question: 9. (10%) Array Implementations. a) Let A be a two dimensional array with Ne rows and N, columns, whose elements are all of size S.

 9. (10%) Array Implementations. a) Let A be a two dimensional

9. (10%) Array Implementations. a) Let A be a two dimensional array with Ne rows and N, columns, whose elements are all of size S. The access function for A using row major order can be written as location(i.jl_ address( 1,1 l) + ((1-1)"Ne + (H ))" S where we have assumed that the lower bounds of both indices are 1. What is the access function for AllJI using the column major order if the lower bounds of both indices are both 1 what is the access function for ANI using the same column major order if the row-index lower bound is 0 and the column-index lower bound is also 0? b) Assume the memory cells available in a computer are numbered from byte 0 to byte 10000 (decimal). Let Al1:30,1:60] be a two-dimensional array of type float. If the first element of A starts at byte 101, what is the starting address of the element Al10,201 assuming the subscript lower bounds are 1 in both directions and each element is 4 bytes long. Consider two cases Row major order: Column major order: (10%) There have been several proposed solutions to the dandling pointer problem. Among these are the tombstone approach and the locks-and-keys approach. Answer the following questions 10 Draw a diagram to show how heap-dynamic variables are represented in the tombstone approach and explain how this approach can be used to avoid the dangling pointer problem. a) Draw a diagram to show how pointer values and dynamic variables are represented in the locks-and-keys approach and explain how this approach can be used to avoid the dangling pointer problem. b)

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!