Linear array - numerical, Data Structure & Algorithms

Q. A linear array A is given with lower bound as 1. If address of A[25] is 375 and A[30] is 390, then find address of A[16].                                                     

 

Ans.

Loc (a[k]) = base (a) + w (k-lb)

375 = base (a) + w(25 - 1)

390 = base (a) + w(30 - 1)

375 = x + 24w

390 = x + 29w

 

15 = 5w

∴ w = 3

∴ x = 375 - 24 *3

x = 375 - 72

x = 303

∴base address is 303 and w = 3.

∴Address of A[16] is

loc = 303+ 3(16-1) = 348.

Posted Date: 7/13/2012 1:12:59 AM | Location : United States







Related Discussions:- Linear array - numerical, Assignment Help, Ask Question on Linear array - numerical, Get Answer, Expert's Help, Linear array - numerical Discussions

Write discussion on Linear array - numerical
Your posts are moderated
Related Questions
Encryption the plain-text using the round keys: 1. (Key schedule) Implement an algorithm that will take a 128 bit key and generate the round keys for the AES encryption/decryp

An advertising project manager developed the network diagram shown below for a new advertising campagign.  In addition, the manager gathered the time information for each activity,

Worst Fit method:- In this method the system always allocate a portion of the largest free block in memory. The philosophy behind this method is that by using small number of a ve

I was wanting to know where this web site was created. My second question is,,, are the online tuters accredited teachers? If they are, are they only working for the website or ma

Instructions Design and test a reference array. Reference array stores the references to user supplied objects of different types. Just think it as a heterogeneous array wh

The above 3 cases are also considered conversely while the parent of Z is to the right of its own parent. All the different kind of cases can be illustrated through an instance. Le

This question is based on the requirements of a system to record band bookings at gigs. (A 'gig' is an event at which one or more bands are booked to play). You do not need to know

Indexed Sequential Files An index is inserted to the sequential file to provide random access. An overflow area required to be maintained to permit insertion in sequence. I

Phong Shading Phong shading too is based on interpolation, but instead of interpolating the colour value, it is the normal vector, which is interpolated for each point and a co

Enumerate about the concept of container A Container can have a size() operation. We can also ask (somewhat redundantly) whether a Container is empty. And even though a Contain