#6 Linked List Implementation in Java Part 2 | Data Structures

Ғылым және технология

Complete playlist of Data Structure Using Java : goo.gl/3eQAYB
Code : goo.gl/mP1JAC
Linked List implementaion in Java without using Collection
We will use Eclipse IDE here
In this video we will see :
- Operations of Linked list
- insert at start
- insert at Index
- An example explaining above operation
Linked list is a linear collection of data elements, in which linear order is not given by their physical placement in memory.
Instead, each element points to the next.
It is a data structure consisting of a group of nodes which together represent a sequence.
Under the simplest form, each node is composed of data and a reference (in other words, a link) to the next node in the sequence.
This structure allows for efficient insertion or removal of elements from any position in the sequence during iteration.
Editing Monitors :
amzn.to/2RfKWgL
amzn.to/2Q665JW
amzn.to/2OUP21a.
Check out our website: www.telusko.com
Follow Telusko on Twitter: / navinreddy20
Follow on Facebook:
Telusko : / teluskolearn. .
Navin Reddy : / navintelusko
Follow Navin Reddy on Instagram: / navinreddy20
Subscribe to our other channel:
Navin Reddy : kzread.info/dron/xmk.html...
Telusko Hindi :
kzread.info/dron/itz.html...
Donation:
PayPal Id : navinreddy20
Patreon : navinreddy20
www.telusko.com/contactus

