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
The two famous methods for traversing are:- a) Depth first traversal b) Breadth first

In this respect depth-first search (DFS) is the exact reverse process: whenever it sends a new node, it immediately continues to extend from it. It sends back to previously explore

Algo rithm to Insert a Node p at the End of a Linked List is explained below Step1:   [check for space] If new1= NULL output "OVERFLOW" And exit Step2:   [Allocate fr

What is called the basic operation of an algorithm? The most significant operation of the algorithm is the operation contributing the most to the total running time is known as

The Ruby Programming Language Although data structures and algorithms we study aren't tied to any program or programming language, we need to write particular programs in speci

This is the most extensively used internal sorting algorithm. In its fundamental form, it was invented by C.A.R. Hoare in the year of 1960. Its popularity lies in the easiness of i

Define a B-Tree Justas AVL trees are balanced binary search trees, B-trees are balanced M-way search trees. A B-Tree of order M is either the empty tree or it is an M-way searc


Consider the file " search_2013 ". This is a text file containingsearch key values; each entry is a particular ID (in the schema given above). You are tosimulate searching over a h

what is tree