How To Get Size Of Linked List | Size() | FREE DSA Course in JAVA | Lecture 101
Вставка
- Опубліковано 3 жов 2024
- Let's understand how to get size of a Linked list?
Unlike arrays, you don't know the size of a linked list by default and there's no function for the same as such.
To find the size of linked list, we have to create a separate size() function which can return the size of a linked list.
How to do it?
The algorithm is simple. You have to traverse by each node and upgrade the counter by one until you reach the end node.
All you need to do is create a count variable and a curr variable to track the current node.
Let's see how we can write a program in Java for the getting the size of a linked list.
Subscribe @TAPACADEMY
For more information, fill this form: forms.gle/8eiU...
or call us at 8884881203
Facebook: / thetapacademy
Instagram: / tapacademy_online
Linkedin: / 73820805
Website: www.thetapacad...
sir please upload more videos related to dsa
We can use fast pointer to find length of linked list in more efficient way!
When will you upload full stack development course
We are about to complete the DSA course. You can check our full stack development course on our website.