0% found this document useful (0 votes)
14 views25 pages

Lecture 07-11 - P02

Uploaded by

merajshafi2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views25 pages

Lecture 07-11 - P02

Uploaded by

merajshafi2
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 25

Arrays, Records and Pointers

Instructors:
Md Nazrul Islam Mondal
Department of Computer Science & Engineering
Rajshahi University of Engineering & Technology
Rajshahi-6204
Outline 2/25

• Multidimensional Array
• Pointers: Pointer Array
• Records: Record Structure
• Representation of Records in Memory: Parallel Arrays
• Matrices
• Sparse Matrices

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Multidimensional Array 3/25

• Two dimensional Array:


AJ,K or A[J,K]

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Multidimensional Array 4/25

• Representation of Two dimensional Array in memory:

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Multidimensional Array 5/25

• General Multidimensional Arrays:


BK1 ,k2,k3,….,kn or B[K1,K2, . . . , KN

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Multidimensional Array 6/25

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Multidimensional Array 7/25

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
8/56

Pointers: Pointer Array

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Pointers: Pointer Array 9/25

• Pointer Array

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Pointers: Pointer Array 10/25

• Pointer Array

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
11/56

Records: Record Structure

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Records: Record Structure 12/25

• Differs from a linear array in the following ways –


– A record may be a collection of nonhomogeneous data
– The data items in a record are indexed by attribute name, so
there may not be a natural ordering of its element.

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
13/56

Representation of Records in Memory:


Parallel Arrays

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Representation of Records in
Memory: Parallel Arrays 14/25

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
15/56

Matrices

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Matrices 16/25

• An n-elements vector V –
V = (V1, V2, . . . , Vn)
• An mxn matrix A -

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Matrices 17/25

• Scalar Product of two n-elements vectors V and U –

• Matrix multiplication

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Matrices 18/25

Complexity: O(n3)

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
19/56

Sparse Matrices

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Sparse Matrices 20/25

• High proportion of zero entries.

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Sparse Matrices 21/25

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Sparse Matrices 22/25

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Sparse Matrices 23/25

1st row – 1 element


2nd row – 2 elements
….
Jth row – k elements

(J-1)th row –
1+2 + …. + (J-1)

So L = 1+2+… +(J-1) + K

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
Sparse Matrices 24/25

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers
25/25

END

Rizoan Toufiq, Assistant Prof., CSE, RUET Arrays, Records and Pointers

You might also like