Пікірлер: 185

  • @maya.n
    @maya.n5 жыл бұрын

    You should add return; in the if(index==0) because it is going to continue doing everything after that code and it is going to put the element twice. The code should be like this: if(index==0) { insertAtStart(data); return; } Other than that, great video. It helped me a lot. Thanks.

  • @aleksandarmilosavljevic1996

    @aleksandarmilosavljevic1996

    5 жыл бұрын

    Your comment was very helpfull to me, thanks! :)

  • @maya.n

    @maya.n

    5 жыл бұрын

    @@aleksandarmilosavljevic1996 You're welcome. I am glad I could help, but I think in the next video he fixes it and makes it correct.

  • @dawah7556

    @dawah7556

    5 жыл бұрын

    thanks for help

  • @jefflee738

    @jefflee738

    5 жыл бұрын

    you garbage

  • @jefflee738

    @jefflee738

    5 жыл бұрын

    just joking

  • @LynN-he7he
    @LynN-he7he5 жыл бұрын

    When you move your cursor to paint, can you highlight the cursor? It's hard to follow where you are pointing to.

  • @ajithm2334

    @ajithm2334

    4 жыл бұрын

    Same point..

  • @rohitroyYT001

    @rohitroyYT001

    2 жыл бұрын

    Same point.

  • @LazizbekYusupov92

    @LazizbekYusupov92

    2 жыл бұрын

    Yeah, the same problem.

  • @vedapriya888

    @vedapriya888

    7 ай бұрын

    Actually pointer can be seen if we see very carefully.I think it's better to change the background to cream colour so that the pointer would be highlighted more

  • @anuragbhattacharjee2708
    @anuragbhattacharjee27085 жыл бұрын

    put else after the "if" block for the rest of the code of insertAt method or else the added element will get added twice in the list..

  • @Misdaque
    @Misdaque2 жыл бұрын

    Great Video! No doubt Just one improvement we can do in this. In insertAt() method try to put the if condition at the beginning of the line and after calling insertAtStart() method put a return statement. if(index == 0){ insertAtStart(data); return; } Edit: I saw in the next video you have made the correction and accepted your mistake. This makes you even greater!

  • @veritaz753

    @veritaz753

    2 жыл бұрын

    thanks2

  • @void_godzpower7473
    @void_godzpower74735 жыл бұрын

    Best explanation of the topic so far, congrats, keep up the great work

  • @yatinpandey6499
    @yatinpandey64993 жыл бұрын

    It seriously was very confusing when you were stating the n.next part. Spent my 3 straight hours and still didn't got anything after node.next=n.next😶 Although,Thanks for your efforts sir. Love and Respect 🙏🏻💕

  • @learnandearnakashrdpatel6826
    @learnandearnakashrdpatel68265 жыл бұрын

    Very nice explanation sir I feel very good while seeing this video because how well explained you it make me very clear and because of I watched your video able to make program of linked list feel very proud I pray to continue making this type of video which will help students like me to get knowledge and make them self and knowledgeable person thank you

  • @subhamagarwal476
    @subhamagarwal4763 жыл бұрын

    No one can explain better than you.!!Thank you sir ..finally i understood the concept of LL

  • @FaizanKhan-gfaizank
    @FaizanKhan-gfaizank Жыл бұрын

    The best video explanation for linkedlist in java so far...

  • @milaismyname
    @milaismyname6 жыл бұрын

    Perfect explanation, thank you so much!

  • @AnkitKumar-xp9iv
    @AnkitKumar-xp9iv5 жыл бұрын

    Your explanation is great sir with the diagram which helped a lot in understanding the concept

  • @pradeepweerasinghe4201
    @pradeepweerasinghe42012 жыл бұрын

    At first it was like rocket science to me😅,After watching these videos several times finally got it,Thank you sir.

  • @aaronquitoriano1606
    @aaronquitoriano16064 жыл бұрын

    Can't see the cursor when you are pointing in paint. :(

  • @brucema4730
    @brucema47303 жыл бұрын

    Your channel has some really great content, but the way you speak is like playing the whole video in 1.5 of the original speed...still many thanks for the detailed explanation and demonstration of how it works in Java!

  • @nebilgokdemir4527
    @nebilgokdemir45274 жыл бұрын

    this is the best explanation of Link List thank you for sharing

  • @rissandimo
    @rissandimo5 жыл бұрын

    Excellent video, it was very informative! Just to note (for others), in the insertAt(int data ) method, once we check if the index == 0 and if so we pre-append the data. At that point we have to type return; Because if not, the execution will still continue and add the value again in the for loop.

  • @health.upgradedbyscience.7309

    @health.upgradedbyscience.7309

    Жыл бұрын

    see also part 3.. 😄

  • @shekhrussel6304
    @shekhrussel63045 жыл бұрын

    Ur videos r so much helpful for bttr understanding😍👍

  • @mewnine7278
    @mewnine72785 жыл бұрын

    You Explain Better Than My Professor Thanks

  • @aishuabcd3834
    @aishuabcd38343 жыл бұрын

    Easiest but Efficient explanation...Thanks a lot

  • @swayamprakashsahoo9002
    @swayamprakashsahoo90023 жыл бұрын

    Thank u sir for kind effort to teach us... I am really happy having understood this part

  • @chetanjha6019
    @chetanjha60193 жыл бұрын

    Sir u are god in teaching

  • @navjhs
    @navjhs6 жыл бұрын

    Great Video... just one thing--- diagram should be crystal clear while explaining or actually change the pointer of drawing pen in your MS paint as that is hardly visible.

  • @amanmunnolli

    @amanmunnolli

    2 жыл бұрын

    Yeah, struggled a lot to keep up with the pointer 😅

  • @sooriyakumarkarnan7885
    @sooriyakumarkarnan78856 жыл бұрын

    thank you very much sir i like very much your teaching method and your video is very helpful to my programming studies

  • @rajasekar4853
    @rajasekar48536 жыл бұрын

    It's helps for me a lot thanks sir I am waiting for sequences of this series

  • @HafizurRahman-dr3xe
    @HafizurRahman-dr3xe9 ай бұрын

    Your Effort is Absolutely so helpful. Thaks A Lot

  • @akshaycoder7919
    @akshaycoder79193 жыл бұрын

    Thank you sir for explaining in Such a simple words

  • @manavgupta272
    @manavgupta2723 жыл бұрын

    Sir you are the best teacher of java.

  • @HafizurRahman-dr3xe
    @HafizurRahman-dr3xe9 ай бұрын

    We should go always in depth. Thanks a lot

  • @bhaskarwhitebox
    @bhaskarwhitebox5 жыл бұрын

    special thanks to your diagrammatically representations.

  • @zainabissa162
    @zainabissa162 Жыл бұрын

    Great explanation Thank you.

  • @demdimi9316
    @demdimi93164 жыл бұрын

    Great explanations man.

  • @muhammadwaqar5612
    @muhammadwaqar56124 жыл бұрын

    Although you've taught very well thanks a lot, but there's a bug in addAt() method, what if someone input index which isn't in the list? there'll be nullPointerException. here I've applied my own logic, please check if it's okay? (working fine in IDE) void addAt(int i, int value) { Node node = new Node(); node.data = value; if(head == null) { head = node; System.out.println("List is empty, node added at index 0"); } else { Node n = new Node(); n = head; while(n.next != null) { if (index == i-1) { node.next = n.next; n.next = node; break; } else if(i == 0) { addFirst(value); break; } n = n.next; index++; } if(n.next == null) { System.out.println("Given index is out of list"); } }

  • @travelnlearn
    @travelnlearn2 жыл бұрын

    Thanks for this wonderful video. May gbu with lots of success love and life. Keep Rocking

  • @kchemutai3483
    @kchemutai3483 Жыл бұрын

    Thanks so much, best tutorial so far on this topic. One bug on InsertAtIndex, if the user specifies an index out of range like index 12. I have captured it buy inserting the element at the end of the list

  • @joschaweiss312
    @joschaweiss3125 жыл бұрын

    Very nice video, it was very helpful! Don't forget the three lines after the method after the else ;)

  • @isharaperera419
    @isharaperera4194 жыл бұрын

    Really helpful Reddy!

  • @jasrulzam
    @jasrulzam Жыл бұрын

    Hi, When you do insert a value at index, n already points to head before for loop, so in the first iteration n would have traversed to index 1 right? I did not understand this....pls helpout

  • @soumyadebbasu7882
    @soumyadebbasu78823 жыл бұрын

    We can also create a parameterized constructor inside Node class to define the data and link part, so we need to write only one line of code, while creating the object, in each of the methods of linked list class.

  • @venkat4043
    @venkat40433 жыл бұрын

    at 8:34 , we need to implement the rest of the code in the else block, otherwise, the data will be added at index 0 and as well as index 1

  • @ehabwa1167
    @ehabwa11674 жыл бұрын

    YOU'RE FANTAAAAAAASTIC!!! Big thnx

  • @suchitragiri4546
    @suchitragiri45463 жыл бұрын

    Your videos are awesome!

  • @ElevateWithMiranda
    @ElevateWithMiranda4 жыл бұрын

    thanks so much, far better than my proff

  • @coderbuddy3875
    @coderbuddy38754 жыл бұрын

    Great explanation at KZread !!

  • @bhanuprakashkatika
    @bhanuprakashkatika Жыл бұрын

    thank you very much sir for detailed explanation

  • @salomonmetre2117
    @salomonmetre21173 жыл бұрын

    Great video again !!!!

  • @sachinkumarsingh538
    @sachinkumarsingh5385 жыл бұрын

    hi sir thanks for such nice video but i would like to add a point what if someone is trying to add at a particular index and the head value is null or if the passed index is greater than available data in the list

  • @maheshanvekar
    @maheshanvekar5 жыл бұрын

    Thank You for the explanation but can we have some real time scenarios for the linkedlist usage

  • @chinmaysoni4416
    @chinmaysoni44164 жыл бұрын

    great explanation sir

  • @kanhaiyasharma5834
    @kanhaiyasharma58344 жыл бұрын

    very nice explanation but in inserAt(int index,int data) method we have to add for loop & Node n = head; into else statement otherwise data will be added two times.

  • @sudhakarreddy5781
    @sudhakarreddy57813 жыл бұрын

    Hello Navin, can you make a video by implementing this methods in recursive way. for example prependElement(int value)-- recursively.

  • @khyatimamaniya7155
    @khyatimamaniya71556 жыл бұрын

    Hey!! I have one doubt,how do you access index of any node as you already said linkedlist doesn't always be in sequence so how this index is in sequence and how do u know the index of any node , as far as i know if we want to insert at any position we provide info of data i.e after 18 insert should be done or after any other node that means we are providing data, i don't understand in linked list how this index can come than what is the diff between this and array if we'll provide index?????

  • @shefalijain11
    @shefalijain113 жыл бұрын

    Understood, thank you!

  • @itsyoursvijisoundarya8827
    @itsyoursvijisoundarya88275 жыл бұрын

    Awesome work yaarrr

  • @crazylife7902
    @crazylife79024 жыл бұрын

    Can you use a custom cursor. Its provided by the windows itself. That's the only addition this video now needs. Its really difficult to follow this video without that cursor when it travels of to the right side of the window. If you update this video with the new cursor, please share the link to the new video herewith. Thank you!

  • @chandravideo
    @chandravideo6 жыл бұрын

    sir if we write IF condition for an insertAt function in the beginning, then excess node created in insertAt function won't be happening.

  • @mindgym4543
    @mindgym45434 жыл бұрын

    Great video, but we need to handle outofindex error Use below code in indexAt method for (int i = 0; i mTempNode = mTempNode.mNext; if(mTempNode== null){ System.out.println("Please insert valid index!! Unable to insert"); return; } }

  • @manojkumarvavilapalli3192
    @manojkumarvavilapalli31923 жыл бұрын

    ni8 entha track chesina okka point ekkado miss ipothuna.... Mee video okka 5min chusa, path clear ipoiendi.... Thank you bro

  • @shashankdahake8985
    @shashankdahake89853 ай бұрын

    Thank you so much ..

  • @debagnikroy9450
    @debagnikroy94506 жыл бұрын

    Awesome sir

  • @sourabhsharma2649
    @sourabhsharma26494 жыл бұрын

    sir please upload videos of doubly and circular linked list

  • @keerthikayoganathan4259
    @keerthikayoganathan42592 жыл бұрын

    thankyou so much sir!

  • @anduempire4373
    @anduempire43733 жыл бұрын

    In insertAt method, if given index is 3 and only one node in LinkedList then what happens?? in this scenario user inserted at 3rd index but element added at 1st index so handle this scenario as well.

  • @deependra5268
    @deependra52686 жыл бұрын

    superb!..

  • @abhishekprabhakar9025
    @abhishekprabhakar90255 жыл бұрын

    Superb👌👌

  • @marivi0079
    @marivi00793 жыл бұрын

    thanks,saved me

  • @ashankavindu2409
    @ashankavindu24093 жыл бұрын

    Man...you like a God to me.....❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤❤

  • @sudiptochakraborty2874
    @sudiptochakraborty28742 жыл бұрын

    thanks a lot...

  • @shivashanker4488
    @shivashanker44886 жыл бұрын

    Sir, could you provide any soft copy related linked list for extra information through description If it is possible only.

  • @bilalahmed2263
    @bilalahmed22634 жыл бұрын

    please Clear my point.. why it work as node.next= n.next... why it did't work as n.next=node.next ? in insertatstart method

  • @narendra9903
    @narendra99035 жыл бұрын

    Am confused..At 7.42 you wrote node.next = n.next . means next element of n is assigned to node.cant we write node= n.next?

  • @palashkhatri7820
    @palashkhatri78204 жыл бұрын

    Really nice explanation, Just paint representation can be lill more clean.

  • @Boom655
    @Boom6556 жыл бұрын

    awesome!!!

  • @anitharednam4347
    @anitharednam43473 жыл бұрын

    Super job

  • @nandkishor838
    @nandkishor8383 жыл бұрын

    thank you sir.

  • @micoruzic5548
    @micoruzic55484 жыл бұрын

    great video you helped me a lot but please change your cursor when you go to paint it's hard to follow it thanks

  • @deepakmandlik9372
    @deepakmandlik93723 жыл бұрын

    awsome!!!!!!!!!!

  • @vibhutisharma3848
    @vibhutisharma38485 жыл бұрын

    pls make video on circular and doubly linked list

  • @ayushigolwara
    @ayushigolwara4 жыл бұрын

    There is one issue in the code in inserAt method, if input is 0th position u need to add return in the if condition otherwise the data will be added to the list twice if(index==0) { insertAtStart(data); return; }

  • @maheshbabumeruva4968
    @maheshbabumeruva49683 ай бұрын

    Why are you not using linked list class in util package? It's very simple to perform all those operations right? No need to write this much of code, Is there any reason?

  • @kristystrives6979
    @kristystrives69794 жыл бұрын

    More useful than my lecturer

  • @no_more_anymore
    @no_more_anymore2 жыл бұрын

    @2:22 It's also not necessary to have the code: 'node.next = null;' right?

  • @Monawa3atCOM
    @Monawa3atCOM4 жыл бұрын

    NOTICE: u must put FOR boucle at else of (if index==0) because if you dont it will be dublicate the same number on pos 0 and 1....am i right???????

  • @AllInOne-jg5qx
    @AllInOne-jg5qx2 жыл бұрын

    You have to put the else block after if and put rest of the code to else block otherwise the added element will be added twice.

  • @akshitdbz9530
    @akshitdbz95306 жыл бұрын

    Sir Node with data 55 shd hve reference of node with data 45 How are we doing that?

  • @rakeshp8582
    @rakeshp85824 жыл бұрын

    Hi , i did same thing what you did in your video...i have tried to add element to 0 index, but, it prints the element 0, 1 index

  • @paulz6045
    @paulz60454 жыл бұрын

    first, you need to implement list.size(), and then check if index > list.size(){ thow new Exeption() }!

  • @sharathkalikota3727
    @sharathkalikota37273 жыл бұрын

    already we have inbuilt functions to add,delete etc....Then what is the use to write our own class as LinkedList I mean What is the use to write LinkedList classs rather thn using inbuilt class @Telusko

  • @tsk2038
    @tsk20383 жыл бұрын

    Best lit 🔥

  • @johncrowley5958
    @johncrowley59585 жыл бұрын

    My code is the same as yours. My insert at end is non-static, but for some reason my insertmiddle and insert start have to be static! Why is this? I feel like its not correct. I'm using JDK 11

  • @shreyanshnigam620
    @shreyanshnigam6204 жыл бұрын

    I m getting a exception main thread i dont know how i m so confused help me here Exception is java.lang.NoClassDefFoundError

  • @satoshinakamoto171
    @satoshinakamoto1715 жыл бұрын

    i think you should have drawn again as it was harder to see in the drawings. also maybe use a mouse pointer color as following the mouse pointer is difficult

  • @carolinaestrada3509
    @carolinaestrada35095 жыл бұрын

    Can you explain when you did -------> node.data = data ? Is this similar to when you have setters and put [ this.variable = variable; ] ? I didn't know you could put an, Object.AnotherDataType, to equal that data type (AnotherDataType). Can you explain what node.data does specifically please?

  • @carolinaestrada3509

    @carolinaestrada3509

    5 жыл бұрын

    @telusko

  • @MrTauquir
    @MrTauquir5 жыл бұрын

    Its outstanding video but pace of presentation should be little slow.

  • @mahendharkhedhar7887
    @mahendharkhedhar78876 жыл бұрын

    Awsome

  • @tanujaks504
    @tanujaks5042 жыл бұрын

    i didn't get can you explain this LinkedList topic slowly, actually i know about the working of linkedlist but i didn't get how to implemets in coding part..

  • @ashutoshsahoo9629
    @ashutoshsahoo96293 жыл бұрын

    If I am using the insertAtStart() multiple times, it's not executing

  • @mohammedmudassirkhatri6871
    @mohammedmudassirkhatri68714 жыл бұрын

    why are we not making an object of head just like node ???

  • @tanvirkazirocks
    @tanvirkazirocks2 жыл бұрын

    With all respect, we have to put the remaining code in the else block for insertAt() method after if condition

  • @chinnimurali7340
    @chinnimurali73405 жыл бұрын

    How to display node.data and node.next in main method??

  • @vishnuv918
    @vishnuv9183 жыл бұрын

    Please upload all data structures in java sir

Келесі