Question

Determine the memory address for the following element using row-major order. Show the math.

Given, the base address of the array is 1200.

The array is 9 rows, 12 columns.

Element size is 4.

What is the memory address of Array[9,11]?

for data structure class

Answer #1

Solution:

Given,

=>Base address = 1200

=>Number of rows = 9

=>Number of columns = 12

=>Size of each element = 4 bytes

=>Row-major order is used.

Explanation:

Calculating address of Array[9, 11]:

=>Address of an element Array[i, j] = base address + size of element*(i*number of rows + j*number of columns)

=>Address of Array[9, 11] = 1200 + 4*(9*9 + 11*12)

=>Address of Array[9, 11] = 1200 + 4*(81 + 132)

=>Address of Array[9, 11] = 1200 + 4*(213)

=>Address of Array[9, 11] = 1200 + 852

=>Address of Array[9, 11] = 2052

=>Hence memory address of Array[9, 11] = 2052.

I have explained each and every part with the help of statements attached to it.

1. An array has an index of [5] at the starting address of 200.
It has 3 words per memory cell, determine loc[3],loc[4] and NE. (3
Marks: 1 mark for each)
2. A 2-D array defined as A[10 , 5] requires 4 words of storage
space for each element. Calculate the address of A[4,3] given the
base address as 250
• If the array is stored in Row-major form •
If the array is stored in Column-major form
3. Write...

1. The memory units that follow are specified by the number of
words times the number of bits per word. How many address lines and
input/output data lines are needed in each case? (a) 8K X 16 (b) 2G
X 8 (c) 16M X 32 (d) 256K X 64
2. Give the number of bytes stored in each memory unit in
question 1.
3. Word number 563 decimal in the memory shown in Fig. 7.3 (see
Mano-Ch7.pdf) contains the binary...

1.) Perform the following multiplication using Booth’s
algorithm: (You will receive full credit only if you show all your
work)
13 x -13
(a) 27/4 Using paper pencil approach
and (b) simulate how a machine does this job
2.)Perform the following division as
directed:
(a) 27/4 using non-restoring division algorithm // we need 4
quotient bits.
(b) Using Newton-Raphson algorithm find 1/d when d=0.84 // show
the results of the first 3 iterations
3.) A real-time computer system has...

Consider the following set of sample data, and find the
following (note: if you are using TI 83 to find these values, you
need to write down the formulas that you should have used)
19
12
9
19
0
4
3
14
5
5
24
2
5
7
17
(a). Mean
(b). Median
(c). Mode
(d). Standard Deviation
(e). Variance
(f). Find the z-score for 14.
(i). Construct a Box-whisker plot for the data
(j). Construct a frequency distribution Table....

Java question, Please answer
everything. Thank you
Answer the following questions as briefly (but completely) as
possible:
What is a checked exception, and what is an unchecked
exception?
What is NullPointerException?
Which of the following statements (if any) will throw an
exception? If no exception is thrown, what is the output?
1: System.out.println( 1 / 0 );
2: System.out.println( 1.0 / 0 );
Point out the problem in the following code. Does the code
throw any exceptions?
1: long value...

Using the data given in the table below, answer the following
questions. (Round your final answers to 3 decimal
places.)
Order Size and Shipping Cost (n =
12)
Orders (X)
Ship Cost (Y)
1,011
4,443
1,084
5,671
727
3,358
823
4,138
1,142
4,792
1,189
5,483
823
4,494
947
5,565
784
3,328
695
3,603
1,135
6,597
1,019
5,011
(c)
Find the two-tailed p-value. (Round
your answer to 4 decimal places.)
p-value

Data Structures using C++
Consider the classes QueueADT and ArrayQueueType:
QueueADT:
#ifndef QUEUEADT_H
#define QUEUEADT_H
template <class ItemType>
class QueueADT
{
public:
// Action
responsibilities
virtual void resetQueue() =
0;
// Reset the
queue to an empty queue.
// Post: Queue
is empty.
virtual void add(const
ItemType& newItem) = 0;
// Function to
add newItem to the queue.
// Pre: The
queue exists and is not full.
...

My assignment:
Triplet Template Class Directions:
Define a template class for a generic triplet. The private data
member for the triplet is a generic array with three elements. The
triplet ADT has the following functions:
default constructor
explicit constructor: initialize the data member using
parameters
three accessors (three get functions) which will return the
value of each individual element of the array data member
one mutator (set function) which will assign values to the
data member...

1.
Given the following multi-way if statement, provide a switch
statement, using proper java syntax, that will provide the same
function.
Char grade;
String tstmsg;
if (grade == ‘A’)
{
tstmsg = “Excellent”;
}
else if (grade == ‘B’)
{
tstmsg = “Good”;
}
else if (grade == ‘C’)
{
tstmsg = “OK”;
}
else
{
tstmsg = “Study More”;
}
2.Write the following for statement as a while statement.
for (k = 0; k < 3; k++)
{
System.out.println...

There are N blocks, numbered from 0 to N-1, arranged in a row. A
couple of frogs were sitting together on one block when they had a
terrible quarrel. Now they want to jump away from one another so
that the distance between them will be as large as possible. The
distance between blocks numbered J and K, where JK, is computed as
K-J+1. The frogs can only jump up, meaning that they can move from
one block to another...

ADVERTISEMENT

Get Answers For Free

Most questions answered within 1 hours.

ADVERTISEMENT

asked 1 minute ago

asked 2 minutes ago

asked 6 minutes ago

asked 19 minutes ago

asked 36 minutes ago

asked 37 minutes ago

asked 51 minutes ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago

asked 1 hour ago