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
Which sorting methods would be most suitable for sorting a list which is almost sorted  Bubble Sorting method.

The Euclidean algorithm is an algorithm to decide the greatest common divisor of two positive integers. The greatest common divisor of N and M, in short GCD(M,N), is the largest in

Q. Write down an algorithm to test whether a Binary Tree is a Binary Search Tree.              A n s . The algorithm to check whether a Binary tree is as Binary Search

what is tower of management with example

Determine the Components of Illumination The light reaching the eye when looking at a surface has clearly come from a source (or sources) of illumination and bounced off the su

How does operations like insertion, deletion occur?

Generally, Computational complexity of algorithms are referred to through space complexity (space needed for running program) and time complexity (time needed for running the progr

Illustrates the program for Binary Search. Program: Binary Search /*Header Files*/ #include #include /*Functions*/ void binary_search(int array[ ], int value,

Type of Qualitative Method: Different  qualitative methods are suitable for different  types of study. Quite often we can  combine  qualitative and quantitative  methods. Many