Insert a node in a Singly Linked List at a given position (Implementation)

  Рет қаралды 32,663

Dinesh Varyani

Dinesh Varyani

3 жыл бұрын

►Full DSA Course - • Data Structures and Al...
►Follow me on Instagram - bit.ly/intrvwkckstrt
►Follow me on LinkedIn - bit.ly/fllwlkdn
►Enroll in the complete course: bit.ly/3W4qthg
►Source Code - github.com/dinesh-varyani/ds-...
►Download DSA Animation Slides - techready.in/courses/150-dsa-...
►Click here to subscribe - kzfaq.info...
Watch all my playlist here:
►Data Structures and Algorithms Course playlist: • Data Structures and Al...
►Mastering JUnit 5 - kzfaq.info?list...
►Mastering Mockito 3 - • Mockito 3 Tutorials
►Analysis of Algorithms - • Analysis of Algorithms
►Linked List Data Structures - • Linked List Data Struc...
►Array Data Structures - • Playlist
►Stack Data Structure - • Stack Data Structure
►Queue Data Structure - • Queue Data Structure
►Binary Tree Data Structure - • Binary Tree Data Struc...
►Graph Data Structure - • Graph Data Structure
►Binary Heap Data Structure - • Binary Heap Data Struc...
►Trie Data Structure - • Trie Data Structure
►Dynamic Programming Algorithms - • Dynamic Programming Al...
►Hashing Data Structures - • Hashing Data Structures
►Sorting and Searching - • Sorting and Searching
►String Algorithms - • String Algorithms
Want to land a software engineering job in the IT industry? This course - 'Visualizing Data Structures and Algorithms' is here to help. The course walks you through multiple Java algorithms, data structures problems, and their solutions with step by step visualizations, so that you are actually learning instead of blindly memorizing solutions.
The course covers in and outs of Data Structures and Algorithms in Java. Java is used as the programming language in the course. Students familiar with Javascript, Python, C#, C++, C, etc will also get to learn concepts without any difficulty. The implementation of various Algorithms and Data Structures have been demonstrated and implemented through animated slides. It covers many interview room questions on Algorithms and Data Structures. The questions and solutions are demonstrated by -
1. Animated slide. (To make visualization of algorithms faster)
2. Coding algorithm on IDE.
The course covers topics such as -
0. Algorithm Analysis
1. Arrays
2. Matrix
3. Singly Linked List
4. Doubly Linked List
5. Circular Singly Linked List
6. Stacks
7. Queues
8. Binary Tree
9. Binary Search Tree
10. Graphs
11. Priority Queues and Heaps
12. Recursion
13. Searching
14. Sorting
15. Strings
16. Trie Data Structure
17. Dynamic Programming
and many more ...
#dsa #algorithms #coding

