title
1.2 Array Operations - Traversal, Insertion | Explanation with C Program | DSA Course
description
Main operations on Arrays: Traversal, Insertion, Deletion, Searching, Sorting
This video explains Traversal and Insertion operations with code (C program), Insertion at the beginning, insertion at the end, insertion at any position.
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.2 Array Operations - Traversal, Insertion | Explanation with C Program | DSA Course', 'heatmap': [{'end': 1196.255, 'start': 1106.13, 'weight': 0.783}, {'end': 1304.682, 'start': 1262.801, 'weight': 0.853}], 'summary': 'Covers array operations and techniques, dynamic array handling, array insertion, memory insertion and swapping, and array insertion conditions and data insertion in array in c programming with practical examples and discussions on traversal, insertion, deletion, searching, sorting, and memory allocation.', 'chapters': [{'end': 201.631, 'segs': [{'end': 201.631, 'src': 'embed', 'start': 158.857, 'weight': 0, 'content': [{'end': 162.963, 'text': 'now we will see what is there at this place 6.', 'start': 158.857, 'duration': 4.106}, {'end': 164.405, 'text': 'we are going to print this.', 'start': 162.963, 'duration': 1.442}, {'end': 165.226, 'text': '6 now.', 'start': 164.405, 'duration': 0.821}, {'end': 166.809, 'text': 'this i would be incremented.', 'start': 165.226, 'duration': 1.583}, {'end': 167.57, 'text': 'i is here now.', 'start': 166.809, 'duration': 0.761}, {'end': 169.8, 'text': 'now, here, what is the value?', 'start': 168.519, 'duration': 1.281}, {'end': 174.803, 'text': '2, then 2 would be printed, then i would be incremented, then here, then, here, now, and like this,', 'start': 169.8, 'duration': 5.003}, {'end': 181.526, 'text': 'the values would be printed and i would go from 0 to 4, that is, from 0 to size minus 1.', 'start': 174.803, 'duration': 6.723}, {'end': 184.308, 'text': 'size of array is 5, so size minus 1.', 'start': 181.526, 'duration': 2.782}, {'end': 188.43, 'text': 'this is how we are going to traverse the array and you are going to write down the code for this.', 'start': 184.308, 'duration': 4.122}, {'end': 190.631, 'text': 'now, how we are going to write down the code?', 'start': 188.43, 'duration': 2.201}, {'end': 196.835, 'text': 'first of all, see, i am also going to discuss how to initialize the array, how we are going to take these elements,', 'start': 190.631, 'duration': 6.204}, {'end': 201.631, 'text': 'And initialization would be of two types at compile time, at runtime.', 'start': 197.99, 'duration': 3.641}], 'summary': 'Traversing an array from 0 to 4, printing values, and discussing array initialization methods.', 'duration': 42.774, 'max_score': 158.857, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk158857.jpg'}], 'start': 0.149, 'title': 'Array operations and techniques', 'summary': 'Covers traversal, insertion, deletion, searching, and sorting of arrays, along with additional operations. it also discusses the concept of traversing an array, emphasizing the process of visiting every element of the array exactly once and the method of printing the elements.', 'chapters': [{'end': 65.917, 'start': 0.149, 'title': 'Array operations and techniques', 'summary': 'Covers traversal, insertion, deletion, searching, and sorting of arrays, along with additional operations like finding minimum and maximum elements, duplicate elements, reversing the array, and finding the second largest element.', 'duration': 65.768, 'highlights': ['The chapter covers traversal, insertion, deletion, searching, and sorting of arrays, along with additional operations like finding minimum and maximum elements, duplicate elements, reversing the array, and finding the second largest element.', 'Insertion in array is of three types: at the start, at the end, or at any specific position in the array.', 'The video will discuss how to traverse an array and how to insert data into the array, along with code examples.']}, {'end': 201.631, 'start': 65.917, 'title': 'Array traversal', 'summary': 'Discusses the concept of traversing an array, emphasizing the process of visiting every element of the array exactly once and the method of printing the elements. an example with an array of size 5 is used to illustrate the traversal process and address allocation in memory.', 'duration': 135.714, 'highlights': ['Traversing an array involves visiting every element exactly once, illustrated using an array of size 5 and the process of printing each element.', 'Address allocation in memory for an array is explained, highlighting the 4-byte space taken by each integer and the incremental nature of memory addresses.', "The process of traversing the array is demonstrated through code, emphasizing the use of a variable 'i' to iterate through the array and print its elements from index 0 to size minus 1."]}], 'duration': 201.482, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk149.jpg', 'highlights': ['The chapter covers traversal, insertion, deletion, searching, and sorting of arrays, along with additional operations like finding minimum and maximum elements, duplicate elements, reversing the array, and finding the second largest element.', 'Insertion in array is of three types: at the start, at the end, or at any specific position in the array.', 'Traversing an array involves visiting every element exactly once, illustrated using an array of size 5 and the process of printing each element.', "The process of traversing the array is demonstrated through code, emphasizing the use of a variable 'i' to iterate through the array and print its elements from index 0 to size minus 1."]}, {'end': 786.999, 'segs': [{'end': 269.63, 'src': 'embed', 'start': 201.731, 'weight': 0, 'content': [{'end': 209.333, 'text': "So in this video at runtime, I'm going to ask from the user, what elements the user wants in the area, how to populate the area at runtime.", 'start': 201.731, 'duration': 7.602}, {'end': 210.814, 'text': 'Now see, let us check.', 'start': 209.794, 'duration': 1.02}, {'end': 214.135, 'text': "So initially we don't have anything in this area.", 'start': 211.994, 'duration': 2.141}, {'end': 218.636, 'text': "So first of all, what you will do, you'll just write header files and all.", 'start': 215.715, 'duration': 2.921}, {'end': 219.917, 'text': 'I think you can write that thing.', 'start': 218.696, 'duration': 1.221}, {'end': 226.673, 'text': "Now let us take, I'm going to declare an area of size 50.", 'start': 220.897, 'duration': 5.776}, {'end': 232.136, 'text': 'see, actually, when you are using the array, when you are storing the integer, then you can store only 10 integers.', 'start': 226.673, 'duration': 5.463}, {'end': 236.659, 'text': "it's up to you less than 50, but you cannot store more than 60.", 'start': 232.136, 'duration': 4.523}, {'end': 238.019, 'text': 'why we are taking this 50?', 'start': 236.659, 'duration': 1.36}, {'end': 240.641, 'text': 'because, see, it is fixed size.', 'start': 238.019, 'duration': 2.622}, {'end': 245.103, 'text': 'once you declare the size of array at compile time, you cannot change it at run time.', 'start': 240.641, 'duration': 4.462}, {'end': 246.444, 'text': 'fine, that is drawback of the array.', 'start': 245.103, 'duration': 1.341}, {'end': 253.006, 'text': 'but one other drawback is that it array is not having any bound checking property at runtime.', 'start': 246.924, 'duration': 6.082}, {'end': 260.647, 'text': 'so it is the job of the programmer only to check, to write down the code for checking the boundary of the arrays in program only.', 'start': 253.006, 'duration': 7.641}, {'end': 262.688, 'text': 'fine, now, what is that bound checking?', 'start': 260.647, 'duration': 2.041}, {'end': 264.288, 'text': "i'll discuss later.", 'start': 262.688, 'duration': 1.6}, {'end': 267.269, 'text': 'so see, i have declared array of size 50.', 'start': 264.288, 'duration': 2.981}, {'end': 269.63, 'text': 'now how many bytes would be allocated by the memory manager?', 'start': 267.269, 'duration': 2.361}], 'summary': 'Demonstration of runtime array population with fixed size and memory allocation.', 'duration': 67.899, 'max_score': 201.731, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk201731.jpg'}, {'end': 538.695, 'src': 'embed', 'start': 510.777, 'weight': 2, 'content': [{'end': 514.158, 'text': 'index would be started from 0 to 1, 2, 3, 4.', 'start': 510.777, 'duration': 3.381}, {'end': 515.138, 'text': 'this is how we are going.', 'start': 514.158, 'duration': 0.98}, {'end': 517.259, 'text': 'i am going to represent it 0, 1, 2, 3, 4.', 'start': 515.138, 'duration': 2.121}, {'end': 519.58, 'text': 'each block is having these 4 bytes.', 'start': 517.259, 'duration': 2.321}, {'end': 522.32, 'text': 'fine, so this address is to be allocated now.', 'start': 519.58, 'duration': 2.74}, {'end': 524.561, 'text': 'when i value is 0, i value is 0.', 'start': 522.32, 'duration': 2.241}, {'end': 528.322, 'text': 'then value would be stored at address of a of 0.', 'start': 524.561, 'duration': 3.761}, {'end': 534.104, 'text': 'address means at value 100, a of 0, a of 0 means at this index.', 'start': 528.322, 'duration': 5.782}, {'end': 538.695, 'text': 'fine, so now user will insert the values.', 'start': 535.213, 'duration': 3.482}], 'summary': 'Index from 0 to 4, each block has 4 bytes. value stored at address of a[0] at value 100.', 'duration': 27.918, 'max_score': 510.777, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk510777.jpg'}, {'end': 620.569, 'src': 'embed', 'start': 565.669, 'weight': 1, 'content': [{'end': 566.79, 'text': 'you are going to print the array.', 'start': 565.669, 'duration': 1.121}, {'end': 567.851, 'text': 'what are the elements in there?', 'start': 566.79, 'duration': 1.061}, {'end': 568.651, 'text': 'you are going to print.', 'start': 567.851, 'duration': 0.8}, {'end': 573.976, 'text': 'that fine, so for printing, you will write what one for loop, again for loop, would be there.', 'start': 568.651, 'duration': 5.325}, {'end': 575.797, 'text': 'i would be from 0 to 4.', 'start': 573.976, 'duration': 1.821}, {'end': 579.14, 'text': 'fine, so you can write here printf.', 'start': 575.797, 'duration': 3.343}, {'end': 593.672, 'text': 'elements in array are after printf, you will write one for loop.', 'start': 588.809, 'duration': 4.863}, {'end': 596.273, 'text': 'i would be started from zero.', 'start': 593.672, 'duration': 2.601}, {'end': 603.817, 'text': 'i would be less than size, or you can say less than equal to size, minus one, i plus plus.', 'start': 596.273, 'duration': 7.544}, {'end': 605.938, 'text': 'and here within this, for loop, you will write what.', 'start': 603.817, 'duration': 2.121}, {'end': 608.5, 'text': 'now we are going to print the array, so you will not write scanf.', 'start': 605.938, 'duration': 2.562}, {'end': 609.7, 'text': 'scanf is for taking input.', 'start': 608.5, 'duration': 1.2}, {'end': 617.087, 'text': 'you will write here printf percentage d is for integer, because data type is integer.', 'start': 609.7, 'duration': 7.387}, {'end': 620.569, 'text': 'and here simply you will write array of i.', 'start': 617.087, 'duration': 3.482}], 'summary': 'Printing an array using a for loop with 5 elements.', 'duration': 54.9, 'max_score': 565.669, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk565669.jpg'}], 'start': 201.731, 'title': 'Dynamic array handling', 'summary': 'Covers runtime population of arrays, addressing limitations of fixed-size arrays, memory allocation, user input processing, data insertion, traversal, memory allocation, and overflow handling in c programming.', 'chapters': [{'end': 370.751, 'start': 201.731, 'title': 'Runtime array population', 'summary': 'Discusses the process of dynamically populating an array at runtime, including the limitations of fixed-size arrays, memory allocation, and user input processing.', 'duration': 169.02, 'highlights': ['The chapter discusses the limitations of fixed-size arrays, emphasizing that once the size is declared at compile time, it cannot be changed at runtime, with an example of a size of 50 and allocation of 200 bytes. Limitations of fixed-size arrays, inability to change size at runtime, example of array size 50 and 200 bytes allocation', 'The concept of bound checking for arrays is introduced, highlighting that the responsibility of checking array boundaries lies with the programmer and not the array itself. Introduction of bound checking, responsibility of programmer for checking array boundaries', 'The process of user input for determining the number of elements to be inserted in the array is explained, including the use of standard functions like printf and scanf for input/output operations. Explanation of user input process, use of printf and scanf functions']}, {'end': 786.999, 'start': 370.751, 'title': 'Array data insertion and traversal', 'summary': 'Discusses the allocation of memory for an array, insertion of data using the address of operator, populating the array, traversing the array, and handling overflow conditions in the context of c programming.', 'duration': 416.248, 'highlights': ['The chapter discusses the allocation of memory for an array, insertion of data using the address of operator, populating the array, traversing the array, and handling overflow conditions in the context of C programming. This provides an overview of the key topics covered in the chapter, including the allocation of memory, insertion of data, populating and traversing the array, and handling overflow conditions.', 'The address of operator allocates 4 bytes in memory for a variable, facilitating the insertion of data at specific memory locations. The address of operator allocates 4 bytes in memory for a variable, enabling the insertion of data at specific memory locations, which aids in efficient data storage and retrieval.', 'The chapter details the process of populating an array by inserting values at specific indexes using a for loop and scanf function. The chapter details the process of populating an array by inserting values at specific indexes using a for loop and scanf function, providing a structured approach to array data population.', 'Traversing the array involves accessing and printing each element using a for loop and printf function, demonstrating the systematic retrieval and display of array elements. Traversing the array involves accessing and printing each element using a for loop and printf function, showcasing a systematic approach to retrieving and displaying array elements for effective data visualization.', 'The chapter emphasizes the need for handling overflow conditions to prevent data insertion when the array is full, highlighting the importance of managing array capacity. The chapter emphasizes the need for handling overflow conditions to prevent data insertion when the array is full, highlighting the importance of managing array capacity to ensure efficient data storage.']}], 'duration': 585.268, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk201731.jpg', 'highlights': ['The chapter discusses the limitations of fixed-size arrays, emphasizing that once the size is declared at compile time, it cannot be changed at runtime, with an example of a size of 50 and allocation of 200 bytes.', 'The concept of bound checking for arrays is introduced, highlighting that the responsibility of checking array boundaries lies with the programmer and not the array itself.', 'The process of user input for determining the number of elements to be inserted in the array is explained, including the use of standard functions like printf and scanf for input/output operations.', 'The chapter discusses the allocation of memory for an array, insertion of data using the address of operator, populating the array, traversing the array, and handling overflow conditions in the context of C programming.', 'The address of operator allocates 4 bytes in memory for a variable, facilitating the insertion of data at specific memory locations.', 'The chapter details the process of populating an array by inserting values at specific indexes using a for loop and scanf function.', 'Traversing the array involves accessing and printing each element using a for loop and printf function, demonstrating the systematic retrieval and display of array elements.', 'The chapter emphasizes the need for handling overflow conditions to prevent data insertion when the array is full, highlighting the importance of managing array capacity.']}, {'end': 1028.339, 'segs': [{'end': 833.533, 'src': 'embed', 'start': 786.999, 'weight': 1, 'content': [{'end': 791.827, 'text': 'enter the elements of there and other code you will write down in the else block Fine.', 'start': 786.999, 'duration': 4.828}, {'end': 794.67, 'text': "Now, see, I'm going to take the same example.", 'start': 792.408, 'duration': 2.262}, {'end': 797.473, 'text': 'We are having only five elements.', 'start': 794.69, 'duration': 2.783}, {'end': 802.178, 'text': "Fine Now, how to insert? First of all, we'll discuss with the help of an example.", 'start': 797.914, 'duration': 4.264}, {'end': 803.94, 'text': "This example, then we'll write down the code.", 'start': 802.218, 'duration': 1.722}, {'end': 806.603, 'text': 'Fine Now, suppose at position here.', 'start': 804.32, 'duration': 2.283}, {'end': 810.621, 'text': 'at position three.', 'start': 809.44, 'duration': 1.181}, {'end': 814.383, 'text': 'see, i am going to take index and position different thing.', 'start': 810.621, 'duration': 3.762}, {'end': 818.645, 'text': 'somewhere you find out that index is same as position.', 'start': 814.383, 'duration': 4.262}, {'end': 822.047, 'text': 'somewhere it is written that at position two you are going to insert.', 'start': 818.645, 'duration': 3.402}, {'end': 824.729, 'text': 'so index is also two, but here i am going to see.', 'start': 822.047, 'duration': 2.682}, {'end': 830.612, 'text': 'here i am going to consider position is third, but index is two, because, as you can see, position is one, two and three.', 'start': 824.729, 'duration': 5.883}, {'end': 833.533, 'text': 'fine, but index is 2.', 'start': 831.892, 'duration': 1.641}], 'summary': 'Discussion on inserting elements at specific positions in a five-element code example.', 'duration': 46.534, 'max_score': 786.999, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk786999.jpg'}, {'end': 888.099, 'src': 'embed', 'start': 859.222, 'weight': 0, 'content': [{'end': 864.243, 'text': 'we want all the previous element as well as you want some extra element that you want to insert.', 'start': 859.222, 'duration': 5.021}, {'end': 867.163, 'text': 'so you cannot do directly this.', 'start': 864.243, 'duration': 2.92}, {'end': 871.384, 'text': 'so another approach is what you can shift these elements to the right side.', 'start': 867.163, 'duration': 4.221}, {'end': 874.785, 'text': 'fine, because still we have space left in the array.', 'start': 871.384, 'duration': 3.401}, {'end': 883.535, 'text': 'so you can shift this this 5 here, then this 4 here, then this 0 here.', 'start': 874.785, 'duration': 8.75}, {'end': 888.099, 'text': 'so here what you can write this 5 after shifting.', 'start': 883.535, 'duration': 4.564}], 'summary': 'Shift elements to make space and insert new element.', 'duration': 28.877, 'max_score': 859.222, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk859222.jpg'}, {'end': 982.077, 'src': 'embed', 'start': 958.365, 'weight': 2, 'content': [{'end': 965.474, 'text': 'So here we are also taking more inputs from the user, that is, number you want to insert and at which position you want to insert the data.', 'start': 958.365, 'duration': 7.109}, {'end': 974.265, 'text': 'So for storing these two values, you have to declare two variables, that is, num and pos, right?', 'start': 965.975, 'duration': 8.29}, {'end': 979.513, 'text': 'So now same, enter the size of the array, size you have to enter.', 'start': 975.327, 'duration': 4.186}, {'end': 982.077, 'text': 'then you are going to enter the elements of the array.', 'start': 979.513, 'duration': 2.564}], 'summary': 'Taking user inputs for number and position, along with array size and elements.', 'duration': 23.712, 'max_score': 958.365, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk958365.jpg'}], 'start': 786.999, 'title': 'Array insertion', 'summary': 'Explains inserting elements into an array with examples and addresses data loss, shifting elements, user input validation, and boundary checking.', 'chapters': [{'end': 859.222, 'start': 786.999, 'title': 'Array insertion example', 'summary': 'Explains the process of inserting elements into an array with an example and emphasizes the difference between position and index, addressing the potential loss of data when directly inserting a value.', 'duration': 72.223, 'highlights': ['The process of inserting elements into an array is explained with an example.', 'The difference between position and index is emphasized, clarifying that position 3 corresponds to index 2.', 'The potential loss of data when directly inserting a value into an array is addressed.']}, {'end': 1028.339, 'start': 859.222, 'title': 'Inserting element in array', 'summary': 'Discusses inserting elements in an array, including shifting existing elements to accommodate the new insertion, user input validation, and boundary checking for array size.', 'duration': 169.117, 'highlights': ['The chapter explains the process of shifting elements to the right in an array to make room for a new insertion, using an example of inserting the number 10 at position 3 in an array.', 'It emphasizes the need for user input validation by declaring variables for the number to insert and the position, and checking the array size to ensure it does not exceed 50 elements.', 'The chapter underscores the importance of boundary checking for arrays in C, highlighting that the programmer must manually include code to check the boundaries as there is no built-in concept of bound checking.']}], 'duration': 241.34, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk786999.jpg', 'highlights': ['The potential loss of data when directly inserting a value into an array is addressed.', 'The chapter explains the process of shifting elements to the right in an array to make room for a new insertion, using an example of inserting the number 10 at position 3 in an array.', 'It emphasizes the need for user input validation by declaring variables for the number to insert and the position, and checking the array size to ensure it does not exceed 50 elements.', 'The difference between position and index is emphasized, clarifying that position 3 corresponds to index 2.', 'The chapter underscores the importance of boundary checking for arrays in C, highlighting that the programmer must manually include code to check the boundaries as there is no built-in concept of bound checking.', 'The process of inserting elements into an array is explained with an example.']}, {'end': 1310.166, 'segs': [{'end': 1109.492, 'src': 'embed', 'start': 1080.875, 'weight': 2, 'content': [{'end': 1084.757, 'text': 'You will lose this value 4 and here you will insert this 0.', 'start': 1080.875, 'duration': 3.882}, {'end': 1088.779, 'text': 'Now from where you can recover this 4? We cannot recover this 4.', 'start': 1084.757, 'duration': 4.022}, {'end': 1091.441, 'text': 'So you cannot start the swapping from here.', 'start': 1088.779, 'duration': 2.662}, {'end': 1094.162, 'text': 'You have to swap from this position only.', 'start': 1091.481, 'duration': 2.681}, {'end': 1098.605, 'text': 'So now you will write down a 4 loop.', 'start': 1095.903, 'duration': 2.702}, {'end': 1106.13, 'text': 'for swapping and we will start this four loop from where we have started, from here.', 'start': 1100.046, 'duration': 6.084}, {'end': 1109.492, 'text': 'initially, we are having only five elements, from zero to four.', 'start': 1106.13, 'duration': 3.362}], 'summary': 'Cannot recover value 4; start swapping from this position; use 4-loop for swapping.', 'duration': 28.617, 'max_score': 1080.875, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1080875.jpg'}, {'end': 1197.596, 'src': 'heatmap', 'start': 1106.13, 'weight': 1, 'content': [{'end': 1109.492, 'text': 'initially, we are having only five elements, from zero to four.', 'start': 1106.13, 'duration': 3.362}, {'end': 1114.655, 'text': 'so we have started our loop from here and we have shifted this to this.', 'start': 1109.492, 'duration': 5.163}, {'end': 1116.215, 'text': 'fine two ways are there.', 'start': 1114.655, 'duration': 1.56}, {'end': 1120.021, 'text': 'you can also start our four loop here From size.', 'start': 1116.215, 'duration': 3.806}, {'end': 1121.462, 'text': 'See size is 5.', 'start': 1120.061, 'duration': 1.401}, {'end': 1123.404, 'text': 'So you can start from the for loop here.', 'start': 1121.462, 'duration': 1.942}, {'end': 1124.665, 'text': 'I is equal to size.', 'start': 1123.424, 'duration': 1.241}, {'end': 1125.546, 'text': 'That is also fine.', 'start': 1124.705, 'duration': 0.841}, {'end': 1127.728, 'text': 'And you can also start from here.', 'start': 1126.027, 'duration': 1.701}, {'end': 1130.031, 'text': 'That is size minus 1.', 'start': 1127.808, 'duration': 2.223}, {'end': 1134.175, 'text': 'So here I am starting from size minus 1.', 'start': 1130.031, 'duration': 4.144}, {'end': 1135.516, 'text': 'And from where.', 'start': 1134.175, 'duration': 1.341}, {'end': 1137.598, 'text': 'I should be greater than.', 'start': 1136.077, 'duration': 1.521}, {'end': 1139.1, 'text': 'Equal to.', 'start': 1138.519, 'duration': 0.581}, {'end': 1144.504, 'text': 'Position minus 1.', 'start': 1143.083, 'duration': 1.421}, {'end': 1147.285, 'text': 'See I will go till the value 2.', 'start': 1144.504, 'duration': 2.781}, {'end': 1148.626, 'text': 'And position value is 3.', 'start': 1147.285, 'duration': 1.341}, {'end': 1151.468, 'text': 'So 3 minus 1 that is till 2.', 'start': 1148.626, 'duration': 2.842}, {'end': 1154.95, 'text': 'So I should be greater than equal to 2.', 'start': 1151.468, 'duration': 3.482}, {'end': 1157.771, 'text': 'From here to here you are going to swap.', 'start': 1154.95, 'duration': 2.821}, {'end': 1160.032, 'text': 'And here you will write I minus minus.', 'start': 1158.331, 'duration': 1.701}, {'end': 1162.874, 'text': 'Now what here what we are doing.', 'start': 1161.533, 'duration': 1.341}, {'end': 1168.477, 'text': 'We are inserting this value previous value to I plus 1.', 'start': 1163.394, 'duration': 5.083}, {'end': 1170.478, 'text': 'Right So how you will write here.', 'start': 1168.477, 'duration': 2.001}, {'end': 1171.819, 'text': 'A of.', 'start': 1170.498, 'duration': 1.321}, {'end': 1182.113, 'text': 'so here you will write a of i plus 1 is equal.', 'start': 1179.232, 'duration': 2.881}, {'end': 1184.773, 'text': 'to see a of i would be shifted to a of i plus 1.', 'start': 1182.113, 'duration': 2.66}, {'end': 1186.493, 'text': 'that is at starting.', 'start': 1184.773, 'duration': 1.72}, {'end': 1188.074, 'text': 'i is equal to size minus 1.', 'start': 1186.493, 'duration': 1.581}, {'end': 1189.134, 'text': 'so i is equal to.', 'start': 1188.074, 'duration': 1.06}, {'end': 1191.214, 'text': 'size is 5.', 'start': 1189.134, 'duration': 2.08}, {'end': 1191.955, 'text': 'size is 5.', 'start': 1191.214, 'duration': 0.741}, {'end': 1193.495, 'text': 'so i is equal to 4.', 'start': 1191.955, 'duration': 1.54}, {'end': 1196.255, 'text': '4 is greater than equal to position minus 1.', 'start': 1193.495, 'duration': 2.76}, {'end': 1197.596, 'text': '4 is greater than equal to 2.', 'start': 1196.255, 'duration': 1.341}], 'summary': 'Using a loop to swap elements, starting from size-1, to position-1.', 'duration': 34.202, 'max_score': 1106.13, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1106130.jpg'}, {'end': 1304.682, 'src': 'heatmap', 'start': 1257.292, 'weight': 0, 'content': [{'end': 1260.479, 'text': 'see position is 3.', 'start': 1257.292, 'duration': 3.187}, {'end': 1262.801, 'text': 'are we are dealing with index now?', 'start': 1260.479, 'duration': 2.322}, {'end': 1266.564, 'text': 'so a of 3, minus 1, that is a of 2, a of 2.', 'start': 1262.801, 'duration': 3.763}, {'end': 1271.729, 'text': 'here you are going to insert 10, but position is still 3, 1, 2 and 3.', 'start': 1266.564, 'duration': 5.165}, {'end': 1273.971, 'text': 'but index is position minus 1.', 'start': 1271.729, 'duration': 2.242}, {'end': 1280.816, 'text': 'so here you are going to insert number and after inserting this number now array size becomes what 6.', 'start': 1273.971, 'duration': 6.845}, {'end': 1287.411, 'text': 'so now size becomes size plus plus right now.', 'start': 1280.816, 'duration': 6.595}, {'end': 1289.692, 'text': 'finally, you will print this array.', 'start': 1287.411, 'duration': 2.281}, {'end': 1293.175, 'text': 'how you can print this array we have discussed when we were traversing the array.', 'start': 1289.692, 'duration': 3.483}, {'end': 1304.682, 'text': 'you just write down a for loop, in for loop, you will start from 0 to the size fine and you simply write printf, %d and a of i,', 'start': 1293.175, 'duration': 11.507}], 'summary': 'Inserting number at position 3, array size becomes 6, then printing the array.', 'duration': 32.4, 'max_score': 1257.292, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1257292.jpg'}], 'start': 1028.339, 'title': 'Memory insertion and swapping', 'summary': 'Explains the process of inserting a number at a specified position in memory, starting the swapping process from the last element, and utilizing a for loop to increase the size of the array to 6.', 'chapters': [{'end': 1106.13, 'start': 1028.339, 'title': 'Insertion and swapping in memory', 'summary': 'Explains the process of inserting a number at a specified position in memory and the logic behind starting the swapping process from the last element, with an example of swapping number 10 at position 3.', 'duration': 77.791, 'highlights': ['The swapping process starts from the last element in order to prevent overwriting existing values, as demonstrated by the example of swapping number 10 at position 3.', 'The process involves allocating memory for the input data and position, followed by implementing a loop for swapping, ensuring the preservation of existing values and successful insertion.']}, {'end': 1310.166, 'start': 1106.13, 'title': 'Inserting data at specific position', 'summary': 'Explains the process of inserting data at a specific position in an array, utilizing a for loop to shift elements and ultimately increase the size of the array, resulting in a new array of size 6.', 'duration': 204.036, 'highlights': ['The chapter explains the process of inserting data at a specific position in an array It details the process of using a for loop to shift elements and increase the size of the array.', 'Utilizing a for loop to shift elements and ultimately increase the size of the array The for loop is used to shift elements within the array and increase the array size, demonstrating a practical application of the insertion process.', 'Resulting in a new array of size 6 The insertion process ultimately results in a new array with a size of 6, showcasing the effectiveness of the insertion algorithm.']}], 'duration': 281.827, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1028339.jpg', 'highlights': ['The process involves allocating memory for the input data and position, followed by implementing a loop for swapping, ensuring the preservation of existing values and successful insertion.', 'The swapping process starts from the last element in order to prevent overwriting existing values, as demonstrated by the example of swapping number 10 at position 3.', 'Resulting in a new array of size 6 The insertion process ultimately results in a new array with a size of 6, showcasing the effectiveness of the insertion algorithm.', 'Utilizing a for loop to shift elements and ultimately increase the size of the array The for loop is used to shift elements within the array and increase the array size, demonstrating a practical application of the insertion process.', 'The chapter explains the process of inserting data at a specific position in an array It details the process of using a for loop to shift elements and increase the size of the array.']}, {'end': 1730.719, 'segs': [{'end': 1392.911, 'src': 'embed', 'start': 1361.65, 'weight': 3, 'content': [{'end': 1363.651, 'text': 'that is not possible in array.', 'start': 1361.65, 'duration': 2.001}, {'end': 1369.253, 'text': 'so here you can also write down one if condition on position after this position here.', 'start': 1363.651, 'duration': 5.602}, {'end': 1374.178, 'text': 'so here you can write if Position is less than equal to 0..', 'start': 1369.253, 'duration': 4.925}, {'end': 1375.899, 'text': 'Because if we take position is equal to 0.', 'start': 1374.178, 'duration': 1.721}, {'end': 1378.841, 'text': 'Then here 0 minus 1 that is minus 1.', 'start': 1375.899, 'duration': 2.942}, {'end': 1379.561, 'text': 'That is invalid.', 'start': 1378.841, 'duration': 0.72}, {'end': 1381.963, 'text': 'So position is less than equal to 0.', 'start': 1380.042, 'duration': 1.921}, {'end': 1386.807, 'text': 'Or position is greater than size.', 'start': 1381.963, 'duration': 4.844}, {'end': 1388.528, 'text': 'Or size plus 1 you can say.', 'start': 1387.087, 'duration': 1.441}, {'end': 1392.911, 'text': 'Fine Because size is 5.', 'start': 1389.769, 'duration': 3.142}], 'summary': 'Code includes if conditions for position validation; size is 5.', 'duration': 31.261, 'max_score': 1361.65, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1361650.jpg'}, {'end': 1563.952, 'src': 'embed', 'start': 1534.83, 'weight': 0, 'content': [{'end': 1535.891, 'text': 'that is very simple.', 'start': 1534.83, 'duration': 1.061}, {'end': 1538.811, 'text': 'no swapping would be done, fine.', 'start': 1535.891, 'duration': 2.92}, {'end': 1541.153, 'text': 'so now how you will insert.', 'start': 1538.811, 'duration': 2.342}, {'end': 1544.637, 'text': 'simply you just enter the data you want to insert.', 'start': 1541.153, 'duration': 3.484}, {'end': 1549.963, 'text': 'no need to ask the position, no need to do this swapping and all, fine.', 'start': 1544.637, 'duration': 5.326}, {'end': 1552.485, 'text': 'simply you will write a of here.', 'start': 1549.963, 'duration': 2.522}, {'end': 1556.91, 'text': 'here means you can say that size a of size, size is 5.', 'start': 1552.485, 'duration': 4.425}, {'end': 1559.269, 'text': 'so at index 5.', 'start': 1556.91, 'duration': 2.359}, {'end': 1563.952, 'text': 'at here at index 5, because if size is 5 then data would be from 0 to 4.', 'start': 1559.269, 'duration': 4.683}], 'summary': 'Inserting data into an array is straightforward, without swapping, by entering data directly at the designated index, e.g., at index 5 for an array of size 5.', 'duration': 29.122, 'max_score': 1534.83, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1534830.jpg'}], 'start': 1310.998, 'title': 'Array insertion conditions and data insertion in array', 'summary': 'Discusses conditions for inserting elements into an array, emphasizing valid positions within the range of 1 to 5 and non-consecutive locations. it also explains how to insert data at any specific position, highlighting time complexity and algorithm differences for unsorted and sorted arrays.', 'chapters': [{'end': 1388.528, 'start': 1310.998, 'title': 'Array insertion conditions', 'summary': 'Discusses the conditions for inserting elements into an array, including the valid positions and the size of the array, emphasizing that position should be within the range of 1 to 5 and the insertion is not possible for positions outside this range or non-consecutive locations.', 'duration': 77.53, 'highlights': ['Position should be within the range of 1 to 5 for valid insertion.', 'Insertion is not possible for positions outside the range or non-consecutive locations.', 'Invalid positions include less than 0 and greater than the size (5) of the array.']}, {'end': 1730.719, 'start': 1389.769, 'title': 'Inserting data in array', 'summary': 'Explains how to insert data at any specific position in an array, highlights time complexity, and contrasts the best algorithm for unsorted and sorted arrays.', 'duration': 340.95, 'highlights': ['The time complexity for inserting data at a given position in an array is theta n, with the best case being 1 and the worst case being theta n, depending on the given position.', 'The best algorithm for inserting data in an unsorted array is to directly insert the new value at the end of the array, resulting in a constant time complexity of 1.', 'In a sorted array, the relative ordering of elements must be maintained, requiring shift operations for inserting new data.', 'The next topic to be discussed in the following video is how to delete data from the array.']}], 'duration': 419.721, 'thumbnail': 'https://coursnap.oss-ap-southeast-1.aliyuncs.com/video-capture/Bnjbun-hiBk/pics/Bnjbun-hiBk1310998.jpg', 'highlights': ['Insertion is not possible for positions outside the range or non-consecutive locations.', 'The time complexity for inserting data at a given position in an array is theta n, with the best case being 1 and the worst case being theta n, depending on the given position.', 'The best algorithm for inserting data in an unsorted array is to directly insert the new value at the end of the array, resulting in a constant time complexity of 1.', 'Invalid positions include less than 0 and greater than the size (5) of the array.']}], 'highlights': ['The chapter covers traversal, insertion, deletion, searching, and sorting of arrays, along with additional operations like finding minimum and maximum elements, duplicate elements, reversing the array, and finding the second largest element.', 'The process of inserting data at a specific position in an array It details the process of using a for loop to shift elements and increase the size of the array.', 'The process of inserting elements into an array is explained with an example.', 'The swapping process starts from the last element in order to prevent overwriting existing values, as demonstrated by the example of swapping number 10 at position 3.', 'The chapter discusses the limitations of fixed-size arrays, emphasizing that once the size is declared at compile time, it cannot be changed at runtime, with an example of a size of 50 and allocation of 200 bytes.']}