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.

What will be depth do , of complete binary tree of n nodes, where nodes are labelled from 1 to n with root as node and last leaf node as node n

Q. Develop a representation for a list where insertions and deletions can be done at either end. Such a structure is known as a Deque (Double ended queue). Write functions for inse

N = number of rows of the graph D[i[j] = C[i][j] For k from 1 to n Do for i = 1 to n Do for j = 1 to n D[i[j]= minimum( d ij (k-1) ,d ik (k-1) +d kj (k-1)

When writing a code for a program that basically answers Relative Velocity questions how do you go at it? How many conditions should you go through?

algorithm of output restricted queue.

In this example, suppose the statements are simple unless illustrious otherwise. if-then-else statements if (cond) { sequence of statements 1 } else { sequence of st

Q. Describe the basic concept of binary search technique? Is it more efficient than the sequential search?         Ans : The bin ary search technique:- This tec

Draw the process flow diagram: Anand   Dairy (AD) sources 150,000 litres of milk daily from large number of local villagers .The milk is collected from 4:00 AM to 6:00 am and

given the string "Data Structures & , Algorithms", write a program that uses sequential search to return index of ''&''