title
1.5 Introduction to Two Dimensional (2D) Arrays | Implementation of 2D Arrays |Memory representation
description
Definition of Two-Dimensional Arrays (2D arrays)
Declaration of 2D Array
Initialization of 2D Array
Implementation of 2D Array/Memory Representation of 2D Array
Row-major and Column-major Implementation
Accessing elements of 2D Array
DSA Full Course: https: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bbKJzrsKfMpo_grxuLl8LU
******************************************
See Complete Playlists:
C Programming Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31a8UcMN9-35ghv8qyFWD9_S
C++ Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YU5Wx1dopka58teWP9aCee
Python Full Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31bZSiqiOL5ta39vSnBxpOPT
Printing Pattern in C: https://www.youtube.com/playlist?list=PLdo5W4Nhv31Yu1igxTE2x0aeShbKtVcCy
DAA Course: https://www.youtube.com/playlist?list=PLdo5W4Nhv31ZTn2P9vF02bkb3SC8uiUUn
Placement Series: https://www.youtube.com/playlist?list=PLdo5W4Nhv31YvlDpJhvOYbM9Ap8UypgEy
Dynamic Programming: https://www.youtube.com/playlist?list=PLdo5W4Nhv31aBrJE1WS4MR9LRfbmZrAQu
Operating Systems: //www.youtube.com/playlist?list=PLdo5W4Nhv31a5ucW_S1K3-x6ztBRD-PNa
DBMS: https://www.youtube.com/playlist?list=PLdo5W4Nhv31b33kF46f9aFjoJPOkdlsRc
***************************************************
Connect & Contact Me:
Facebook: https://www.facebook.com/Jennys-Lectures-CSIT-Netjrf-316814368950701/
Quora: https://www.quora.com/profile/Jayanti-Khatri-Lamba
Instagram: https://www.instagram.com/jayantikhatrilamba/
detail
{'title': '1.5 Introduction to Two Dimensional (2D) Arrays | Implementation of 2D Arrays |Memory representation', 'heatmap': [{'end': 1522.873, 'start': 1444.511, 'weight': 0.707}, {'end': 1701.285, 'start': 1648.92, 'weight': 0.806}, {'end': 1766.211, 'start': 1718.695, 'weight': 0.854}, {'end': 2019.777, 'start': 1968.461, 'weight': 0.82}], 'summary': 'Covers the implementation and storage of 2d arrays, initialization using nested for loops, memory representation, and array addressing, emphasizing the relationship between 1d and 2d arrays and addressing methods for efficient data access.', 'chapters': [{'end': 260.826, 'segs': [{'end': 99.225, 'src': 'embed', 'start': 68.737, 'weight': 0, 'content': [{'end': 74.518, 'text': 'so 2D array is also known as a matrix to represent this thing in computer memory we use what?', 'start': 68.737, 'duration': 5.781}, {'end': 77.779, 'text': 'two dimension arrays or 2D arrays?', 'start': 74.518, 'duration': 3.261}, {'end': 83.3, 'text': 'fine, see, we have discussed how to declare 1D array simple data type.', 'start': 77.779, 'duration': 5.521}, {'end': 87.201, 'text': 'you will write name of the array and then size of the array.', 'start': 83.3, 'duration': 3.901}, {'end': 89.775, 'text': 'suppose size is 3.', 'start': 87.201, 'duration': 2.574}, {'end': 92.878, 'text': 'so this is declaration of 1D array.', 'start': 89.775, 'duration': 3.103}, {'end': 99.225, 'text': 'I have given only one size because here in this case we are having only one dimension.', 'start': 92.878, 'duration': 6.347}], 'summary': '2d arrays, also called matrices, use two dimensions in computer memory. declaration of 1d array involves writing the array name and size, e.g., size 3.', 'duration': 30.488, 'max_score': 68.737, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL868737.jpg'}], 'start': 0.129, 'title': 'Implementing and declaring 2d arrays', 'summary': 'Covers the implementation of 2d arrays, including declaration and representation in memory, emphasizing the relationship between 1d and 2d arrays. it also explains the declaration of a 2d array and discusses the concept of 1d and 2d arrays, covering their declaration, size, and initialization methods.', 'chapters': [{'end': 92.878, 'start': 0.129, 'title': '2d array implementation', 'summary': 'Discusses the implementation of 2d arrays, including how to declare a 2d array and representing a matrix in computer memory. it also emphasizes the relationship between 1d and 2d arrays and provides a link for further reference.', 'duration': 92.749, 'highlights': ['The chapter discusses the implementation of 2D arrays, including how to declare a 2D array and representing a matrix in computer memory.', 'Emphasizes the relationship between 1D and 2D arrays and provides a link for further reference.', 'Explains the declaration of 1D array simple data type, mentioning the array name and size, for easy understanding of 2D arrays.']}, {'end': 171.686, 'start': 92.878, 'title': 'Declaration of 2d array', 'summary': 'Discusses the declaration of a 2d array, explaining the concept of size and subscripts, with an example of a 3x3 matrix and its representation as an array of arrays.', 'duration': 78.808, 'highlights': ['The declaration of a 2D array involves specifying two sizes, one for the rows and another for the columns, such as 3x3, with each size representing the number of rows and columns respectively.', 'The concept of 2D arrays is illustrated through the example of representing a 3x4 matrix, emphasizing that it is essentially an array of arrays, providing a clear understanding of the topic.', 'The discussion emphasizes the relationship between the subscripts and the dimensions of the 2D array, with detailed explanations of how to declare and understand the size for rows and columns.']}, {'end': 260.826, 'start': 171.686, 'title': 'Understanding 1d and 2d arrays', 'summary': 'Discusses the concept of 1d and 2d arrays, covering their declaration, size, and initialization methods, emphasizing that 2d arrays are arrays of arrays and can be initialized at both compile time and runtime.', 'duration': 89.14, 'highlights': ['The chapter explains the concept of 1D and 2D arrays, emphasizing the declaration and size of arrays, with examples of 1D arrays having size four and 2D arrays comprising 1D arrays of size four each.', 'It highlights that a 2D array is an array of arrays or a matrix, comprising 3 1D arrays, each of size 4, providing a clear understanding of the structure.', 'The chapter covers the initialization of 1D and 2D arrays, stating that both compile-time and runtime initialization methods are applicable for 2D arrays as well, demonstrating the versatility of array initialization.']}], 'duration': 260.697, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8129.jpg', 'highlights': ['The chapter covers the implementation of 2D arrays, including how to declare a 2D array and representing a matrix in computer memory.', 'The declaration of a 2D array involves specifying two sizes, one for the rows and another for the columns, such as 3x3, with each size representing the number of rows and columns respectively.', 'The chapter explains the concept of 1D and 2D arrays, emphasizing the declaration and size of arrays, with examples of 1D arrays having size four and 2D arrays comprising 1D arrays of size four each.']}, {'end': 594.736, 'segs': [{'end': 318.909, 'src': 'embed', 'start': 288.218, 'weight': 0, 'content': [{'end': 289.579, 'text': '6 values can be there here.', 'start': 288.218, 'duration': 1.361}, {'end': 291.66, 'text': '1, 2, 3, 4, 5, 6 as you can see.', 'start': 289.819, 'duration': 1.841}, {'end': 297.322, 'text': 'If you want to calculate the size of this 2D array, 6 values can be there.', 'start': 292.78, 'duration': 4.542}, {'end': 301.243, 'text': 'That is 2 into 3 is equal to 6.', 'start': 298.122, 'duration': 3.121}, {'end': 302.604, 'text': 'data type is int.', 'start': 301.243, 'duration': 1.361}, {'end': 304.264, 'text': 'each value is going to take.', 'start': 302.604, 'duration': 1.66}, {'end': 305.485, 'text': 'each variable is sorry.', 'start': 304.264, 'duration': 1.221}, {'end': 308.266, 'text': 'each value is going to take 4 bytes.', 'start': 305.485, 'duration': 2.781}, {'end': 311.187, 'text': 'so 6 into 4, that is 24 bytes.', 'start': 308.266, 'duration': 2.921}, {'end': 314.428, 'text': '24 bytes would be allocated to this array.', 'start': 311.187, 'duration': 3.241}, {'end': 316.569, 'text': 'now how the elements are to be stored in memory.', 'start': 314.428, 'duration': 2.141}, {'end': 318.909, 'text': 'we are going to discuss that thing also.', 'start': 316.569, 'duration': 2.34}], 'summary': 'A 2d array with 6 values, each taking 4 bytes, allocates 24 bytes in memory.', 'duration': 30.691, 'max_score': 288.218, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8288218.jpg'}, {'end': 487.707, 'src': 'embed', 'start': 452.896, 'weight': 3, 'content': [{'end': 455.857, 'text': 'this is row one and this is row two.', 'start': 452.896, 'duration': 2.961}, {'end': 457.098, 'text': 'this is a clear cut method.', 'start': 455.857, 'duration': 1.241}, {'end': 466.98, 'text': 'fine. or you can also write something like this int a and three, and here you can write the values.', 'start': 458.015, 'duration': 8.965}, {'end': 469.941, 'text': 'fine, this is optional.', 'start': 466.98, 'duration': 2.961}, {'end': 479.026, 'text': "if you don't give the size here in the in the first subscript, that is optional and you give the size here, that that is fine, fine,", 'start': 469.941, 'duration': 9.085}, {'end': 481.347, 'text': 'but this is not accepted.', 'start': 479.026, 'duration': 2.321}, {'end': 487.707, 'text': 'You cannot leave this subscript blank.', 'start': 485.08, 'duration': 2.627}], 'summary': 'Describes a method for writing values, emphasizing the importance of specifying size.', 'duration': 34.811, 'max_score': 452.896, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8452896.jpg'}, {'end': 564.952, 'src': 'embed', 'start': 531.782, 'weight': 4, 'content': [{'end': 537.923, 'text': 'suppose, in memory, memory manager has assigned a base address 100.', 'start': 531.782, 'duration': 6.141}, {'end': 540.883, 'text': 'this array is going to start from 100.', 'start': 537.923, 'duration': 2.96}, {'end': 546.824, 'text': 'so see, this base address is 100 for this element.', 'start': 540.883, 'duration': 5.941}, {'end': 551.348, 'text': 'right for next element, 104.', 'start': 546.824, 'duration': 4.524}, {'end': 552.128, 'text': 'why so?', 'start': 551.348, 'duration': 0.78}, {'end': 559.91, 'text': 'because, say this, this value is going to take 4 bytes 100, 101, 102 and 103.', 'start': 552.128, 'duration': 7.782}, {'end': 563.191, 'text': 'from 104, you can store the next value.', 'start': 559.91, 'duration': 3.281}, {'end': 564.952, 'text': 'fine, here we are going to.', 'start': 563.191, 'duration': 1.761}], 'summary': 'Memory manager assigns base address 100, each element takes 4 bytes.', 'duration': 33.17, 'max_score': 531.782, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8531782.jpg'}], 'start': 260.826, 'title': '2d array storage', 'summary': 'Explains calculating and storing 2d arrays in memory. it covers array size calculation, demonstrating 6 values of 4 bytes each for an allocation of 24 bytes, and memory storage methods, including initialization and addressing.', 'chapters': [{'end': 314.428, 'start': 260.826, 'title': 'Array size calculation', 'summary': 'Explains how to calculate the size of a 2d array, which contains 6 values, each of 4 bytes, resulting in an allocation of 24 bytes.', 'duration': 53.602, 'highlights': ['The size of the 2D array is calculated as 2 rows multiplied by 3 columns, resulting in 6 values (2x3=6).', 'Each value in the array is of data type int and takes 4 bytes, hence the total allocation is 6 values multiplied by 4 bytes, equaling 24 bytes.']}, {'end': 594.736, 'start': 314.428, 'title': 'Memory storage of 2d arrays', 'summary': 'Explains the storage of 2d arrays in memory, demonstrating two methods of initialization and addressing the size allocation and memory addressing for the array elements.', 'duration': 280.308, 'highlights': ['The chapter details the representation of 2D arrays in memory, illustrating the indexing starting from zero, and demonstrating the allocation of 24 bytes for a 2x3 array.', 'It discusses two methods of initializing 2D arrays, providing clarity on the optional and mandatory specifications for row and column sizes, and the implications of leaving the subscript blank.', 'The chapter emphasizes the allocation of memory for 2D arrays at runtime, highlighting the base address allocation and the contiguous memory allocation for the array elements.']}], 'duration': 333.91, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8260826.jpg', 'highlights': ['The size of the 2D array is calculated as 2 rows multiplied by 3 columns, resulting in 6 values (2x3=6).', 'Each value in the array is of data type int and takes 4 bytes, hence the total allocation is 6 values multiplied by 4 bytes, equaling 24 bytes.', 'The chapter details the representation of 2D arrays in memory, illustrating the indexing starting from zero, and demonstrating the allocation of 24 bytes for a 2x3 array.', 'It discusses two methods of initializing 2D arrays, providing clarity on the optional and mandatory specifications for row and column sizes, and the implications of leaving the subscript blank.', 'The chapter emphasizes the allocation of memory for 2D arrays at runtime, highlighting the base address allocation and the contiguous memory allocation for the array elements.']}, {'end': 925.198, 'segs': [{'end': 683.427, 'src': 'embed', 'start': 649.671, 'weight': 1, 'content': [{'end': 650.712, 'text': 'three values.', 'start': 649.671, 'duration': 1.041}, {'end': 654.915, 'text': 'so for this also we are going to take one, another variable.', 'start': 650.712, 'duration': 4.203}, {'end': 660.699, 'text': 'so two for loops would be required, one for loop for this row and one for loop for this columns.', 'start': 654.915, 'duration': 5.784}, {'end': 663.901, 'text': 'we are going to take one for loop, that is, i is equal to zero.', 'start': 660.699, 'duration': 3.202}, {'end': 665.442, 'text': 'i would be started from zero.', 'start': 663.901, 'duration': 1.541}, {'end': 667.303, 'text': 'i less than row.', 'start': 665.442, 'duration': 1.861}, {'end': 668.543, 'text': 'size, size of row is what 2.', 'start': 667.303, 'duration': 1.24}, {'end': 671.544, 'text': 'so i less than 2, 0 and 1.', 'start': 668.543, 'duration': 3.001}, {'end': 674.305, 'text': 'fine, and i plus plus.', 'start': 671.544, 'duration': 2.761}, {'end': 675.385, 'text': 'within this for loop.', 'start': 674.305, 'duration': 1.08}, {'end': 683.427, 'text': 'now another for loop would be there, because when we are when i value is 0, then here, here and here you are going to store data here.', 'start': 675.385, 'duration': 8.042}], 'summary': 'Two for loops are required, one for rows and one for columns, with row size of 2.', 'duration': 33.756, 'max_score': 649.671, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8649671.jpg'}, {'end': 735.794, 'src': 'embed', 'start': 703.288, 'weight': 0, 'content': [{'end': 707.012, 'text': 'scanner function would be used %d.', 'start': 703.288, 'duration': 3.724}, {'end': 715.099, 'text': 'now, address of a of i and j.', 'start': 707.012, 'duration': 8.087}, {'end': 717.322, 'text': 'because here two indexes are there.', 'start': 715.099, 'duration': 2.223}, {'end': 717.982, 'text': 'one is i.', 'start': 717.322, 'duration': 0.66}, {'end': 719.664, 'text': 'one is for this column.', 'start': 717.982, 'duration': 1.682}, {'end': 721.466, 'text': 'so you are going to write i and j.', 'start': 719.664, 'duration': 1.802}, {'end': 726.392, 'text': 'right. this is how we are going to initialize the array at runtime.', 'start': 723.171, 'duration': 3.221}, {'end': 730.273, 'text': 'now see when you will execute this program.', 'start': 726.392, 'duration': 3.881}, {'end': 734.694, 'text': 'obviously you are going to declare here i and j, both variables.', 'start': 730.273, 'duration': 4.421}, {'end': 735.794, 'text': 'now enter the elements.', 'start': 734.694, 'duration': 1.1}], 'summary': 'Scanner function used for initializing array at runtime with i and j as indexes.', 'duration': 32.506, 'max_score': 703.288, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8703288.jpg'}, {'end': 786.772, 'src': 'embed', 'start': 759.395, 'weight': 3, 'content': [{'end': 763.857, 'text': 'd means integer data would be entered by the user way to store that data.', 'start': 759.395, 'duration': 4.462}, {'end': 770.6, 'text': 'address of a of i value is address of a of 0 and 0.', 'start': 763.857, 'duration': 6.743}, {'end': 774.002, 'text': 'i value is 0 and j value is also 0.', 'start': 770.6, 'duration': 3.402}, {'end': 778.083, 'text': 'now a of 0 and this a of 0 and 0.', 'start': 774.002, 'duration': 4.081}, {'end': 780.245, 'text': 'address of this is what 100.', 'start': 778.083, 'duration': 2.162}, {'end': 783.429, 'text': 'right now, at 100, you are going to store that value.', 'start': 780.245, 'duration': 3.184}, {'end': 784.73, 'text': 'suppose i have entered 1.', 'start': 783.429, 'duration': 1.301}, {'end': 786.772, 'text': 'so 1 would be stored here.', 'start': 784.73, 'duration': 2.042}], 'summary': 'Storing integer data at address 100, initially set to 0 and updated to 1.', 'duration': 27.377, 'max_score': 759.395, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8759395.jpg'}], 'start': 594.736, 'title': '2d array initialization and nested for loops in c', 'summary': 'Explains initializing a 2d array at runtime using nested for loops and scanf function, requiring 2 for loops for rows and columns, and taking input from the user for a 2x3 array. it also describes the concept of nested for loops in c, illustrating the flow of control within the loop.', 'chapters': [{'end': 759.395, 'start': 594.736, 'title': 'Initializing 2d array at runtime', 'summary': 'Explains the process of initializing a 2d array at runtime using nested for loops and scanf function, with specific emphasis on the variable allocation and loop iterations, requiring 2 for loops for rows and columns and taking input from the user for a 2x3 array.', 'duration': 164.659, 'highlights': ['The process involves using 2 for loops, one for the rows and one for the columns, to initialize a 2D array at runtime, requiring 24 bytes for the array allocation.', "The program executes with the declaration of variables 'i' and 'j' and takes user input using scanf function for a 2x3 array, with specific iterations outlined for the nested for loops.", 'The explanation emphasizes the use of nested for loops, with the outer loop iterating over the rows and the inner loop iterating over the columns, requiring 2 iterations for the 2x3 array.', 'The example highlights the specific allocation of variables and iterations required for initializing a 2D array at runtime, demonstrating the process of taking user input for a 2x3 array using nested for loops and scanf function.']}, {'end': 925.198, 'start': 759.395, 'title': 'Nested for loop in c', 'summary': 'Describes the concept of nested for loops in c, iterating through a 2d array, storing user input at specific memory addresses, and demonstrating the flow of control within the loop.', 'duration': 165.803, 'highlights': ['The chapter explains the process of iterating through a 2D array in C using nested for loops, with the example demonstrating the storage of user input at specific memory addresses.', 'It highlights the flow of control within the nested for loop, showcasing the iteration process through the 2D array and the conditions for entering and exiting the loop.', 'The detailed description includes the addresses (100, 104, 108, 112) where user input values are stored in the 2D array, demonstrating the allocation of memory locations for data entry.']}], 'duration': 330.462, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8594736.jpg', 'highlights': ["The program executes with the declaration of variables 'i' and 'j' and takes user input using scanf function for a 2x3 array, with specific iterations outlined for the nested for loops.", 'The explanation emphasizes the use of nested for loops, with the outer loop iterating over the rows and the inner loop iterating over the columns, requiring 2 iterations for the 2x3 array.', 'The example highlights the specific allocation of variables and iterations required for initializing a 2D array at runtime, demonstrating the process of taking user input for a 2x3 array using nested for loops and scanf function.', 'The detailed description includes the addresses (100, 104, 108, 112) where user input values are stored in the 2D array, demonstrating the allocation of memory locations for data entry.']}, {'end': 1599.994, 'segs': [{'end': 984.381, 'src': 'embed', 'start': 955.155, 'weight': 2, 'content': [{'end': 961.02, 'text': 'In 1D array how you can access? You are supposed to give only 1 index.', 'start': 955.155, 'duration': 5.865}, {'end': 963.902, 'text': 'Suppose you want to access the data at 0th index.', 'start': 961.06, 'duration': 2.842}, {'end': 965.303, 'text': 'So simply write a of 0.', 'start': 963.922, 'duration': 1.381}, {'end': 967.025, 'text': 'But here we are having 2 indexes.', 'start': 965.303, 'duration': 1.722}, {'end': 969.547, 'text': 'Fine If you want to access this data.', 'start': 967.685, 'duration': 1.862}, {'end': 973.71, 'text': 'row is 1 and column is 2.', 'start': 971.348, 'duration': 2.362}, {'end': 979.476, 'text': 'simply write a of 1 and 2 and it will give you value 6.', 'start': 973.71, 'duration': 5.766}, {'end': 981.678, 'text': 'it will give you value 2.', 'start': 979.476, 'duration': 2.202}, {'end': 984.381, 'text': 'this is how we are going to access the data.', 'start': 981.678, 'duration': 2.703}], 'summary': 'Access 1d array by specifying 1 index; for 2d, use row and column indexes.', 'duration': 29.226, 'max_score': 955.155, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8955155.jpg'}, {'end': 1052.426, 'src': 'embed', 'start': 1025.374, 'weight': 1, 'content': [{'end': 1031.457, 'text': 'So see how you can implement this 2D array or how you can store this 2D array in memory.', 'start': 1025.374, 'duration': 6.083}, {'end': 1032.617, 'text': 'Two methods are there.', 'start': 1031.676, 'duration': 0.941}, {'end': 1035.92, 'text': 'One is row major implementation and one is another is column major.', 'start': 1032.758, 'duration': 3.162}, {'end': 1045.164, 'text': 'Now, first, what is row major implementation? See, as we have discussed, memory is a long tape of bytes and each byte is having its own address.', 'start': 1036.74, 'duration': 8.424}, {'end': 1052.426, 'text': 'Fine. see, here i am going to tell you how the data is to be stored in row.', 'start': 1046.085, 'duration': 6.341}], 'summary': 'Explanation of row major implementation for 2d array storage in memory.', 'duration': 27.052, 'max_score': 1025.374, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81025374.jpg'}, {'end': 1320.969, 'src': 'embed', 'start': 1294.814, 'weight': 0, 'content': [{'end': 1301.963, 'text': 'i have that we have discussed in 1d array already, so the time taken is constant time, that is order of one.', 'start': 1294.814, 'duration': 7.149}, {'end': 1307.389, 'text': 'if the compiler know the base address of this array and the column, the column size,', 'start': 1301.963, 'duration': 5.426}, {'end': 1315.204, 'text': 'then in constant time the compiler can compute the memory location of any element.', 'start': 1308.618, 'duration': 6.586}, {'end': 1320.969, 'text': "Now suppose, first of all, I'm taking this row major implementation, this one.", 'start': 1316.485, 'duration': 4.484}], 'summary': '1d array access time is constant, order of one', 'duration': 26.155, 'max_score': 1294.814, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81294814.jpg'}, {'end': 1522.873, 'src': 'heatmap', 'start': 1444.511, 'weight': 0.707, 'content': [{'end': 1449.133, 'text': 'here i am discussing, i am taking index is starting started from zero.', 'start': 1444.511, 'duration': 4.622}, {'end': 1454.515, 'text': 'so you are going to cross one row right and in one row in one row.', 'start': 1449.133, 'duration': 5.382}, {'end': 1461.244, 'text': 'how you are, how you are come to know that you are going to cross one row only because of this index.', 'start': 1455.481, 'duration': 5.763}, {'end': 1464.325, 'text': 'here the row index is one.', 'start': 1461.244, 'duration': 3.081}, {'end': 1467.166, 'text': 'but in this row how many columns you are going to cross?', 'start': 1464.325, 'duration': 2.841}, {'end': 1469.327, 'text': 'how many elements you are going to cross?', 'start': 1467.166, 'duration': 2.161}, {'end': 1470.367, 'text': 'how many columns are there?', 'start': 1469.327, 'duration': 1.04}, {'end': 1471.048, 'text': 'one, two and three.', 'start': 1470.367, 'duration': 0.681}, {'end': 1473.149, 'text': 'so three elements you are going to cross.', 'start': 1471.048, 'duration': 2.101}, {'end': 1482.361, 'text': 'fine, so see, for reaching this one you can say you are going to cross one row In this row.', 'start': 1473.149, 'duration': 9.212}, {'end': 1483.542, 'text': 'how many elements are there?', 'start': 1482.361, 'duration': 1.181}, {'end': 1486.504, 'text': 'That you will come to know by the number of columns.', 'start': 1484.203, 'duration': 2.301}, {'end': 1489.286, 'text': 'So number of columns are 1, 2 and 3.', 'start': 1486.824, 'duration': 2.462}, {'end': 1492.628, 'text': 'Because size is 2 into 3.', 'start': 1489.286, 'duration': 3.342}, {'end': 1495.169, 'text': 'So 1 into 3.', 'start': 1492.628, 'duration': 2.541}, {'end': 1496.35, 'text': 'Fine Plus.', 'start': 1495.169, 'duration': 1.181}, {'end': 1499.172, 'text': 'Now you have reached to this particular row.', 'start': 1497.491, 'duration': 1.681}, {'end': 1502.934, 'text': 'But in this particular row also you are going to access this element.', 'start': 1499.192, 'duration': 3.742}, {'end': 1509.099, 'text': 'which element, the element which is in second column, fine in this column.', 'start': 1503.834, 'duration': 5.265}, {'end': 1509.52, 'text': 'so you are.', 'start': 1509.099, 'duration': 0.421}, {'end': 1515.746, 'text': 'you are going to cross one element also from this row, to reach till this element.', 'start': 1509.52, 'duration': 6.226}, {'end': 1522.873, 'text': 'now, how you will come to know that you are going to cross one element in this particular row also by with the help of this second column,', 'start': 1515.746, 'duration': 7.127}], 'summary': 'Discussing indexing and accessing elements in a 2x3 matrix.', 'duration': 78.362, 'max_score': 1444.511, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81444511.jpg'}], 'start': 925.478, 'title': '2d array implementation', 'summary': 'Covers accessing data in multi-dimensional arrays, including 2d arrays, illustrating the process using 2d and 1d arrays. it discusses the implementation of 2d arrays in memory, covering row major and column major implementations, with examples and emphasis on constant time complexity for random access.', 'chapters': [{'end': 984.381, 'start': 925.478, 'title': 'Accessing multi-dimensional array data', 'summary': 'Explains how to access data in multi-dimensional arrays, illustrating the process using 2d and 1d arrays. it also emphasizes the distinction between accessing data in these arrays, showcasing the use of indexes and providing examples of accessing specific elements.', 'duration': 58.903, 'highlights': ["When accessing data in a 2D array, the row and column indices are used, exemplified by accessing the value at row 1 and column 2 using 'a of 1 and 2', resulting in the value 6.", "In contrast, accessing a 1D array requires only a single index, as demonstrated by accessing the value at index 0 using 'a of 0'."]}, {'end': 1599.994, 'start': 984.381, 'title': '2d array memory storage', 'summary': 'Discusses the implementation of 2d array in memory, covering row major and column major implementations, with an emphasis on the computation of memory location for accessing elements, demonstrating the calculation with a detailed example, and highlighting the constant time complexity for random access.', 'duration': 615.613, 'highlights': ['The chapter explains the row major and column major implementations of 2D array in memory, detailing how the data is stored for each method, providing a clear understanding of the memory organization and its impact on accessing elements.', 'It provides a detailed example of computing the memory location for accessing a specific element in a 2D array, breaking down the calculation step by step, demonstrating the complexity of the computation involved.', 'The chapter emphasizes the constant time complexity for random access in the 2D array, highlighting the efficiency of accessing elements once the base address and column size are known, reinforcing the practical significance of the discussed memory storage implementations.']}], 'duration': 674.516, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL8925478.jpg', 'highlights': ['The chapter emphasizes the constant time complexity for random access in the 2D array, highlighting the efficiency of accessing elements once the base address and column size are known, reinforcing the practical significance of the discussed memory storage implementations.', 'The chapter explains the row major and column major implementations of 2D array in memory, detailing how the data is stored for each method, providing a clear understanding of the memory organization and its impact on accessing elements.', "When accessing data in a 2D array, the row and column indices are used, exemplified by accessing the value at row 1 and column 2 using 'a of 1 and 2', resulting in the value 6.", "In contrast, accessing a 1D array requires only a single index, as demonstrated by accessing the value at index 0 using 'a of 0'."]}, {'end': 1915.328, 'segs': [{'end': 1655.822, 'src': 'embed', 'start': 1626.913, 'weight': 0, 'content': [{'end': 1631.618, 'text': 'You want to access this element, right? So, first of all, you will write i.', 'start': 1626.913, 'duration': 4.705}, {'end': 1637.813, 'text': 'into. now we are going to multiply it with number of columns.', 'start': 1632.97, 'duration': 4.843}, {'end': 1641.576, 'text': 'here we have taken see three elements, that is number of columns three.', 'start': 1637.813, 'duration': 3.763}, {'end': 1642.516, 'text': 'three is number of columns.', 'start': 1641.576, 'duration': 0.94}, {'end': 1643.997, 'text': 'here number of columns are in general.', 'start': 1642.516, 'duration': 1.481}, {'end': 1647.9, 'text': 'I am taking n, so we are going to multiply i with n.', 'start': 1643.997, 'duration': 3.903}, {'end': 1655.822, 'text': 'plus. you are going to add what now you have reached to that particular row, but you have to reach that to till that particular column.', 'start': 1648.92, 'duration': 6.902}], 'summary': 'To access an element, multiply i with the number of columns and add the column index.', 'duration': 28.909, 'max_score': 1626.913, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81626913.jpg'}, {'end': 1701.285, 'src': 'heatmap', 'start': 1648.92, 'weight': 0.806, 'content': [{'end': 1655.822, 'text': 'plus. you are going to add what now you have reached to that particular row, but you have to reach that to till that particular column.', 'start': 1648.92, 'duration': 6.902}, {'end': 1658.963, 'text': 'fine, for that also, you have to cross some elements.', 'start': 1655.822, 'duration': 3.141}, {'end': 1661.044, 'text': 'so how many elements you have to cross this?', 'start': 1658.963, 'duration': 2.081}, {'end': 1667.426, 'text': 'this index is going to tell you this index, this number written in second subscript, that is j value.', 'start': 1661.044, 'duration': 6.382}, {'end': 1668.586, 'text': 'so plus j.', 'start': 1667.426, 'duration': 1.16}, {'end': 1676.014, 'text': 'this is the general formula to calculate address location for any particular element in row.', 'start': 1668.586, 'duration': 7.428}, {'end': 1678.216, 'text': 'major implementation plus.', 'start': 1676.014, 'duration': 2.202}, {'end': 1683.762, 'text': 'second condition is the array index we are going to take started from zero.', 'start': 1678.216, 'duration': 5.546}, {'end': 1688.907, 'text': 'so now let us suppose sometimes somewhere it is taken that the index is started from one.', 'start': 1683.762, 'duration': 5.145}, {'end': 1691.129, 'text': 'in that case, how to calculate this?', 'start': 1688.907, 'duration': 2.222}, {'end': 1693.772, 'text': 'you have to modify this formula a little bit.', 'start': 1691.129, 'duration': 2.643}, {'end': 1701.285, 'text': 'see, now, see, index has started from one First row, second row, column also 1, 2 and 3..', 'start': 1693.772, 'duration': 7.513}], 'summary': 'The formula for calculating address location is major implementation plus j, with array index starting from zero.', 'duration': 52.365, 'max_score': 1648.92, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81648920.jpg'}, {'end': 1693.772, 'src': 'embed', 'start': 1668.586, 'weight': 2, 'content': [{'end': 1676.014, 'text': 'this is the general formula to calculate address location for any particular element in row.', 'start': 1668.586, 'duration': 7.428}, {'end': 1678.216, 'text': 'major implementation plus.', 'start': 1676.014, 'duration': 2.202}, {'end': 1683.762, 'text': 'second condition is the array index we are going to take started from zero.', 'start': 1678.216, 'duration': 5.546}, {'end': 1688.907, 'text': 'so now let us suppose sometimes somewhere it is taken that the index is started from one.', 'start': 1683.762, 'duration': 5.145}, {'end': 1691.129, 'text': 'in that case, how to calculate this?', 'start': 1688.907, 'duration': 2.222}, {'end': 1693.772, 'text': 'you have to modify this formula a little bit.', 'start': 1691.129, 'duration': 2.643}], 'summary': 'General formula for calculating address location in an array, with consideration for different starting indices.', 'duration': 25.186, 'max_score': 1668.586, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81668586.jpg'}, {'end': 1766.211, 'src': 'heatmap', 'start': 1718.695, 'weight': 0.854, 'content': [{'end': 1720.837, 'text': 'Right But how to calculate this 1? See.', 'start': 1718.695, 'duration': 2.142}, {'end': 1725.214, 'text': 'To reach till this 5.', 'start': 1723.473, 'duration': 1.741}, {'end': 1726.935, 'text': 'How many elements you have to cross.', 'start': 1725.214, 'duration': 1.721}, {'end': 1729.017, 'text': 'See This row.', 'start': 1727.916, 'duration': 1.101}, {'end': 1730.578, 'text': 'Means first row.', 'start': 1729.777, 'duration': 0.801}, {'end': 1732.239, 'text': 'One row is there before this row.', 'start': 1730.718, 'duration': 1.521}, {'end': 1736.582, 'text': 'Right Now how you will come to know that how many rows you have to cross.', 'start': 1733.44, 'duration': 3.142}, {'end': 1737.723, 'text': 'Check this index.', 'start': 1736.842, 'duration': 0.881}, {'end': 1739.244, 'text': 'This First index.', 'start': 1737.783, 'duration': 1.461}, {'end': 1739.644, 'text': 'That is.', 'start': 1739.284, 'duration': 0.36}, {'end': 1742.006, 'text': '2 Fine.', 'start': 1739.664, 'duration': 2.342}, {'end': 1744.427, 'text': 'So in this case you are going to do.', 'start': 1742.346, 'duration': 2.081}, {'end': 1746.789, 'text': 'This 2 minus 1.', 'start': 1744.808, 'duration': 1.981}, {'end': 1747.129, 'text': 'That is.', 'start': 1746.789, 'duration': 0.34}, {'end': 1748.75, 'text': 'You are going to cross one row.', 'start': 1747.409, 'duration': 1.341}, {'end': 1750.652, 'text': 'Fine So here you will write.', 'start': 1749.151, 'duration': 1.501}, {'end': 1752.012, 'text': '2 minus 1.', 'start': 1751.372, 'duration': 0.64}, {'end': 1752.333, 'text': 'That is.', 'start': 1752.012, 'duration': 0.321}, {'end': 1760.589, 'text': '2 minus 1, that is 1 into now in this row, how many elements are there?', 'start': 1753.766, 'duration': 6.823}, {'end': 1763.75, 'text': 'obviously the number of columns are there.', 'start': 1760.589, 'duration': 3.161}, {'end': 1766.211, 'text': 'those number of elements would be there in that row.', 'start': 1763.75, 'duration': 2.461}], 'summary': 'To calculate the position 1, cross 1 row with 2 elements.', 'duration': 47.516, 'max_score': 1718.695, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81718695.jpg'}], 'start': 1599.994, 'title': 'Matrix indexing and array address calculation', 'summary': 'Explains matrix indexing and accessing elements using the formula i * n + j and covers the general formula for calculating the address location of an element in a row-major implementation, with specific examples and formulas provided.', 'chapters': [{'end': 1647.9, 'start': 1599.994, 'title': 'Matrix indexing and accessing elements', 'summary': 'Explains matrix indexing and accessing elements, highlighting the method of accessing elements using the formula i * n + j and emphasizing the significance of the number of columns in the process.', 'duration': 47.906, 'highlights': ['The process of accessing matrix elements is demonstrated using the formula i * n + j, where i represents the row number, n represents the number of columns, and j represents the column number.', 'The number of columns in a matrix plays a crucial role in the process of accessing elements, as demonstrated by the formula i * n + j.']}, {'end': 1915.328, 'start': 1648.92, 'title': 'Array address calculation', 'summary': 'Covers the general formula for calculating the address location of an element in a row-major implementation, with an example of modifying the formula for array indexes starting from one, and a general formula for calculating the address of a specific element in a row-major implementation of an array.', 'duration': 266.408, 'highlights': ['The general formula for calculating the address location for any particular element in a row-major implementation of an array is discussed, emphasizing the importance of the j value in the calculation.', 'An example is provided for modifying the general formula when the array index starts from one, demonstrating the adjustment needed in the calculation for such cases.', 'A general formula is outlined for calculating the address of a specific element in a row-major implementation of an array, incorporating adjustments for arrays with indexes starting from one and providing a clear step-by-step calculation process.']}], 'duration': 315.334, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81599994.jpg', 'highlights': ['The process of accessing matrix elements is demonstrated using the formula i * n + j, where i represents the row number, n represents the number of columns, and j represents the column number.', 'The number of columns in a matrix plays a crucial role in the process of accessing elements, as demonstrated by the formula i * n + j.', 'A general formula is outlined for calculating the address of a specific element in a row-major implementation of an array, incorporating adjustments for arrays with indexes starting from one and providing a clear step-by-step calculation process.', 'An example is provided for modifying the general formula when the array index starts from one, demonstrating the adjustment needed in the calculation for such cases.', 'The general formula for calculating the address location for any particular element in a row-major implementation of an array is discussed, emphasizing the importance of the j value in the calculation.']}, {'end': 2263.25, 'segs': [{'end': 1941.871, 'src': 'embed', 'start': 1917.365, 'weight': 0, 'content': [{'end': 1923.699, 'text': 'Now in column measure implementation, how to calculate the address of a particular element.', 'start': 1917.365, 'duration': 6.334}, {'end': 1924.741, 'text': 'Let us check this thing.', 'start': 1923.699, 'duration': 1.042}, {'end': 1931.741, 'text': 'so in column measure implementation, this is the logical representation and this is the actual representation in memory.', 'start': 1925.856, 'duration': 5.885}, {'end': 1936.306, 'text': 'you are going to store this first column first, then second column, then third column.', 'start': 1931.741, 'duration': 4.565}, {'end': 1939.468, 'text': 'so now, suppose, here i want to calculate address for this one.', 'start': 1936.306, 'duration': 3.162}, {'end': 1941.871, 'text': 'i want to access the 6 address.', 'start': 1939.468, 'duration': 2.403}], 'summary': 'Column measure implementation calculates address of elements in memory.', 'duration': 24.506, 'max_score': 1917.365, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81917365.jpg'}, {'end': 2019.777, 'src': 'heatmap', 'start': 1968.461, 'weight': 0.82, 'content': [{'end': 1973.065, 'text': 'See, here I am discussing, because this array has been stored in column measure implementation.', 'start': 1968.461, 'duration': 4.604}, {'end': 1980.272, 'text': 'So, how many columns you have to cross? In that case, we have checked how many rows you have to cross in row measure implementation.', 'start': 1973.886, 'duration': 6.386}, {'end': 1984.676, 'text': 'Fine So, how many columns you have to cross? 1 and 2.', 'start': 1980.692, 'duration': 3.984}, {'end': 1990.318, 'text': 'two right, two complete columns and how you will come to know this thing because of this index.', 'start': 1984.676, 'duration': 5.642}, {'end': 1995.139, 'text': 'second index, because second index is for column and first index is for row.', 'start': 1990.318, 'duration': 4.821}, {'end': 1996.559, 'text': 'that i have told you in the beginning.', 'start': 1995.139, 'duration': 1.42}, {'end': 1998.2, 'text': 'also fine.', 'start': 1996.559, 'duration': 1.641}, {'end': 2001.321, 'text': 'so this two, two into.', 'start': 1998.2, 'duration': 3.121}, {'end': 2004.801, 'text': 'now, in each column, how many elements are there?', 'start': 2001.321, 'duration': 3.48}, {'end': 2006.002, 'text': 'two elements are there?', 'start': 2004.801, 'duration': 1.201}, {'end': 2009.783, 'text': 'fine, how you will come to know that in each column, how many elements are there?', 'start': 2006.002, 'duration': 3.781}, {'end': 2011.703, 'text': 'because number of rows are, how many?', 'start': 2009.783, 'duration': 1.92}, {'end': 2012.183, 'text': 'one and two?', 'start': 2011.703, 'duration': 0.48}, {'end': 2013.564, 'text': 'so obviously two elements would be there.', 'start': 2012.183, 'duration': 1.381}, {'end': 2019.777, 'text': 'So number of rows are this 2,, 2 into 2, fine.', 'start': 2014.932, 'duration': 4.845}], 'summary': 'Discussing array storage and traversal, identifying 2x2 column elements.', 'duration': 51.316, 'max_score': 1968.461, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81968461.jpg'}, {'end': 2254.803, 'src': 'embed', 'start': 2221.114, 'weight': 1, 'content': [{'end': 2229.737, 'text': 'if you will write for i and j when index is started from 1, in that case you will write base address plus.', 'start': 2221.114, 'duration': 8.623}, {'end': 2234.939, 'text': 'here you will write what simple j minus 1 into m.', 'start': 2229.737, 'duration': 5.202}, {'end': 2237.88, 'text': "this would be as a t's plus.", 'start': 2234.939, 'duration': 2.941}, {'end': 2239.64, 'text': 'i minus 1.', 'start': 2237.88, 'duration': 1.76}, {'end': 2244.282, 'text': "i minus 1 into sin's.", 'start': 2239.64, 'duration': 4.642}, {'end': 2250.3, 'text': 'right and the time taken to access these element is what constant time that is.', 'start': 2245.816, 'duration': 4.484}, {'end': 2253.082, 'text': 'order of one.', 'start': 2250.3, 'duration': 2.782}, {'end': 2254.803, 'text': 'so this is all about 2d array.', 'start': 2253.082, 'duration': 1.721}], 'summary': 'Accessing elements in a 2d array is done in constant time, o(1).', 'duration': 33.689, 'max_score': 2221.114, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL82221114.jpg'}], 'start': 1917.365, 'title': 'Address calculation in arrays', 'summary': 'Covers the calculation of element addresses in column measures and 2d arrays, including the logic and formula for address determination, impact of array indexing, and time complexity, focusing on reaching specific elements.', 'chapters': [{'end': 1968.321, 'start': 1917.365, 'title': 'Column measure implementation', 'summary': 'Explains how to calculate the address of a particular element in the column measure implementation, emphasizing the process of determining the address of a specific element and the logic behind it.', 'duration': 50.956, 'highlights': ['The logical and actual representation of data in memory is discussed, highlighting the storage order of columns.', 'The process of calculating the address for a specific element is explained, emphasizing the use of row and column indices to access the desired element.', 'The importance of understanding the number of columns to cross in order to reach a specific element is stressed.']}, {'end': 2263.25, 'start': 1968.461, 'title': '2d array address calculation', 'summary': 'Explains the process of calculating the address of elements in a 2d array using row and column measures, including the formula for address calculation, the impact of array indexing, and the time complexity, with a focus on reaching the element at index (i, j).', 'duration': 294.789, 'highlights': ['The process of calculating the address of elements in a 2D array involves determining the number of columns to cross, which is achieved by checking the second index and then multiplying it by the number of rows, resulting in the formula j * m + i - 1 * 4, with the time complexity being order of one.', 'The address calculation in a 2D array using column measure involves crossing 2 columns, as determined by the second index, multiplied by the number of rows, with each element taking 4 bytes, resulting in an address of 120, and the time taken to access the element being constant, i.e., order of one.', 'The video teases the discussion on the relationship between 2D arrays and pointers in the next video.']}], 'duration': 345.885, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/KDQXUysHLL8/pics/KDQXUysHLL81917365.jpg', 'highlights': ['The process of calculating the address for a specific element is explained, emphasizing the use of row and column indices to access the desired element.', 'The process of calculating the address of elements in a 2D array involves determining the number of columns to cross, which is achieved by checking the second index and then multiplying it by the number of rows, resulting in the formula j * m + i - 1 * 4, with the time complexity being order of one.', 'The logical and actual representation of data in memory is discussed, highlighting the storage order of columns.']}], 'highlights': ['The chapter emphasizes the constant time complexity for random access in the 2D array, reinforcing the practical significance of the discussed memory storage implementations.', 'The process of accessing matrix elements is demonstrated using the formula i * n + j, where i represents the row number, n represents the number of columns, and j represents the column number.', 'The chapter explains the row major and column major implementations of 2D array in memory, providing a clear understanding of the memory organization and its impact on accessing elements.', 'The process of calculating the address for a specific element is explained, emphasizing the use of row and column indices to access the desired element.', 'The chapter details the representation of 2D arrays in memory, illustrating the indexing starting from zero, and demonstrating the allocation of 24 bytes for a 2x3 array.']}