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
Algorithm for Z-Buffer Method (a)  Initialize every pixel in the viewport to the smallest value of z, namely z0 the z-value of the rear clipping plane or "back-ground". Store a

write an algorithm for multiplication of two sparse matrices using Linked Lists

Q. A Binary tree comprises 9 nodes. The preorder and inorder traversals of the tree yield the given sequence of nodes: Inorder :          E     A    C    K    F     H    D

Define an array. Array is made up of same data structure that exists in any language. Array is set of same data types. Array is the collection of same elements. These same elem

If quicksort is so quick, why bother with anything else? If bubble sort is so bad, why even mention it? For that matter, why are there so many sorting algorithms? Your mission (sho

Write an algorithm in the form of a flowchart that: inputs top speeds (in km/hr.) of 5000 cars Outputs fastest speed and the slowest speed Outputs average (mean) s

Explain the term - Branching There are two common ways of branching: case of ..... otherwise ...... endcase  if ..... then ..... else ..... endif   case of

Double Linked List In a doubly linked list, also known as 2 way lists, each node is separated into 3 parts. The first part is called last pointer field. It has the address of t

Determination of Time Complexity The RAM Model The random access model (RAM) of computation was devised through John von Neumann to study algorithms. In computer science,

Illustrate the Back Face Detection Method A single polyhedron is a convex solid, which has no external angle between faces less  than 180° and there is a simple object space me