Пікірлер: 55
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Please *Subscribe* and *Click Bell* 🔔🔔🔔 Icon for More Updates. To get *Data Structures and Algorithms* complete course for free please follow this link - kzfaq.info/sun/PL6Zs6LgrJj3tDXv8a_elC6eT_4R5gfX4d
@shubhamagarwal1434
@shubhamagarwal1434 2 жыл бұрын
Best series for DS & Algo. I am also 10 yrs java exp guy. Was looking for DS & Algo free course over KZfaq with java implementation and found this. Hats Off To You Man...Excellent Work. GOD BLESS YOU :)
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
Thanks !!!
@ascar66
@ascar66 2 жыл бұрын
Are you preparing for an interview?
@FashionTales1
@FashionTales1 Жыл бұрын
I see many people learning DSA with C/C++, but I decided to learn it in JAVA for full stack development related opportunities. But the resources are very few for DSA in JAVA😶 Luckily I found this🤞. Thank you so much sir for giving some hope for many people like me...! Lastly, Thanks for spreading this Knowledge instead of selling it🤩👏👏👏. I will definitely share this with many👍 - Samanvitha : )
@itsdineshvaryani
@itsdineshvaryani Жыл бұрын
Thanks for the support !!! Glad you liked it !!!
@kashifsiddiqui4042
@kashifsiddiqui4042 2 жыл бұрын
Very well explained! Thank you so much for making DSA this much easy!!
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
Welcome !!!
@dineshr4732
@dineshr4732 2 жыл бұрын
Thanks a lot Dinesh Varyani. This has helped me a lot.
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
Glad it helped
@dhruvipaliwal8961
@dhruvipaliwal8961 Жыл бұрын
You made dsa easy to understand
@itsdineshvaryani
@itsdineshvaryani Жыл бұрын
Thanks
@nirmesh44
@nirmesh44 3 жыл бұрын
i am watching all your videos. very nicely explained👌
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Thanks !!! Please share it with ur friends and colleagues. This will help channel grow and motivate me to add more and more videos.
@raz0229
@raz0229 3 жыл бұрын
Never knew light IDE themes could be so catchy :D
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Yes it is !!!
@raz0229
@raz0229 3 жыл бұрын
@@itsdineshvaryani You sir, are a legend for still being able to reply to all the comments on your channel. Much love
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
@@raz0229 No problem ... Its a part of youtube journey !!!
@unnaipoloruvan98
@unnaipoloruvan98 3 жыл бұрын
Dinesh Kindly say how could i change the theme of eclipse like the one in this video
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Thats not eclipse .... Its intellij idea ...
@MelodyWorldddzz
@MelodyWorldddzz 2 жыл бұрын
You are amazing sir ❤️
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
Thanks !!!!
@manojmani5452
@manojmani5452 2 жыл бұрын
Nice explanation sir
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
Thanks !!!
@sanjushekhawat6446
@sanjushekhawat6446 3 жыл бұрын
Thanks sir
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Welcome !!!
@afaqkhan2243
@afaqkhan2243 3 жыл бұрын
Very nice sir
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Thanks !!!
@achiever27
@achiever27 3 жыл бұрын
Amazing DSA playlist
@poojithakumaran8946
@poojithakumaran8946 2 жыл бұрын
@Dinesh Varyani why cant u discuss the time and space complexity for each operations insert,delete etc...
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
will add those soon
@hobojoesnr.3283
@hobojoesnr.3283 3 жыл бұрын
at 5:47 , couldnt you use a for loop instead of a while loop at line 57? for(int count = 1; count < position - 1; count++){}
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Yes you can !!!
@hobojoesnr.3283
@hobojoesnr.3283 3 жыл бұрын
@@itsdineshvaryani i've been binge watching all your videos lately, and theyve been such a massive help. Thanks so much!
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Thanks !!!
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
Thanks !!!
@sambeetrath7328
@sambeetrath7328 3 жыл бұрын
What if the given position is invalid? Should we write an if statement at the beginning of insert ()?
@itsdineshvaryani
@itsdineshvaryani 3 жыл бұрын
You can provide that edge case ... But its assumed position is valid !!!
@karentechnologies3990
@karentechnologies3990 2 жыл бұрын
You can make the following changes in your code if you want to check if a given position is valid or not private void insertAtPosition(int value, int position, SinglyLinkedList singlyLinkedList){ ListNode node = new ListNode(value); if (position == 0 || position > singlyLinkedList.length()+1){ System.out.println("Error, Invalid Position"); return; } }
@mr.kdrama2.o53
@mr.kdrama2.o53 Жыл бұрын
sir notes or ppt dona interiview keliye read karna hai apke easy hai notes plz
@abhishekpatel6020
@abhishekpatel6020 8 ай бұрын
What will happen if we add at certain position like 5 when list is empty
@golcuk2076
@golcuk2076 Ай бұрын
nullpointer exception. Because target 'next' will be empty at one position.
@pushkarkumaryadav2570
@pushkarkumaryadav2570 2 жыл бұрын
Sir Thank you very much for this but why there is so less likes ?
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
you share it with ur friends and colleagues on linkedin and facebook as post and you will see magic !!!
@chinomsojohnson8746
@chinomsojohnson8746 2 жыл бұрын
I just started learning DSA and I am curious on why your count starts from one and not zero. Any particular reason why?
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
you can start from 0 ... it doesnt matter ... just make calculations based on 0
@chinomsojohnson8746
@chinomsojohnson8746 2 жыл бұрын
@@itsdineshvaryani thanks for responding
@neelchatterjee.1368
@neelchatterjee.1368 2 жыл бұрын
@@chinomsojohnson8746 then while runs till (position-2)
@nishantpatill
@nishantpatill 2 жыл бұрын
public void insert(int position,int data){ ListNode newNode=new ListNode(data); if(position==1){ newNode.next=head; head=newNode; } else{ ListNode previous=head; int count = 1; while(count < position-1);{ previous=previous.next; count++; } ListNode current=previous.next; previous.next=newNode; newNode.next=current; } } Exception in thread "main" java.lang.NullPointerException: Cannot read field "next" because "previous" is null at SinglyLinkedList.insert(SinglyLinkedList.java:40)
@karentechnologies3990
@karentechnologies3990 2 жыл бұрын
You can make the following changes in your code if you want to check if a given position is valid or not private void insertAtPosition(int value, int position, SinglyLinkedList singlyLinkedList){ ListNode node = new ListNode(value); if (position == 0 || position > singlyLinkedList.length()+1){ System.out.println("Error, Invalid Position"); return; } }
@karentechnologies3990
@karentechnologies3990 2 жыл бұрын
You can make the following changes in your code if you want to check if a given position is valid or not private void insertAtPosition(int value, int position, SinglyLinkedList singlyLinkedList){ ListNode node = new ListNode(value); if (position == 0 || position > singlyLinkedList.length()+1){ System.out.println("Error, Invalid Position"); return; } }
@itsdineshvaryani
@itsdineshvaryani 2 жыл бұрын
Thanks !!!
Single Linked List (Inserting a Node at a Certain Position)
6:52
Neso Academy
Рет қаралды 291 М.
Stay on your way 🛤️✨
00:34
A4
Рет қаралды 26 МЛН
Как бесплатно замутить iphone 15 pro max
00:59
ЖЕЛЕЗНЫЙ КОРОЛЬ
Рет қаралды 8 МЛН
Insert a node in a Singly Linked List at a given position (Animation)
15:33
Singly Linked List | Insert, Delete, Complexity Analysis
14:39
Blue Tree Code
Рет қаралды 58 М.
[3.2] Insert Node at specific position in Linked List
7:52
ThinkX Academy
Рет қаралды 4,1 М.
How to find start of a loop in a Singly Linked List? (Animation)
12:45
LinkedList vs ArrayList in Java Tutorial - Which Should You Use?
11:43
Coding with John
Рет қаралды 582 М.
Prefer Arrays Over Lists. Seriously...
8:31
Amigoscode
Рет қаралды 40 М.
Quem vai assustar mais meninos ou meninas?!😱 #shorts #challenge
0:10
Gabrielmiranda_ofc
Рет қаралды 118 МЛН
哈哈看到的也不一定是真的!#火影忍者 #佐助 #家庭
0:20
火影忍者一家
Рет қаралды 16 МЛН