🎯 Key Takeaways for quick navigation: 01:19 📌 Arrays are collections of data types, and their syntax includes the data type and size declaration. 03:35 📌 Arrays in Java are stored in the heap memory, and heap objects are not guaranteed to be continuous. 09:55 📌 The "new" keyword is used to create objects in Java, including arrays. It's associated with dynamic memory allocation. 16:44 📌 Array indices start from 0, and accessing elements is done using these indices. 20:18 📌 "null" is a special literal in Java representing the absence of a value and is commonly used for uninitialized reference variables. 25:53 📚 2D arrays in Java can be visualized as arrays of arrays, where each individual index holds a reference to an array. 31:23 🔄 You can iterate through array elements using a traditional for loop, an enhanced for-each loop, or utilize the `Arrays.toString()` method for simple printing. 40:07 🔀 Java passes array references to functions by value, allowing functions to modify the original array data. 42:49 🛠️ Defining a 2D array in Java involves specifying the number of rows, while the number of columns can vary for each row. 48:26 🔄 The individual arrays within a 2D array can have varying sizes, making it possible to have jagged arrays where each row has a different number of columns. 51:01 📚 Arrays in 2D can be accessed using index [row][column]. 52:40 📚 `array.length` returns number of rows in a 2D array. 56:14 📚 Nested loops are used to input values in a 2D array. 01:00:11 📚 Enhanced for loop simplifies iterating through 2D arrays. 01:04:19 📚 ArrayList in Java allows dynamic resizing without specifying size. 01:15:00 📚 ArrayList in Java is a dynamic data structure similar to arrays but with automatic resizing. 01:17:26 🧬 ArrayList capacity increases dynamically by doubling its size when it reaches a certain threshold. 01:19:39 🔍 ArrayList supports methods like add, remove, update, set, contains, and more for manipulating elements. 01:24:41 ⏰ ArrayList provides an amortized constant-time complexity for adding elements due to its dynamic resizing strategy. 01:35:48 🔄 Swap and find maximum element in an ArrayList can be achieved through simple iterative loops and basic comparison logic. 01:40:48 🔄 Reversing an array using the two-pointer method involves swapping elements from start to end and gradually moving the pointers towards each other. 01:41:28 🔃 The reverse process works for both even and odd-length arrays, utilizing start and end pointers to achieve the reversal. 01:43:05 ✨ The code for reversing an array using the two-pointer approach was demonstrated, showing how to swap and adjust pointers to reverse the array. 01:43:58 🚶♂️ The two-pointer method is introduced as a valuable technique, and the session concludes by highlighting the upcoming focus on more advanced array-related questions. 01:44:26 📚 Future sessions will delve into array-related questions, including rotation, palindromic arrays, sliding windows, and two-pointer techniques to enhance problem-solving skills. Made with HARPA AI
@@Dicegambler-r8h The choice between learning Data Structures and Algorithms (DSA) or continuing to study Java depends on your goals and interests. If you want to focus on programming fundamentals, continue learning Java. If you're more interested in competitive programming, software engineering, or algorithm-heavy fields, DSA could be a valuable skill. Consider your career aspirations and personal preferences to make the decision. It's also possible to blend both by learning DSA in the context of Java or another programming language.
I searched for a lot of courses on DSA on youtube, used to watch 1 or 2 videos, after that it became boring. But I am addicted to this course and Kunal is slowly becoming an inspiration to me. Thanks Kunal
The subtle sense of humour keeps me hook. I was following a guys course dont want to point out names(rhymes with dman attarwal ) for c++ and as soon as i saw this guys first video i am now a java guy.
Just a suggestion. These videos are gonna be watched by millions of people worldwide over many years. As current people expect videos faster, please don't prioritise that over quality of the videos. Take your time! Make the best courses ever! ❤️ As always, you're doing a great job!
When kunal's marriage is getting fixed and his parents asks for the wedding date he will say we will look into it in object oriented programming Ps: This is just a joke.The course is amazing and way better than anything i have ever seen
See I am not a beginner in java and dsa but still I didn't knew this much knowledge regarding arrays. Indeed it's a very detailed course, kudos to kunal ✌👍🔥
Kunal you are the first person who explains the 'internal working' of everything! Every other course I took, the 'why' part was missing and I had lot of questions. Now everything is crystal clear! Keep up the good work! Thanks a lot🙂
No doubt we must know the concepts and 'why' part really well and kudos to Kunal for such a detailed explaination, but the internal working of data structures is certainly not required for solving most of the questions. It can be disastrous. as it was in my case, if someone newbie doesn't know this and wastes his entire time on understanding the theoretical part. That's why I think, in the DSA course it should have been avoided, where major focus must be on problem solving. Again, no hate at all.
@@KunalKushwaha U said u will cover in 2 months the whole course. But now u have stopped even its 6 months. You r spending time on other courses which could have been made after completing DSA. Y r u doing so? Y r u making us feel dependent and helpless by leaving in the middle le?? You got huge number of subscribers bcz of your DSA course and we needed it and trusted you. This is unfair.
@@Sendobren sief free content k name se kuch ni hota. Banda apna time invest kar rha hai agr kuch dekhne ko.. To wo complete hi ni to kya faida.. Placement ni nikaal paao gay incomplete knowledge se. Dekh lo ghanto tak free content
can someone tell what to dop after learning concepts to solve questions and from where to start solving easy level question because after watching video i personaly forgot things
Okey! so I'm a Cybersecurity Student from Germany, I just got to know about this channel and man ohh man it's the best thing on TH-cam. Happy to learn from him. We do have DSA in our Cybersecurity curriculum because it is helpful for roles like Cybersecurity Engineer, Where we need to build efficient programs :)
I am also 2022 graduate like kunal , I also know ds/algo very well. I have watched dsa course of almost all big ed-tech startups in India.I can assure anyone this is not one of the but the best course in the market. Waiting for other courses by him so that I can also learn him.Such a inspiration for me
@@KunalKushwaha U said u will cover in 2 months the whole course. But now u have stopped even its 6 months. You r spending time on other courses which could have been made after completing DSA. Y r u doing so? Y r u making us feel dependent and helpless by leaving in the middle le?? You got huge number of subscribers bcz of your DSA course and we needed it and trusted you. This is unfair.
1:27:47 yeah its doubling the array size as you said .prefGrowth parameter is rightshifted by 1 bit which mathematically means multiply by 2, so size is doubled
Timestamps: 0:00 Introduction 1:22 Why we need Arrays? 2:58 What is an Array? 3:13 Syntax of an Array 4:26 Direct hit Program : Store 5 Roll Numbers 6:44 How does Array works? 8:42 Internal Working of an Array 10:32 Dynamic Memory Allocation 12:00 Internal Representation of Array 13:06 Continuity of an Array 16:25 Index of an Array 19:53 String Array 20:42 What is null in Java? 23:30 null is used as a default 27:55 Array Input 31:19 for-each loop 33:15 toString() Method 34:52 Array of Objects 36:25 Storage of Objects in Heap 40:21 Array Passing in Function 42:32 Multidimensional Arrays 43:36 Syntax of a 2D Array 45:20 Internal Working of a 2D Array 50:16 2D Array Input 1:01:06 2D Array Output 1:07:05 Dynamic Arrays 1:17:22 Array Functions 1:21:08 Internal Working of ArrayList 1:33:21 Questions 1:33:30 Q1 : Swaping Values in an Array 1:35:20 Q2 : Maximum Value of an Array 1:40:45 Q3 : Reversing an Array 1:44:20 Outro
Haven't studied array in my life in such a way that I did today. This course is going to be loved by millions in the upcoming years. Adding a comment so that if someone finds it similar with their thoughts I'll be having notifications. Great job!
Kunal hope u will provide all the "quality" questions for each of the videos of dsa which would cover the concepts in whole so that we don't have to search out for things 🙌🙌
You made 1hr45mins length video just to explain Arrays and Arraylist 🤩🤩 The Concepts are cleared so thorough. Really, this is the best DSA Series❤️ one can't even think of making this that too for free.
Sir, i dont have any words to say, following your playlist from just 2 days and i am on this video, Man its so addictive, literally i was the guy who was spending whole time on Netflix just doing timepass. Getting this playlist is like getting treasures in Egypt. How can i thank you.
🎯 Key Takeaways for quick navigation: 00:46 🤔 Arrays are needed when there's a need to store a collection of data elements of the same type. They provide a way to efficiently store and manage multiple values of the same data type. 03:18 🧩 The syntax to create an array in Java involves specifying the data type followed by square brackets. Memory for the array is dynamically allocated at runtime using the `new` keyword. 05:13 🧱 Arrays in Java are collections of elements of the same data type, and all elements in the array must have the same data type. 09:37 📊 Java heap objects, including arrays, are not necessarily continuous blocks of memory, unlike in some other languages like C++. JVM manages memory dynamically at runtime for heap objects. 20:18 📑 When an array of non-primitive objects is created, each element of the array is initialized with the default value `null`. 25:53 🧠 Java arrays store reference variables, and each element in the array points to objects in the heap memory. 28:32 📝 You can use for loops to easily populate arrays with user input or print their elements. 31:23 🔄 Enhanced for-loop (for-each) provides a cleaner way to iterate through array elements directly without using indices. 37:20 💡 Java 2D arrays can be visualized as arrays of arrays, where each element points to another array in the heap memory. 48:26 🔄 The size of individual rows in a 2D array can vary, as each row is a separate object with its own memory allocation. 51:01 👉 Arrays in Java are initialized with a fixed size, making them less flexible for dynamic input. 53:07 👉 To take input for a 2D array, use nested for loops to iterate through each row and column. 54:25 👉 Use `Arrays.toString()` or enhanced for loops to print the 2D array in a more readable format. 59:14 👉 For varying column sizes, access the size of each row individually using `array[row].length`. 01:05:20 👉 ArrayList in Java provides a dynamic-size array-like structure, allowing adding elements without specifying a fixed size. 01:14:31 🔄 Constructor in Java is used to define initial values for an object. It is essential in object-oriented programming but not discussed in detail here. 01:15:00 📝 ArrayList in Java can dynamically add elements without specifying an initial size. It internally resizes and doubles its capacity as needed when elements are added beyond the initial capacity. 01:15:30 ➕ Elements can be added to an ArrayList using the `add` method. There is no need to specify an initial size, and multiple elements can be added sequentially. 01:17:39 ❓ ArrayList provides useful methods like `contains`, `set`, and `remove` to perform operations on its elements, making it easy to manipulate data. 01:25:08 🔄 ArrayList internally resizes its capacity to accommodate more elements. When the capacity is reached, it creates a new, larger ArrayList and copies the elements to it. The process of resizing maintains a constant amortized time complexity for adding elements. 01:40:15 🔀 To reverse an array in Java, use the "two pointer method." Swap elements at the start and end indices iteratively until the start index becomes greater than the end index. 01:40:48 🔄 The two pointer method works for arrays of both even and odd lengths. 01:43:05 ➕ The `swap` function can be used to swap elements in the array efficiently during the reversal process. 01:43:18 🎯 The two pointer method is a useful approach for solving specific coding challenges, such as those involving array rotation or palindromic arrays. 01:44:12 📅 Future videos will focus on solving coding questions related to arrays using techniques like sliding window and two-pointer methods. Made with HARPA AI
I am amazed by the fact that , Kunal can make learning so easy and faster , i cannot recall when was the last time i had this efficiency in learning a language, also it is so fun , seeing him smile a little when he runs a snippet of code . I hereby declare , your are my fav person for DSA on youtube . Great work Kunal , Thanks.
The array elements are contiguous in nature even in java. The object encompasses the array. JVM will allocate each element of array in contiguous nature only within the object that encompasses it. However, the object itself will be allocated any free area available in the heap so basically, if you create 2 objects in rapid succession, they may still be allocated at different addresses but the arrays in those objects will be contiguous in nature.
One thing I like most is the usage of face-cam in your tutorials. It makes me feel like having a live interaction and its very effective and addictive Cheers Kunal❤️🙌
Kunal, I discovered your channel while I was trying to understand arrays and I have to say you might be one of the best programming tutorial channels out there. You explain everything thoroughly but you do not complicate things. You go in to depth and not only answer the how but the why. Thank you.
hm i was watching and got distrated by my cat looked at the cat and looked back at the screen and I see kunal staring into my soul and said kool, the timing on that lol
Seriously yaar no one like u ❤️ ur amazing .....before this session I didn't saw any single video on arrays like this . Thanku so much for ur support .
this course is above every other one on internet i have seen so many courses and they don't feel the same they get boring after 2-3 videos but yours is just on another level you share every bit of information which too in such a great way
00:06 Introduction to arrays and ArrayList in Java 02:21 An array is a collection of data types that can store primitives or complex data types. 06:53 Declaration and Initialization of Arrays in Java 09:15 Dynamic memory allocation in Java 13:48 Java specifies that heap objects are not continuous 16:02 Arrays in Java are dependent on JVM and use index to access elements 19:48 Introduction to String Arrays and Null in Java 21:47 null is a special value for reference variables 25:33 Objects in arrays are stored in separate areas in heap memory. 27:16 Arrays in Java are collections of reference variables with default value of null. 31:03 Introduction to for each loop in Java 33:16 Using Arrays class to print arrays in Java 37:00 Arrays store reference variables to objects in the heap 38:47 Array and ArrayList usage in Java 42:24 2D arrays in Java are like a matrix with rows and columns. 44:19 Arrays and ArrayList in Java store data differently from C++ 48:13 Arrays in Java can have variable column sizes, and each array is a separate object. 50:12 Input in arrays: Accessing and assigning values 54:49 Iterating through a 2D array using for loops and accessing elements 56:38 Understanding the iteration process in the for loop. 1:00:23 Creating and iterating through arrays in Java. 1:02:30 Printing Arrays and ArrayList in Java 1:06:42 Understanding the significance of arr.length in printing arrays. 1:08:34 An ArrayList is used when the size of the array is unknown 1:12:00 Java provides the implementation of various data structures like ArrayList. 1:13:36 Generics in Java allow specifying the type of data that can be stored in a list object. 1:17:08 Introduction to Arrays and ArrayList in Java 1:19:18 Introduction to Arrays and ArrayList in Java, Iteration output, and maintaining the index 1:23:35 ArrayList doubles in size when full and copies elements 1:25:18 ArrayList doubles its capacity when full 1:30:06 Initializing and adding elements to ArrayList in Java 1:32:06 To avoid errors, ensure that lists are created before accessing them. 1:36:01 Finding the maximum item in an array using iteration 1:37:52 Finding the maximum value in a specified range of an array in Java. 1:41:51 Reversing the array using start and end pointers. 1:43:48 Introduction to two pointer method Crafted by Merlin AI.
I Already know java intermediate level but watching the series for the first video because there a something interesting about this guy that makes me watch it.His tone of teaching his knowledge just Loved it....Thanks kunal
I have a small doubt. How does he check every details of internal working in IntelliJ? What's the shortcut key? Or process? @Kunal Someone please reply.
I have finished 1hr 45 mins video in one go 😱, kunal your videos are so much addictive. To your content, to your determination, to your hardwork take a bow 🙌
@@mesmerizeart663😂😂😂 no bro I solve many questions regarding 2d arrays and multi dimensionol arrays I start with basic of Kunal series firsti watch complete Oop course of 7 vedio then I start DSA from 1 to 8 vedio now concept are cleared now he is a great teacher
I wanted to learn 2D arrays in java and searched for it on TH-cam and other sources i didn't understand a thing, may be because it was imprinted on my mind that it's complicated but Kunal you made it soooo easy , internal working and all oh my god such a wonderful gift you are for us ❤️
people are making vdeos on how to slove that question and I think that will be pretty easy if u understand the solution from anywhere u can teach or make videos but the most important thing which I feel on watching kunal videos is that he is teaching from the basics like how memory allocates and how actually things work on the system .. and bhai thanks again itna deep me mene kabhi nahi socha tha ki cheeje hogi..
On 21:51 you said that we cant assign null to any primitives, but I tried and if we pass something like int a = Integer.parseInt(null); This doesn't show any error whatsoever. What could be the reason behind this. Can anyone comment on this?
Seriously man you amaze me with your teaching skills in every video! I never understood arrays in such a detailed manner. Thanks a lot for this course.
If anyone is wondering why it is O(1) in insertion, the logic (as best as I can understand), is this - Basically every time you double it, the capacity increases to twice, so you need not double it for quite some time. Suppose your original ArrayList had cap:10 And you have to fill 1000 values After 5 values, new_cap = 20 After 10 values, new_cap = 40 After 20 values, new_cap = 80 After 40 values, new_cap = 160 After 80 values, new_cap = 320 After 160 values, new_cap = 640 After 320 values, new_cap = 1280 As this increases, you realize that to reach that half capacity when you need to double the size, that value also increases. To increase capacity to 2560, you need to add 320 more values. To increase capacity further to 5120, you need to add 640 more values So for larger values, this basically becomes O(1) wherein it is assumed that the ArrayList size is already so big, you're just appending values
if I initialize array list at 10 and add 350 values in it. Then, new size of array list is going to be 1280 but I do not add more values to it. so the Q is, will my array list will remain of size 1280 and rest of the space(1280-350) will be allocated in memory even though I am not using it?
@@jeeveshkumar9682 So you are right my friend, the rest of the space will be allocated in memory wether its been used or not, but there is an option called 'trimToSize()' you can use it for trimming the arraylist upto its lenght like in your case 350
We can use Arrays.sort(arr); class to first sort, and then return last value of that array. public class Main { public static void main(String[] args) { int[] arr = {2, 1, 3, 4, 5, 6, 10, 34, 3, 4, 5, 44}; max(arr); } private static void max(int[] arr) { Arrays.sort(arr); System.out.println(arr[arr.length - 1]); } }
bro i am not able to solve array assignment leetcode problem after watching array video also i have to see solution without solution i can't understand. Is it ok or what should i do???
If you are searching to the best videos of Java + DSA. Just go through this , you gonna learn very clearly rather than the paid courses🙌 Thanks Kunal lots of love from Nepal❤.
You are doing really good job!!!!! Can you please release the videos sooner because my placement season is going on and i want to complete the course as soon as possible.
Hi my dear brother Kunal. I am elder by 2 years than you but you are the greatest guru I have ever seen in my life. Learning from your videos just gives me true bliss and I can just keep learning from your videos all day long. If I keep aside your fantabulous teaching skills and insightful knowledge, the intention that you carry about providing such a precious knowledge for free just make me feel that you are born for the people like me who are very curious to learn things in details. Truly appreciate you from the core of my heart and I pray God to bless you immensely on this journey and make all the wishes true by making all our wishes true in disguise. I will be rooting for you on this journey. My dear talented brother!
🎯 Key Takeaways for quick navigation: 00:04 Arrays *in Java are collections of data types, either primitives or objects, stored in contiguous memory.* 01:19 The *need for arrays arises when dealing with multiple data elements, avoiding repetitive variable declarations.* 03:18 Array *syntax involves specifying data type and size, and the new keyword is used for dynamic memory allocation.* 05:13 Arrays *enforce a single data type, and their elements are accessed using indices starting from zero.* 10:55 Java's *heap memory, where arrays reside, may not guarantee continuous allocation due to JVM decisions.* 15:31 Dynamic *memory allocation occurs at runtime, and heap objects are not guaranteed to be continuous.* 18:16 The *'new' keyword is used to create an array object in Java, either with a specified size or direct initialization.* 19:42 Arrays, *when not explicitly initialized, contain default values (e.g., 0 for integers, null for objects) for their elements.* 23:30 In *Java, arrays of objects are stored in heap memory, while primitives are stored in stack memory.* 24:36 Unlike *Python, where everything is an object, Java distinguishes between primitives (stored in stack) and other objects (stored in heap).* 25:06 Object *arrays in Java consist of reference variables pointing to objects stored in different parts of heap memory.* 26:35 Distinction *between primitives (int, char, boolean) and non-primitives (complex data types) in Java, and their memory allocation.* 27:19 Arrays *are collections of reference variables, and uninitialized references default to null in Java.* 28:46 Demonstrating *array initialization and input using for loops in Java.* 31:23 Introducing *enhanced for loop for array traversal in Java.* 32:10 Highlighting *potential errors like index out of bound and introducing the Arrays class for printing arrays in Java.* 33:16 Utilizing *Arrays class to convert and print arrays as strings, a preferred method.* 37:35 Introduction *to 2D arrays in Java, represented as a matrix, with the necessity of specifying the number of rows.* 40:21 Demonstrating *the mutable behavior of arrays in Java functions (pass by value with object reference).* 43:25 Syntax *for defining and initializing 2D arrays in Java, with an example.* 46:32 Arrays *in Java are stored in the heap memory. The main array contains references to internal arrays.* Internally, each *index of the main array is an array itself, stored in different memory locations.* The column *size is not fixed, as each row can have a different number of columns.* Input for *a 2D array involves nested for loops, where the outer loop iterates over rows, and the inner loop iterates over columns to fill the elements.* The output *can be printed using nested loops, and `Arrays.toString` can be used to print each internal array.* `Arrays.toString` and *enhanced for loop can simplify printing the 2D array.* Introduction to *the concept of ArrayList is mentioned, emphasizing its flexibility compared to fixed-size arrays.* ArrayList is *useful when the size of the collection is unknown or dynamic.* Future topics *mentioned include searching, sorting, and solving interview questions, which will be covered in separate videos.* 01:09:34 ArrayList *in Java is similar to vectors in C++. It's part of the Java Collection Framework in the java.util package.* 01:10:33 Syntax *for ArrayList: `ArrayList
Hey Kunal, I've started with this playlist in December and I'm still on this video and related assignments since last two weeks. I find it really hard to solve leetcode easy problems related to this video. I really wanna start with bubble sort but I've got assignments to complete. Could you advise on how I shall move forward with this? I would really appreciate your reply on this. Thanks for this amazing playlist.
@@BhavanaReddy15 hey bro.. same here.. easy solution is that if u r not able to solved it.. just see the solution and uderstand how the logic is working.. dont demotivate all faces the same problem in thier begenning phase
Hi, Kunal, thank you for taking the time to take such elaborate sessions and explaining it such simple ways. I like the format (what, why, how to use - a concept) of your sessions. When you get a chance, could you please do a video/session on JSON, JSONObject, JSONArray, how to read/modify/loop through/parse, complex JSON like JSONArray inside another JSONArray etc? Thanks again. Looking forward to the next session.
Hi Kunal.. i am not sure if i have missed it but as u mentioned that heap memory MAY NOT BE continuous then how the elements would be accessed from array using index ?
Hey kunal ! just a little request if you can explain the difference in some similar concepts of java and python then it will be great.BTW you are providing great content..!Thanks.
Hi Kunal, Great Job! I found you mentioning for an expression int[] arr = new int[5]; The declaration < int[] arr > executed at compile time and the memory allocation happen while execution(run) time. Compile time we only check for compliance of types but actual variables(in stack) and memory allocation(in heap) both happened at runtime. I thought of by mistake mis spelled here. But thanks a lot for the best content.
I dont think there is any other course on youtube which matches the quality and dedication displayed by kunal in this video, Thanks so much for your effort, a lifesaver, cant wait for trees and graphs uploads.
Just a note: ArrayList Syntax changes with every java version, So when you try to use the same syntax in java17. It gives error that ArrayList will not take parameters
Kunal it would be really great if you create a new class for all the questions and concepts..It gets confusing sometimes if you do everything in the same class.
At 1:00:28, I get the logic of the inner for loop. But if we are providing variable number of elements in each row and if we don't mention the column length in advance during declaration (like this - new int[3][];), how will the system know the length of each row when we write col < arr[row].length?
This course is amazing and loving it. But in this video you talk about how to give output of those 2d array whose column are not fixed but didn't cover how to take input. well it's confusing me a lot so please help me on that part.
DSA + interview preparation playlist: th-cam.com/play/PL9gnSGHSqcnr_DxHsP7AW9ftq0AtAyYqJ.html
Thanks
me: doubt
kunal: don't worry, we will cover it in object oriented programming
😆😂
Brother I know it may sound funny now but It gives us motivation to watch till OOPs so that we can get our doubts cleared and be better
Take a bow man what an excellent teacher you are!!
Awesome!
1:39:40 pe end
waah kunal mauj kardi
Loved it man🔥🔥
🎯 Key Takeaways for quick navigation:
01:19 📌 Arrays are collections of data types, and their syntax includes the data type and size declaration.
03:35 📌 Arrays in Java are stored in the heap memory, and heap objects are not guaranteed to be continuous.
09:55 📌 The "new" keyword is used to create objects in Java, including arrays. It's associated with dynamic memory allocation.
16:44 📌 Array indices start from 0, and accessing elements is done using these indices.
20:18 📌 "null" is a special literal in Java representing the absence of a value and is commonly used for uninitialized reference variables.
25:53 📚 2D arrays in Java can be visualized as arrays of arrays, where each individual index holds a reference to an array.
31:23 🔄 You can iterate through array elements using a traditional for loop, an enhanced for-each loop, or utilize the `Arrays.toString()` method for simple printing.
40:07 🔀 Java passes array references to functions by value, allowing functions to modify the original array data.
42:49 🛠️ Defining a 2D array in Java involves specifying the number of rows, while the number of columns can vary for each row.
48:26 🔄 The individual arrays within a 2D array can have varying sizes, making it possible to have jagged arrays where each row has a different number of columns.
51:01 📚 Arrays in 2D can be accessed using index [row][column].
52:40 📚 `array.length` returns number of rows in a 2D array.
56:14 📚 Nested loops are used to input values in a 2D array.
01:00:11 📚 Enhanced for loop simplifies iterating through 2D arrays.
01:04:19 📚 ArrayList in Java allows dynamic resizing without specifying size.
01:15:00 📚 ArrayList in Java is a dynamic data structure similar to arrays but with automatic resizing.
01:17:26 🧬 ArrayList capacity increases dynamically by doubling its size when it reaches a certain threshold.
01:19:39 🔍 ArrayList supports methods like add, remove, update, set, contains, and more for manipulating elements.
01:24:41 ⏰ ArrayList provides an amortized constant-time complexity for adding elements due to its dynamic resizing strategy.
01:35:48 🔄 Swap and find maximum element in an ArrayList can be achieved through simple iterative loops and basic comparison logic.
01:40:48 🔄 Reversing an array using the two-pointer method involves swapping elements from start to end and gradually moving the pointers towards each other.
01:41:28 🔃 The reverse process works for both even and odd-length arrays, utilizing start and end pointers to achieve the reversal.
01:43:05 ✨ The code for reversing an array using the two-pointer approach was demonstrated, showing how to swap and adjust pointers to reverse the array.
01:43:58 🚶♂️ The two-pointer method is introduced as a valuable technique, and the session concludes by highlighting the upcoming focus on more advanced array-related questions.
01:44:26 📚 Future sessions will delve into array-related questions, including rotation, palindromic arrays, sliding windows, and two-pointer techniques to enhance problem-solving skills.
Made with HARPA AI
thank you brother
@@tahirahmed9446thank AI for generating this answer
that's cool bro how amazingly the ai has written all the contents 😮
What do I do after this video? Should I get into learning DSA? Or continue Java?
@@Dicegambler-r8h The choice between learning Data Structures and Algorithms (DSA) or continuing to study Java depends on your goals and interests. If you want to focus on programming fundamentals, continue learning Java. If you're more interested in competitive programming, software engineering, or algorithm-heavy fields, DSA could be a valuable skill. Consider your career aspirations and personal preferences to make the decision. It's also possible to blend both by learning DSA in the context of Java or another programming language.
I searched for a lot of courses on DSA on youtube, used to watch 1 or 2 videos, after that it became boring. But I am addicted to this course and Kunal is slowly becoming an inspiration to me. Thanks Kunal
There is no course on TH-cam/any online platforms like this one, for free.
yes same! i feel addicted too! maybe because i understand everything way easily
@@KunalKushwaha No doubt.. kunal bhai u r gem. Live u and this course 😍 keep shining ❤
@@KunalKushwaha There is no assignments for arrays in repo
The subtle sense of humour keeps me hook. I was following a guys course dont want to point out names(rhymes with dman attarwal ) for c++ and as soon as i saw this guys first video i am now a java guy.
Just a suggestion. These videos are gonna be watched by millions of people worldwide over many years. As current people expect videos faster, please don't prioritise that over quality of the videos. Take your time! Make the best courses ever! ❤️ As always, you're doing a great job!
And do spend a little bit more time on questions.
Agreed on it
I mentioned the questions part already that I will upload separate videos on questions only for every topic.
@@KunalKushwaha is it at the last or after some days
@@AjayYadav-xi9sj not at last, after every topic
When kunal's marriage is getting fixed and his parents asks for the wedding date he will say we will look into it in object oriented programming
Ps: This is just a joke.The course is amazing and way better than anything i have ever seen
hahaha.. nice one .. only those who watch videos completely can relate xD
Nice one there. LoL
"After watching your video, I regret buying paid courses."
Kunal kushwaha is a Gem of a person, i repeat Kunal kushwaha is a GEM of a person, period. That's it that's the comment.
See I am not a beginner in java and dsa but still I didn't knew this much knowledge regarding arrays. Indeed it's a very detailed course, kudos to kunal ✌👍🔥
What's your update now brother
Kunal you are the first person who explains the 'internal working' of everything! Every other course I took, the 'why' part was missing and I had lot of questions. Now everything is crystal clear! Keep up the good work! Thanks a lot🙂
No doubt we must know the concepts and 'why' part really well and kudos to Kunal for such a detailed explaination, but the internal working of data structures is certainly not required for solving most of the questions. It can be disastrous. as it was in my case, if someone newbie doesn't know this and wastes his entire time on understanding the theoretical part. That's why I think, in the DSA course it should have been avoided, where major focus must be on problem solving. Again, no hate at all.
Content is far better than paid courses😊...well done bro👍...keep bringing more such videos, I really appreciate your hard work
Thanks a ton
@@KunalKushwaha U said u will cover in 2 months the whole course. But now u have stopped even its 6 months. You r spending time on other courses which could have been made after completing DSA.
Y r u doing so?
Y r u making us feel dependent and helpless by leaving in the middle le??
You got huge number of subscribers bcz of your DSA course and we needed it and trusted you. This is unfair.
@@John12685 brother you are literally getting free stuff off the internet, get a grip
@@Sendobren sief free content k name se kuch ni hota. Banda apna time invest kar rha hai agr kuch dekhne ko.. To wo complete hi ni to kya faida.. Placement ni nikaal paao gay incomplete knowledge se. Dekh lo ghanto tak free content
@@John12685 bro he covered all the basics of dsa with java now you can study from others like striver or apna college etc .
I am just confusing with primitives and objects😢
This playlist is better than any paid course 💀
can someone tell what to dop after learning concepts to solve questions and from where to start solving easy level question because after watching video i personaly forgot things
kunal kushwaha == "one man army"
👌👌👌👌👌👌
Rahul Rana is also playing a major role bro
Okey! so I'm a Cybersecurity Student from Germany, I just got to know about this channel and man ohh man it's the best thing on TH-cam. Happy to learn from him. We do have DSA in our Cybersecurity curriculum because it is helpful for roles like Cybersecurity Engineer, Where we need to build efficient programs :)
Great to hear!
Hey I am also a cybersecurity student but learning for Secure code review
I am also 2022 graduate like kunal , I also know ds/algo very well. I have watched dsa course of almost all big ed-tech startups in India.I can assure anyone this is not one of the but the best course in the market. Waiting for other courses by him so that I can also learn him.Such a inspiration for me
Can I watch these videos if I know C++ but not JAVA
Yes@@sambhavmishra5423
I finally learned 2D arrays properly. That's because of you Kunal!! Thank you very much :)
My pleasure 😊
@@KunalKushwaha U said u will cover in 2 months the whole course. But now u have stopped even its 6 months. You r spending time on other courses which could have been made after completing DSA.
Y r u doing so?
Y r u making us feel dependent and helpless by leaving in the middle le??
You got huge number of subscribers bcz of your DSA course and we needed it and trusted you. This is unfair.
@@John12685 Because he just needed to get his subscriber count up to generate revenue from YT.
@@mayukhbanerjee1147 Yes he deceived us. I have u subscribed his channel for his breaking his commitment.
@@KunalKushwaha U deceived us
1:27:47 yeah its doubling the array size as you said .prefGrowth parameter is rightshifted by 1 bit which mathematically means multiply by 2, so size is doubled
how ? 2>>1 gives 1 as 2/ 2^1 lets take 10>>1 the size is halved, but left shift doubles the original
I think it adds half of the old capacity to it.
whenever kunal says : we'll look this in Object oriented programming
Me : 10 Sec. forward :)
Timestamps:
0:00 Introduction
1:22 Why we need Arrays?
2:58 What is an Array?
3:13 Syntax of an Array
4:26 Direct hit Program : Store 5 Roll Numbers
6:44 How does Array works?
8:42 Internal Working of an Array
10:32 Dynamic Memory Allocation
12:00 Internal Representation of Array
13:06 Continuity of an Array
16:25 Index of an Array
19:53 String Array
20:42 What is null in Java?
23:30 null is used as a default
27:55 Array Input
31:19 for-each loop
33:15 toString() Method
34:52 Array of Objects
36:25 Storage of Objects in Heap
40:21 Array Passing in Function
42:32 Multidimensional Arrays
43:36 Syntax of a 2D Array
45:20 Internal Working of a 2D Array
50:16 2D Array Input
1:01:06 2D Array Output
1:07:05 Dynamic Arrays
1:17:22 Array Functions
1:21:08 Internal Working of ArrayList
1:33:21 Questions
1:33:30 Q1 : Swaping Values in an Array
1:35:20 Q2 : Maximum Value of an Array
1:40:45 Q3 : Reversing an Array
1:44:20 Outro
Thank you
Should I learn object oriented programming before starting data structures and algorithms or should I go with the order of the playlist?
You can easily understand how it work if you learn OOPs
You just follow this playlist and ace the programming Essential to Pro✌, this playlist contains oops also. 💪, All the best!!
Haven't studied array in my life in such a way that I did today. This course is going to be loved by millions in the upcoming years. Adding a comment so that if someone finds it similar with their thoughts I'll be having notifications. Great job!
Kunal hope u will provide all the "quality" questions for each of the videos of dsa which would cover the concepts in whole so that we don't have to search out for things 🙌🙌
I will as mentioned in the video. After every topic there will come a video full of questions only.
@@KunalKushwaha please do it quickly i need it this year Im going for placements kunal. please upload
Great work man.
I love your tutorials and how easy is to understand them.
Happy to hear that!
It is getting more interesting as the course progresses ❣❣💖
You made 1hr45mins length video just to explain Arrays and Arraylist 🤩🤩
The Concepts are cleared so thorough.
Really, this is the best DSA Series❤️ one can't even think of making this that too for free.
Thank you so much 🙂
@@KunalKushwaha ❤️
Sir, i dont have any words to say, following your playlist from just 2 days and i am on this video, Man its so addictive, literally i was the guy who was spending whole time on Netflix just doing timepass. Getting this playlist is like getting treasures in Egypt. How can i thank you.
is this playlist completed bro?
@@supreetss8382 no
🎯 Key Takeaways for quick navigation:
00:46 🤔 Arrays are needed when there's a need to store a collection of data elements of the same type. They provide a way to efficiently store and manage multiple values of the same data type.
03:18 🧩 The syntax to create an array in Java involves specifying the data type followed by square brackets. Memory for the array is dynamically allocated at runtime using the `new` keyword.
05:13 🧱 Arrays in Java are collections of elements of the same data type, and all elements in the array must have the same data type.
09:37 📊 Java heap objects, including arrays, are not necessarily continuous blocks of memory, unlike in some other languages like C++. JVM manages memory dynamically at runtime for heap objects.
20:18 📑 When an array of non-primitive objects is created, each element of the array is initialized with the default value `null`.
25:53 🧠 Java arrays store reference variables, and each element in the array points to objects in the heap memory.
28:32 📝 You can use for loops to easily populate arrays with user input or print their elements.
31:23 🔄 Enhanced for-loop (for-each) provides a cleaner way to iterate through array elements directly without using indices.
37:20 💡 Java 2D arrays can be visualized as arrays of arrays, where each element points to another array in the heap memory.
48:26 🔄 The size of individual rows in a 2D array can vary, as each row is a separate object with its own memory allocation.
51:01 👉 Arrays in Java are initialized with a fixed size, making them less flexible for dynamic input.
53:07 👉 To take input for a 2D array, use nested for loops to iterate through each row and column.
54:25 👉 Use `Arrays.toString()` or enhanced for loops to print the 2D array in a more readable format.
59:14 👉 For varying column sizes, access the size of each row individually using `array[row].length`.
01:05:20 👉 ArrayList in Java provides a dynamic-size array-like structure, allowing adding elements without specifying a fixed size.
01:14:31 🔄 Constructor in Java is used to define initial values for an object. It is essential in object-oriented programming but not discussed in detail here.
01:15:00 📝 ArrayList in Java can dynamically add elements without specifying an initial size. It internally resizes and doubles its capacity as needed when elements are added beyond the initial capacity.
01:15:30 ➕ Elements can be added to an ArrayList using the `add` method. There is no need to specify an initial size, and multiple elements can be added sequentially.
01:17:39 ❓ ArrayList provides useful methods like `contains`, `set`, and `remove` to perform operations on its elements, making it easy to manipulate data.
01:25:08 🔄 ArrayList internally resizes its capacity to accommodate more elements. When the capacity is reached, it creates a new, larger ArrayList and copies the elements to it. The process of resizing maintains a constant amortized time complexity for adding elements.
01:40:15 🔀 To reverse an array in Java, use the "two pointer method." Swap elements at the start and end indices iteratively until the start index becomes greater than the end index.
01:40:48 🔄 The two pointer method works for arrays of both even and odd lengths.
01:43:05 ➕ The `swap` function can be used to swap elements in the array efficiently during the reversal process.
01:43:18 🎯 The two pointer method is a useful approach for solving specific coding challenges, such as those involving array rotation or palindromic arrays.
01:44:12 📅 Future videos will focus on solving coding questions related to arrays using techniques like sliding window and two-pointer methods.
Made with HARPA AI
wow thanks brother, I am also learning DSA. how much you have covered?
thank you so much! this is so great for making flashcards
I am amazed by the fact that , Kunal can make learning so easy and faster , i cannot recall when was the last time i had this efficiency in learning a language, also it is so fun , seeing him smile a little when he runs a snippet of code . I hereby declare , your are my fav person for DSA on youtube . Great work Kunal , Thanks.
want to know where is graph and tree in dsa java course
plz tell
You are amazing because you never create confusion when you teaching. You are a Great teacher 💯💯👍👍
just ask her out dude, what's the worst she could say?
her: 1:32:37
The array elements are contiguous in nature even in java. The object encompasses the array. JVM will allocate each element of array in contiguous nature only within the object that encompasses it. However, the object itself will be allocated any free area available in the heap so basically, if you create 2 objects in rapid succession, they may still be allocated at different addresses but the arrays in those objects will be contiguous in nature.
You are the best
One thing I like most is the usage of face-cam in your tutorials.
It makes me feel like having a live interaction and its very effective and addictive
Cheers Kunal❤️🙌
So its a Complete JAVA + DSA course....will a completion certificate would be provider after completion.....does certificates matter?
No certification means nothing, but having the knowledge is a must 😅
Kunal, I discovered your channel while I was trying to understand arrays and I have to say you might be one of the best programming tutorial channels out there. You explain everything thoroughly but you do not complicate things. You go in to depth and not only answer the how but the why. Thank you.
hm i was watching and got distrated by my cat looked at the cat and looked back at the screen and I see kunal staring into my soul and said kool, the timing on that lol
Seriously yaar no one like u ❤️ ur amazing .....before this session I didn't saw any single video on arrays like this . Thanku so much for ur support .
I can't find any questions video for array concept.
Man u r reading my mind,
I was thinking just now about array video
finished this video taking 3 days. my procrastination is high
this course is above every other one on internet i have seen so many courses and they don't feel the same they get boring after 2-3 videos but yours is just on another level you share every bit of information which too in such a great way
what about apna college course
So the formula is new capacity = 1.5*initial cap + 1, when the array list is 75 percent full.
I didn't knew that in java it's not continous memory like c c++ omg so detailed 🔥
00:06 Introduction to arrays and ArrayList in Java
02:21 An array is a collection of data types that can store primitives or complex data types.
06:53 Declaration and Initialization of Arrays in Java
09:15 Dynamic memory allocation in Java
13:48 Java specifies that heap objects are not continuous
16:02 Arrays in Java are dependent on JVM and use index to access elements
19:48 Introduction to String Arrays and Null in Java
21:47 null is a special value for reference variables
25:33 Objects in arrays are stored in separate areas in heap memory.
27:16 Arrays in Java are collections of reference variables with default value of null.
31:03 Introduction to for each loop in Java
33:16 Using Arrays class to print arrays in Java
37:00 Arrays store reference variables to objects in the heap
38:47 Array and ArrayList usage in Java
42:24 2D arrays in Java are like a matrix with rows and columns.
44:19 Arrays and ArrayList in Java store data differently from C++
48:13 Arrays in Java can have variable column sizes, and each array is a separate object.
50:12 Input in arrays: Accessing and assigning values
54:49 Iterating through a 2D array using for loops and accessing elements
56:38 Understanding the iteration process in the for loop.
1:00:23 Creating and iterating through arrays in Java.
1:02:30 Printing Arrays and ArrayList in Java
1:06:42 Understanding the significance of arr.length in printing arrays.
1:08:34 An ArrayList is used when the size of the array is unknown
1:12:00 Java provides the implementation of various data structures like ArrayList.
1:13:36 Generics in Java allow specifying the type of data that can be stored in a list object.
1:17:08 Introduction to Arrays and ArrayList in Java
1:19:18 Introduction to Arrays and ArrayList in Java, Iteration output, and maintaining the index
1:23:35 ArrayList doubles in size when full and copies elements
1:25:18 ArrayList doubles its capacity when full
1:30:06 Initializing and adding elements to ArrayList in Java
1:32:06 To avoid errors, ensure that lists are created before accessing them.
1:36:01 Finding the maximum item in an array using iteration
1:37:52 Finding the maximum value in a specified range of an array in Java.
1:41:51 Reversing the array using start and end pointers.
1:43:48 Introduction to two pointer method
Crafted by Merlin AI.
I Already know java intermediate level but watching the series for the first video because there a something interesting about this guy that makes me watch it.His tone of teaching his knowledge just Loved it....Thanks kunal
I have a small doubt. How does he check every details of internal working in IntelliJ? What's the shortcut key? Or process? @Kunal
Someone please reply.
ctrl + click for windows
I have finished 1hr 45 mins video in one go 😱, kunal your videos are so much addictive. To your content, to your determination, to your hardwork take a bow 🙌
But you can't solve a single program on array after watching complete video only know about basic under standing about array.
@@mesmerizeart663Haha, i have already solved many array questions on leetcode.
@@mesmerizeart663😂😂😂 no bro I solve many questions regarding 2d arrays and multi dimensionol arrays I start with basic of Kunal series firsti watch complete Oop course of 7 vedio then I start DSA from 1 to 8 vedio now concept are cleared now he is a great teacher
bruh i can't solve the assignment questions....what do i do ?@@mesmerizeart663
Please explain StreamApi in java 8...
I wanted to learn 2D arrays in java and searched for it on TH-cam and other sources i didn't understand a thing, may be because it was imprinted on my mind that it's complicated but Kunal you made it soooo easy , internal working and all oh my god such a wonderful gift you are for us ❤️
okay, then how do you input a 2D array with variable column size ? he forgot to teach that lol
@@Abhi-ng3re exactly
@@Abhi-ng3re if you're not worried abt time complexity you can use array list of array list right??
he has good hair ;
Why are you gay??
people are making vdeos on how to slove that question and I think that will be pretty easy if u understand the solution from anywhere u can teach or make videos but the most important thing which I feel on watching kunal videos is that he is teaching from the basics like how memory allocates and how actually things work on the system .. and bhai thanks again itna deep me mene kabhi nahi socha tha ki cheeje hogi..
On 21:51 you said that we cant assign null to any primitives, but I tried and if we pass something like
int a = Integer.parseInt(null);
This doesn't show any error whatsoever. What could be the reason behind this.
Can anyone comment on this?
however I get error "cannot pass null value" problem.
Seriously man you amaze me with your teaching skills in every video! I never understood arrays in such a detailed manner. Thanks a lot for this course.
Great video man! Thanks a lot for all the hardwork you are putting in making these videos
Glad you like them!
Golden ratio: 1.683
If anyone is wondering why it is O(1) in insertion, the logic (as best as I can understand), is this -
Basically every time you double it, the capacity increases to twice, so you need not double it for quite some time.
Suppose your original ArrayList had cap:10
And you have to fill 1000 values
After 5 values, new_cap = 20
After 10 values, new_cap = 40
After 20 values, new_cap = 80
After 40 values, new_cap = 160
After 80 values, new_cap = 320
After 160 values, new_cap = 640
After 320 values, new_cap = 1280
As this increases, you realize that to reach that half capacity when you need to double the size, that value also increases. To increase capacity to 2560, you need to add 320 more values. To increase capacity further to 5120, you need to add 640 more values
So for larger values, this basically becomes O(1) wherein it is assumed that the ArrayList size is already so big, you're just appending values
if I initialize array list at 10 and add 350 values in it. Then, new size of array list is going to be 1280 but I do not add more values to it. so the Q is, will my array list will remain of size 1280 and rest of the space(1280-350) will be allocated in memory even though I am not using it?
@@jeeveshkumar9682 So you are right my friend, the rest of the space will be allocated in memory wether its been used or not, but there is an option called 'trimToSize()' you can use it for trimming the arraylist upto its lenght like in your case 350
I wish I knew earlier about this master piece playlist, I could crack good companies!! 😑
You're are the real gem for students ❤...
Kunal, like how we have activation records for function calls in stack in C, does the same thing happen in Java as well?
We can use Arrays.sort(arr); class to first sort, and then return last value of that array.
public class Main {
public static void main(String[] args) {
int[] arr = {2, 1, 3, 4, 5, 6, 10, 34, 3, 4, 5, 44};
max(arr);
}
private static void max(int[] arr) {
Arrays.sort(arr);
System.out.println(arr[arr.length - 1]);
}
}
Personal timestamp:
Day 1) 20:00
Day 2) 44:00
Day 3) 1:00:00
Day 4) 1:45:52
Is this the best course of dsa help me audience say yes and no
Really enjoyed this lecture🥰🥰🥰
Looking forward for the next video😍😍
bro i am not able to solve array assignment leetcode problem after watching array video also i have to see solution without solution i can't understand. Is it ok or what should i do???
I'll make video on it soon
@@KunalKushwaha thanks bro
If you are searching to the best videos of Java + DSA. Just go through this , you gonna learn very clearly rather than the paid courses🙌
Thanks Kunal lots of love from Nepal❤.
Brother when you say very simple stuff i generally like to beat you badly ,here we are working hard to understand this and you say very simple stuff.
You are doing really good job!!!!! Can you please release the videos sooner because my placement season is going on and i want to complete the course as soon as possible.
if its possible and you don't face issues regarding the quality of videos.
Null is the default value of String
Hi my dear brother Kunal. I am elder by 2 years than you but you are the greatest guru I have ever seen in my life. Learning from your videos just gives me true bliss and I can just keep learning from your videos all day long. If I keep aside your fantabulous teaching skills and insightful knowledge, the intention that you carry about providing such a precious knowledge for free just make me feel that you are born for the people like me who are very curious to learn things in details.
Truly appreciate you from the core of my heart and I pray God to bless you immensely on this journey and make all the wishes true by making all our wishes true in disguise. I will be rooting for you on this journey.
My dear talented brother!
🎯 Key Takeaways for quick navigation:
00:04 Arrays *in Java are collections of data types, either primitives or objects, stored in contiguous memory.*
01:19 The *need for arrays arises when dealing with multiple data elements, avoiding repetitive variable declarations.*
03:18 Array *syntax involves specifying data type and size, and the new keyword is used for dynamic memory allocation.*
05:13 Arrays *enforce a single data type, and their elements are accessed using indices starting from zero.*
10:55 Java's *heap memory, where arrays reside, may not guarantee continuous allocation due to JVM decisions.*
15:31 Dynamic *memory allocation occurs at runtime, and heap objects are not guaranteed to be continuous.*
18:16 The *'new' keyword is used to create an array object in Java, either with a specified size or direct initialization.*
19:42 Arrays, *when not explicitly initialized, contain default values (e.g., 0 for integers, null for objects) for their elements.*
23:30 In *Java, arrays of objects are stored in heap memory, while primitives are stored in stack memory.*
24:36 Unlike *Python, where everything is an object, Java distinguishes between primitives (stored in stack) and other objects (stored in heap).*
25:06 Object *arrays in Java consist of reference variables pointing to objects stored in different parts of heap memory.*
26:35 Distinction *between primitives (int, char, boolean) and non-primitives (complex data types) in Java, and their memory allocation.*
27:19 Arrays *are collections of reference variables, and uninitialized references default to null in Java.*
28:46 Demonstrating *array initialization and input using for loops in Java.*
31:23 Introducing *enhanced for loop for array traversal in Java.*
32:10 Highlighting *potential errors like index out of bound and introducing the Arrays class for printing arrays in Java.*
33:16 Utilizing *Arrays class to convert and print arrays as strings, a preferred method.*
37:35 Introduction *to 2D arrays in Java, represented as a matrix, with the necessity of specifying the number of rows.*
40:21 Demonstrating *the mutable behavior of arrays in Java functions (pass by value with object reference).*
43:25 Syntax *for defining and initializing 2D arrays in Java, with an example.*
46:32 Arrays *in Java are stored in the heap memory. The main array contains references to internal arrays.*
Internally, each *index of the main array is an array itself, stored in different memory locations.*
The column *size is not fixed, as each row can have a different number of columns.*
Input for *a 2D array involves nested for loops, where the outer loop iterates over rows, and the inner loop iterates over columns to fill the elements.*
The output *can be printed using nested loops, and `Arrays.toString` can be used to print each internal array.*
`Arrays.toString` and *enhanced for loop can simplify printing the 2D array.*
Introduction to *the concept of ArrayList is mentioned, emphasizing its flexibility compared to fixed-size arrays.*
ArrayList is *useful when the size of the collection is unknown or dynamic.*
Future topics *mentioned include searching, sorting, and solving interview questions, which will be covered in separate videos.*
01:09:34 ArrayList *in Java is similar to vectors in C++. It's part of the Java Collection Framework in the java.util package.*
01:10:33 Syntax *for ArrayList: `ArrayList
new capacity = 3/2*current capacity
Hey Kunal, I've started with this playlist in December and I'm still on this video and related assignments since last two weeks. I find it really hard to solve leetcode easy problems related to this video. I really wanna start with bubble sort but I've got assignments to complete. Could you advise on how I shall move forward with this?
I would really appreciate your reply on this. Thanks for this amazing playlist.
heyy!! i'm stuck in the situation rn. Can u say what should i do? please do reply
@@BhavanaReddy15 hey bro.. same here.. easy solution is that if u r not able to solved it.. just see the solution and uderstand how the logic is working.. dont demotivate all faces the same problem in thier begenning phase
@@xyzadmin123 yep I'm doing it. Thanks😄
Great video Kunal! Thanks a lot for all the hardwork you are putting in making these videos
Bhaiya, MAX VALUE OF AN EQUATION leetcode problem ka explanation video bna do ...TH-cam has no proper explanantion
Hi, Kunal, thank you for taking the time to take such elaborate sessions and explaining it such simple ways. I like the format (what, why, how to use - a concept) of your sessions.
When you get a chance, could you please do a video/session on JSON, JSONObject, JSONArray, how to read/modify/loop through/parse, complex JSON like JSONArray inside another JSONArray etc?
Thanks again. Looking forward to the next session.
Hi Kunal.. i am not sure if i have missed it but as u mentioned that heap memory MAY NOT BE continuous then how the elements would be accessed from array using index ?
Hey kunal ! just a little request if you can explain the difference in some similar concepts of java and python then it will be great.BTW you are providing great content..!Thanks.
I will in Python bootcamp
@@KunalKushwaha 👍 great..
Hi Kunal,
Great Job!
I found you mentioning for an expression int[] arr = new int[5];
The declaration < int[] arr > executed at compile time and the memory allocation happen while execution(run) time.
Compile time we only check for compliance of types but actual variables(in stack) and memory allocation(in heap) both happened at runtime. I thought of by mistake mis spelled here.
But thanks a lot for the best content.
I dont think there is any other course on youtube which matches the quality and dedication displayed by kunal in this video, Thanks so much for your effort, a lifesaver, cant wait for trees and graphs uploads.
Please make videos on java Hashmap, HashSet. Basically Hashing.
Just a note: ArrayList Syntax changes with every java version, So when you try to use the same syntax in java17. It gives error that ArrayList will not take parameters
yes this didnt work on my end, can you tell me how else can i use Arraylist and its methods in my program..
use Intellij and select the proper jdk version. Then the IDE will autocomplete the syntax
@@vedanthbaliga7686 using intellij only, i guess i only gotta update it now!
:)
11:08 among us
Kunal it would be really great if you create a
new class for all the questions and concepts..It gets confusing sometimes if you do everything in the same class.
Yes
Amazing lectures
I don't know how do you keep up with this amazing consistency, kudos to you providing such high quality content for free!🔥
Day 2: completed
kunal was like very simple stuff and i was like 🤯
At 1:00:28, I get the logic of the inner for loop. But if we are providing variable number of elements in each row and if we don't mention the column length in advance during declaration (like this - new int[3][];), how will the system know the length of each row when we write col < arr[row].length?
Ok I figured it out. Each element is an array. So array have an inherent 'length' property.
Are dynamic and jagged arrays the same?
Thank you kunal bro
Hi, in 1:39:41 why if(end>start) I didn't get , plz help
1:14:10 Hey @Kunal we haven't talked about wrapper class previously!! Please explain wrapper classes also..!
We have, in datatype lectures. And it will be covered in detail in OOP.
This course is amazing and loving it. But in this video you talk about how to give output of those 2d array whose column are not fixed but didn't cover how to take input. well it's confusing me a lot so please
help me on that part.