1 / 23

Foundation of Computing Systems

Foundation of Computing Systems. Lecture 1 Arrays and Matrices. Arrays. An array is a finite, ordered and collection of homogeneous data elements Finite: because it contains only limited number of elements

loring
Download Presentation

Foundation of Computing Systems

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Foundation of Computing Systems Lecture 1 Arrays and Matrices

  2. Arrays • An array is a finite, ordered and collection of homogeneous data elements • Finite: because it contains only limited number of elements • Ordered: as all the elements are stored one by one in contiguous locations of computer memory in a linear ordered fashion • Homogeneous: all elements of an array are of the same data type only IT 60101: Lecture #1

  3. Arrays: Example IT 60101: Lecture #1

  4. Arrays: Example Address (A[i]) = M + (i – L) x w Size (A) = U – L + 1 IT 60101: Lecture #1

  5. Arrays: Operations • Swap • Traversal • Insertion • Deletion • Merging IT 60101: Lecture #1

  6. Arrays: Operations • Swap • Traversal • Insertion • Deletion • Merging IT 60101: Lecture #1

  7. Arrays: Operations • Swap • Traversal  Searching • Insertion • Deletion • Merging IT 60101: Lecture #1

  8. Arrays: Operations • Swap • Traversal • Insertion • Deletion • Merging IT 60101: Lecture #1

  9. Arrays: Operations • Swap • Traversal • Insertion • Deletion • Merging IT 60101: Lecture #1

  10. Arrays: Operations • Swap • Traversal • Insertion • Deletion • Merging IT 60101: Lecture #1

  11. Multidimensional Arrays • More than one indexing to specify a location • 2-D: row, column • 3-D: row, column, height etc. IT 60101: Lecture #1

  12. Matrix: A 2-D Arrays • Two-dimensional arrays (alternatively termed as matrices) are the collection of homogeneous elements where the elements are ordered in a number of rows and columns • Indexing: row, column IT 60101: Lecture #1

  13. Matrix: Memory Representations • Row-major order Address (aij) = M + (i – 1) x n + j – 1 • Column-major order Address (aij) = M + (j – 1) x m + i – 1 IT 60101: Lecture #1

  14. Sparse Matrix • A sparse matrix is a two-dimensional array having the value of majority elements as null IT 60101: Lecture #1

  15. Sparse Matrix IT 60101: Lecture #1

  16. Triangular Sparse Matrices IT 60101: Lecture #1

  17. Diagonal Sparse Matrices IT 60101: Lecture #1

  18. Tri-Diagonal Sparse Matrices IT 60101: Lecture #1

  19. Band Matrices IT 60101: Lecture #1

  20. Memory Representation of Sparse Matrices • Lower triangular matrix • Row-major order • Column-major order Address (aij) = IT 60101: Lecture #1

  21. Memory Representation of Tridiagonal Matrices • Tri-diagonal matrix • Row-major order Address (aij) = M + 2 x (i – 2) + j + 1 • Column-major order Address (aij) = M + 2 x(j – 2) + i + 1 IT 60101: Lecture #1

  22. Memory Representation of band matrix • Band matrix • Row-major order • ? • Column-major order • ? IT 60101: Lecture #1

  23. Pointer Arrays • Address of memory variable or array is known as pointer and an array containing pointers as its elements is known as pointer array IT 60101: Lecture #1

More Related