Latest Activity In Study Groups

Join Your Study Groups

VU Past Papers, MCQs and More

We non-commercial site working hard since 2009 to facilitate learning Read More. We can't keep up without your support. Donate.

Please read the following instructions carefully before solving & submitting assignment:

Uploading Instructions:

  • You are supposed to consult recommended book/s to clarify your concepts as handouts are not sufficient.
  • The assignment file must be an MS Word file. Any other software/tool is not allowed.
  • The required file format is .doc or .docx. Any other formats like scan images, PDF, png or jpeg etc. will not be accepted.
  • Place all solutions in a single Word file, save with your own Student ID (g., bs1234567890.docx) and submit at VULMS within the due date.
  • No assignment will be accepted through email.

 

 

Rules for Marking:

It should be cleared that your assignment will not get any credit if:

  • The assignment is submitted after due date.
  • The assignment is not submitted in .doc or .docx format.
  • The submitted assignment does not open or file is corrupt.
  • The assignment is fully or partially copied from other student or ditto copy from handouts or Internet; strict disciplinary action will be taken in this case.
  • The submitted file contains Student Id other than yours; Zero Marks will be awarded, and no excuse will be accepted in any case.

 

Note:

  • No assignment will be accepted after the due date via email in any case (whether it is the case of load shedding or internet malfunctioning etc.). Hence refrain from uploading assignment in the last hour of deadline.
  • It is recommended to upload solution file at least one day before its closing date.
  • If you find any mistake or confusion in assignment (Problem Statement), please consult with your instructor before the deadline. After the deadline, no queries will be entertained in this regard.
  • Do not put any query on MDB regarding this assignment, if you have any query then email at cs508@vu.edu.pk

 

Lectures Covered: This assignment covers Lectures # 1 to 8.


 

Two-dimensional Array in Memory:    

 

An array is a data structure that is used to store the data of same type in most programming languages, which can be either one-dimensional or two-dimensional. A two-dimensional array consists of rows and columns but as you may know that data in physical memory is stored linearly, so a two-dimensional array must be converted into a linear address space for storage into memory. The reverse process of this would be to take linearly stored data from memory and convert it into two-dimensional array (i.e., rows and columns). Some programming languages store two-dimensional array in memory as column-wise (i.e., column major implementation) while others store it as row-wise (i.e., row major implementation). If a programmer already knows that how a programming language implements two-dimensional array in memory then s/he can process it more efficiently. 

 

Question # 1:                                                                                            Marks: 10

 

  1. a) Keeping in view the above discussion, consider the following as a memory storage that occupies a linear address space by using the row-wise (e., row major) implementation. You are required to convert it into a two-dimensional array as shown below.

 

Row-wise (row major) implementation in Memory:

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

Two-dimensional Array:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

  1. b) Now, consider the following as a column-wise (e., column major) implementation. So, convert it into a two-dimensional array as shown below.

 

Column-wise (column major) implementation in Memory:

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

Two-dimensional Array:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

 

 

Question # 2:                                                                                            Marks: 10

 

Consider the following as a two-dimensional array. You are required to convert it into a linear address space by using the row-wise (row major) and column-wise (column major) implementations as shown below.

 

Two-dimensional Array:

 

U

V

U

L

O

P

A

L

A

T

O

P

H

A

R

Y

N

G

O

P

L

A

S

T

Y

 

 

  1. a) Row-wise (row major) implementation in Memory:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

 

  1. b) Column-wise (column major) implementation in Memory:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

 

 

Good Luck

Views: 386

Attachments:

Replies to This Discussion

Stay touched with this discussion, Solution idea will be uploaded as soon as possible in replies here before the due date.

CS508 (Statistics and Probability) Assignment No.1 Solution Fall 2021

CS508 Assignment Solution Fall 2021 file link

CS508-Assignment-1-Solution-Fall-2021-By-VU-Ning.pdf

CS508 ASSIGNMENT 1 SOLUTION FALL 2021

Due Date: 10 Dec 2021

Total Marks: 20

 

Instruction Follows:

Upload your assignment .doc or docx format only.

Place all solutions in a single Word file, save with your own Student ID (e.g., bs1234567890.docx) and submit at VULMS within the due date.

 

Question 1:

 

Part (a):

Keeping in view the above discussion, consider the following as a memory storage that occupies a linear address space by using the row-wise (i.e., row major) implementation. You are required to convert it into a two-dimensional array as shown below.

 

Row-wise (row major) implementation in Memory:

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

Two-dimensional Array:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

 

Solution:

 

Row-wise (row major) implementation in Memory:

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

Two-dimensional Array:

 

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

Part (b)

Now, consider the following as a column-wise (i.e., column major) implementation. So, convert it into a two-dimensional array as shown below.

 

Column-wise (column major) implementation in Memory:

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

Two-dimensional Array:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

Solution:

 

Column-wise (column major) implementation in Memory:

 

 

A

N

T

I

E

S

T

A

B

L

I

S

H

M

E

N

T

A

R

I

A

N

I

S

M

 

 

 

Two-dimensional Array:

 

 

A

S

I

N

A

N

T

S

T

N

T

A

H

A

I

I

B

M

R

S

E

L

E

I

M

 

Question 2:

Consider the following as a two-dimensional array. You are required to convert it into a linear address space by using the row-wise (row major) and column-wise (column major) implementations as shown below.

 

Two-dimensional Array:

 

U

V

U

L

O

P

A

L

A

T

O

P

H

A

R

Y

N

G

O

P

L

A

S

T

Y

 

Part (a)

Row-wise (row major) implementation in Memory:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

Solution:

 

Row-wise (row major) implementation in Memory:

 

U

V

U

L

O

P

A

L

A

T

O

P

H

A

R

Y

N

G

O

P

L

A

S

T

Y

 

 

Part (b)

Column-wise (column major) implementation in Memory:

 

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

?

 

Solution:

 

Column-wise (column major) implementation in Memory:

 

 

U

P

O

Y

L

V

A

P

N

A

U

L

H

G

S

A

L

A

O

T

O

T

R

P

Y

 

 

 

 

Download attachment for CS508 assignment 1 solution file in MS Word (DOCx) format.

Download attachment for CS508 assignment 1 solution file in MS Word (DOCx) format.

CS508_1_Sol_F21_VU-Ning.docx

RSS

© 2022   Created by + M.Tariq Malik.   Powered by

Promote Us  |  Report an Issue  |  Privacy Policy  |  Terms of Service