Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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.

image text in transcribed
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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Accidental Data Scientist

Authors: Amy Affelt

1st Edition

1573877077, 9781573877077

More Books

Students also viewed these Databases questions

Question

What are you afraid of?

Answered: 1 week ago