Follow

Translate

Sunday, March 13, 2016

Solve Math problem By Using Linear Arrays

Solve Math problem By Using Linear Arrays:


(a) Find the number of elements in each array.
(b) Suppose Base(AAA) = 300 and W = 4 words per memory cell for AAA.  Find the addess of AAA[15], AAA[35] and AAA[55].


(a)  The number of elements is equal to the length; hence use the formula
                                  
                                                          Length = UB - LB + 1

Accordingly,  Length(AAA) = 50 - 5 + 1 = 46
                     Length(BBB)  = 10 - (-5) + 1 = 16
                     Length(CCC) = 18 - 1 + 1 = 18

Note that Length(CCC)  = UB, Since LB = 1

(b)  Use the formula   
                                 LOC(AAA[K])  = base(AAA) + W(K - LB)
      Hence:                 LOC(AAA[15]) = 300 + 4(15 - 5) = 340
                                  LOC(AAA[35]) = 300 + 4(35 - 5) = 420


AAA[55] is not an element of AAA, since 55 exceeds UB = 50
If You want to learn about the technology, computer science & engineering, web programming, freelancing, earning please click here :CSE SOLVE

Related Posts:

  • Huffman's Algorithm Huffman's Algorithm:  Suppose w1 and w2 are two minimum weights among the n given weights w1, w2,..................,wn.Find a tree T Prime which gives a solution for the n - 1 weights       w1 + w2,… Read More
  • Searching A Link List LIST Is Unsorted:   Algorithm:  SEARCH(INFO, LINK, START, ITEM, LOC) LIST is a linked list in memory. This algorithm finds the location LOC of the node where ITEM fistn appears in LIST, or sets LOC = NU… Read More
  • Deleting the Node with a Given ITEM of Information Procedure:   FINDB(INFO, LINK, START, ITEM, LOC, LOCP) This procedure finds the location LOC of the first node N which contains ITEM and the location LOCP of the node preceding N. If ITEM does not appear in the… Read More
  • Deleting the Node with a Given ITEM of Information Procedure:   DELETE(INFO, LINK, START, AVAIL, ITEM) This algorithm deletes from a linked list the first node N which contains given ITEM of information. 1.  [Use procedure FINDB to find the location o… Read More
  • PATH LENGTH: HUFFMAN'S ALGORITHM PATH LENGTH: HUFFMAN'S ALGORITHM: An extended binary tree or 2-tree is a binary tree T which each node has either 0 or 2 node children. The nodes with 0 children are called external nodes. and the nodes with 2 children ar… Read More

0 comments:

Post a Comment