Linked List in Java 2

  Рет қаралды 121,217

Derek Banas

Derek Banas

Күн бұрын

Пікірлер: 110
@scoobynicker
@scoobynicker 11 жыл бұрын
You're a better instructor than my university teachers. Thanks for being a lifesaver Derek.
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) It is very kind of you to say that.
@drtykrty2732
@drtykrty2732 11 жыл бұрын
Derek Banas Definitely a better instructer. Don't know if you have any videos creating or overiding compareTo and comparableTo to be used when using created Linked Lists.
@derekbanas
@derekbanas 10 жыл бұрын
Kurt Ramkissoon Thank you :) I haven't done that specifically. I added it to the list.
@drtykrty2732
@drtykrty2732 10 жыл бұрын
Thanks a million
@ProXproGamers
@ProXproGamers 10 жыл бұрын
Derek Banas Have you done that yet?
@RamiStefanidis
@RamiStefanidis 3 жыл бұрын
Back in 2013, your videos was my goto source to improve my knowledge in Java. Today it is still the best tutorials I have ever seen.
@derekbanas
@derekbanas 3 жыл бұрын
Thank you for the nice compliment :) I’m very happy to hear I helped
@hai5731
@hai5731 2 жыл бұрын
@@derekbanas you still replying now so you are a good youtuber,
@technopple
@technopple 10 жыл бұрын
I don't normally comment on videos, but your Java algorithms playlist has been so helpful to me while I'm preparing for interviews, I just wanted to say thanks! You've earned my sub, haha. It's especially helpful that you provide your code so we don't have to copy it word for word.
@derekbanas
@derekbanas 10 жыл бұрын
technopple Thank you for taking the time to tell me they helped :) Best of luck on your interviews!
@derekbanas
@derekbanas 11 жыл бұрын
In over 4 months only 2 people have commented on that :) You're very perceptive
@محمدالانصاري-ث9ط
@محمدالانصاري-ث9ط 27 күн бұрын
after watching this video i bet everyone will hundred percent understand this video, it is the best video ever and the must confused expamle and implentation of Linked List logic, really thank you bro
@astroboomboy
@astroboomboy 12 жыл бұрын
No, you're doing a great job here, I actually threw that out there because I was not even sure if that would be a better solution, so I thought I'd get your reaction. I'm doing a program now where I want to implement my own generic linked list, and I thought I'd do a node class within the list with next and previous. I greatly appreciate your tutorials!!!
@jean-sebastienlemelin8724
@jean-sebastienlemelin8724 7 жыл бұрын
AWESOME!!!! I am studying Linked List in college, and it help me so much to understand the nuts and bolts!!!
@derekbanas
@derekbanas 7 жыл бұрын
Great I'm happy it helped :)
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) Im glad you find them useful.
@derekbanas
@derekbanas 12 жыл бұрын
Great point! I'm doing my best to make everything easy to understand but I greatly appreciate the input :)
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :) I do my best to answer all questions
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) Best of luck on your exam. Yes, I'm working on creating links to topics inside of the videos now. Thank you for the request
@derekbanas
@derekbanas 12 жыл бұрын
ขอแสดงความยินดี! ฉันจะทำของฉันดีที่สุดเพื่อให้วิดีโออื่นวันนี้ ขอให้พระเจ้าอวยพรคุณเช่นกัน :)
@SnowyCamel
@SnowyCamel 11 жыл бұрын
hey derek. got a computer science exam tomorrow and this really helped, so subscribers++ for you. one suggestion though. in the description for your video, could you add in the times at which you start each subtopic? it would make it easier to jump straight to the point in the video which people need help in. thanks.
@ImAPaladin
@ImAPaladin 11 жыл бұрын
Hello, Mr.Banas. I'm confused about 17:15 in this video. If the last one is being removed, why does it become firstLink? Shouldn't it be something like previousNeighbor = theNeighbors.lastLink; currentNeighbor = null; ? Please help me understand.
@mayurkulkarni755
@mayurkulkarni755 9 жыл бұрын
3:31 , when the list is empty , won't the lastLink and firstLink both be equal to theNewLink ? Instead of just lastLink ?
@derekbanas
@derekbanas 12 жыл бұрын
I love drawing cartoons :) I'm glad you like them
@fluke01
@fluke01 10 жыл бұрын
You sir are a scholar and a saint.
@derekbanas
@derekbanas 10 жыл бұрын
fluke01 Thank you :) I try to do my best
@saikumarpiratla9822
@saikumarpiratla9822 10 жыл бұрын
Derek Banas, if you are thinking to be the president of the Technical World, my vote is for you. I just love all your tutorials, they are so clear and makes easy to understand all the complex topics. I was just wondering, are you planning to start tutorials for "Algorithms" like Knapsack, travelling salesman etc, which is really really complex to understand easily..!
@derekbanas
@derekbanas 10 жыл бұрын
sai kumar Piratla Thank you for the compliment :) Wow that would be fun to do tutorials like that! I did some videos like that in my refactoring tutorials. It would be fun to get everyone to send me a list of problems to solve. I'll see what I can do. Thanks for the request!
@derekbanas
@derekbanas 11 жыл бұрын
Yes there is a massive amount of demand for good java developers. C++ is pretty easy to learn after java, but yes Im certain employers would hire people that don't know it. If you make a few nice android apps they will probably start contacting you. I get job offers every other day
@parth191079
@parth191079 8 жыл бұрын
Hi Derek, I got confused in this video. I will appreciate if you can explain what exactly happened. I have noticed that you had a line of code "theNewLink.previous = lastLink;" at 5:21 minutes in this video. But, at the very next second, this line was just gone! Why is that so? Why the code did not have that?
@xchoochoopainx
@xchoochoopainx 10 жыл бұрын
you're better than any textbook ive had :D
@derekbanas
@derekbanas 11 жыл бұрын
I like to slip little jokes into many of my videos. It is funny that most people never see them. I'm glad you had a laugh from that one :)
@derekbanas
@derekbanas 11 жыл бұрын
I have a big problem with organizing all the videos. The funny thing is that people ask me all the time why I don't make things with different languages, which I do all the time. The funny thing is that nobody ever watches those videos because the titles are out of the ordinary. Some day I'll figure it out. Sorry about any confusion that may cause
@zohaibahmad2339
@zohaibahmad2339 9 жыл бұрын
while(!cNode.name.equals(n)){ cNode = cNode.next; if(cNode == null){ break; } } if(cNode == null){ lastNode.next = newNode; } else{ cNode = cNode.last; newNode.next = cNode.next; cNode.next.last = newNode; } newNode.last = cNode; cNode.next = newNode; } hey im working on inserting an element before a node and my code works fine until the else part where it has to insert a new element before and existing one. how can i fix this?
@derekbanas
@derekbanas 12 жыл бұрын
I fixed it. Thanks for telling me :)
@derekbanas
@derekbanas 11 жыл бұрын
You're very welcome :)
@Yoyimbo01
@Yoyimbo01 8 жыл бұрын
why do you need the if(isEmpty) check on InsertInFirstPosition? It seems to work just fine without it, removing the contents of the if and keeping the contents of the else.
@derekbanas
@derekbanas 12 жыл бұрын
Not yet, but it is coming :) Thank you
@bradellis10
@bradellis10 6 жыл бұрын
I can't seem to wrap my head around why in the double ended linkedlist when inserting into the last position, both the lastLink.next and lastLink are assigned the newLink. I can see that lastLink.next will be a reference to newLink, which will have a null next value....So, why do we point both lastLink and lastLink.next to newLink?
@drjoriv
@drjoriv 7 жыл бұрын
During the section with the insertion of Neighbor after key, wouldn't currentLink.next.previous just equal currentLink?
@gae272927
@gae272927 10 жыл бұрын
Just checking Double Ended Link List is that the same as CircularList
@astroboomboy
@astroboomboy 12 жыл бұрын
You should have an inner class in the linked list so that next and previous can be implemented within the list and not the class. That way you can store any kind of object within the list (not just objects that have defined next and previous), which makes it easier to create a generic list that can take any kind of value to store.
@df4385
@df4385 8 жыл бұрын
hi can we create more than 1 list in loop ? thank you
@derekbanas
@derekbanas 8 жыл бұрын
+nino amine Sure
@df4385
@df4385 8 жыл бұрын
i Search so much but i did not find how to write it in java can you help me please
@JimClermonts
@JimClermonts 6 жыл бұрын
Same question here as last tutorial. Why would I want to create a Double Ended LinkedList?
@12345Slam
@12345Slam 9 жыл бұрын
I don't understand one thing in the method next(). If the previousNeighbor represents the lastLink, how can we say previousNeighbor = currentNeighbor ? I mean why are we moving the first Neighbor to the last position ?
@peteoo9467
@peteoo9467 9 жыл бұрын
can you post the .java file instead?
@derekbanas
@derekbanas 9 жыл бұрын
+Tosy Pitarz I have a link to the files in the description.
@kissmeimirish121
@kissmeimirish121 8 жыл бұрын
+Derek Banas good lord that first diagram description confused me so much haha...
@rahul09876543211
@rahul09876543211 7 жыл бұрын
how come in NeighborIterator we are assigning previousNeighbor = theNeighbors.lastLink; while last link is the link which exists in the last like we have elements 1 2 3 4 .....10 so 1 is the firstLink and 10 is the lastLink that is my understanding. Please clarify if how this can be done
@suleimanshaloudi7523
@suleimanshaloudi7523 9 жыл бұрын
do u know anything about cursor implementation for linked list , and the radix sort using it ? :) thnq anyway
@hellowill
@hellowill 8 жыл бұрын
Thanks for these videos, I finished making previous for the iterator as you didnt really finish the doubly linked part
@derekbanas
@derekbanas 8 жыл бұрын
+Will Your welcome :)
@GokulRG
@GokulRG 10 жыл бұрын
Derek Banas .. Bro.. Could you please include the code to reverse the doubly linked list.. I don't seem to understand that at all..
@langston.barrett
@langston.barrett 11 жыл бұрын
Thanks for the video, I appreciate its efficiency.
@ismaelalsabea2550
@ismaelalsabea2550 8 жыл бұрын
what does currentNeighbor.next.previous refer to and what currentNeighbor refer to? in the insert after key method.
@arielstarr9266
@arielstarr9266 8 жыл бұрын
currentNeighbor.next.previous is there so the new neighbor is inserted in between currentNeighbor and its original next link ( as currentNeighbor's next link became the new neighbor's next link so new neighbor should be inserted between the two ) currentNeighbor in this situation is the neighbor whose houseNumber matches the key
@bobfunky
@bobfunky 9 жыл бұрын
Gives a null pointer when I try to insert after the lastLink(i.e. if you try to add "Derek Banas" ,10,9)
@YouB3anz
@YouB3anz 10 жыл бұрын
This code just needs a couple of small fixes: -insertAfterKey() needs to resolve for the base case. That's when it tries to add to the empty list. -insertInOrder() is in singly linked list form. It should complete backward links as well as forward. Happy programming.
@KorbiCS2
@KorbiCS2 8 жыл бұрын
Quick question. Is it bad that I'm having a hard time wrapping my head around this? It's my first time watching a video on doublelinkedlists and I rewound a ton of times and some parts I understand but others were a bit hazy for me. I'm probably going to watch it again at some point, and yes I saw your first video. Are Linkedlists easy to grasp most of the time, or is it relatively difficult for new comers? Are doublelinkedlists notorious for being a bit complex where single is a bit more straight forward and easy to understand? I have an assignment this week where we use linkedlists and I've been repeatedly watch your first video and reading over and over again about these and how they work.
@derekbanas
@derekbanas 8 жыл бұрын
It is definitely ok if you have trouble understanding algorithms the first time. Keep practicing and analyzing the output at each step and it will make sense
@vivektorne5287
@vivektorne5287 6 жыл бұрын
Derek you are thee best...! Thanks a ton..
@derekbanas
@derekbanas 6 жыл бұрын
Thank you very much :)
@derekbanas
@derekbanas 11 жыл бұрын
Yes I get the Ed Helms thing all the time. Some people I think actually think I am him :)
@xavierssounds3232
@xavierssounds3232 8 жыл бұрын
My class is teaching me very little, the instructor never posts information or projects. Im in my second year of Java, in a data structures class and Im pretty lost. Does this playlist you have set up cover the basics of java data structures? If not, do you have any other recommendations for learning java?
@derekbanas
@derekbanas 8 жыл бұрын
Yes it covers data structures and algorithms. This is a very good book amzn.to/2jZGEfx
@simranpreetsinghnarang7978
@simranpreetsinghnarang7978 11 жыл бұрын
Hello Sir, I wanted to ask you one thing that can a person get job without the knowledge of C++ in Software Development if he or she knows Java and Python really well. I want to become a Android developer. I have a average logic mind and is trying to improve myself more n more every day ... Please reply sir :-)
@PMPhotographyVideography
@PMPhotographyVideography 11 жыл бұрын
Hey Derek Banas Great tutorial as always.Had a question about this.When you do insertAtLastPosition(),you never set lastLink.next = null; then how does Darren Figg's next object become null?
@derekbanas
@derekbanas 11 жыл бұрын
Thank you :) next is null by default, otherwise if it is a doubly linked list I assign next to the first item in the list. I have a link to the code in the description that is heavily commented that may help. Sorry I didn't explain that better.
@PMPhotographyVideography
@PMPhotographyVideography 11 жыл бұрын
Hmm, Ill look over your code.Also please make a tutorial on the circular linked list.That way people can use your tutorials as a one-stop,comprehensive place for linked lists
@derekbanas
@derekbanas 11 жыл бұрын
Parth Mody I'm planning to make an additional tutorial on the algorithms that I didn't cover. Thank you :)
@derekbanas
@derekbanas 12 жыл бұрын
I will when I start making games
@jithinjose1420
@jithinjose1420 9 жыл бұрын
In the main() if we add the line neighbors.currentNeighbor.previous.display() it still displays 'Derek Banas: 2 Privet Drive' the one which we deleted. So i think you need to set the currentNeighbor.previous to previousNeighbor in the remove function of the NeighborIterator class. Correct me if i am wrong... thanks for this awesome tutorial :)...
@lathongher3179
@lathongher3179 8 жыл бұрын
This is probably an easy question for you. How to I apply this video to Queue and a Stack? Queue is First in and First Out and Stack is Last in and Last Out. I've been told it'll be a bit difficult if we remove the first object out of the Queue because the "tail" doesn't point to the previous. I guess I'm confused and need clarification on how to apply the double ended linked list to stack and queue.
@dhruvmangtani1992
@dhruvmangtani1992 8 жыл бұрын
After dealing with arrays so much, it's kind of hard to deal with the awesome flexibility of Linked Lists especially when it comes to inserting values in certain places :)
@123japanuser
@123japanuser 12 жыл бұрын
ทอง! ทอง! ทอง! สวัสดีรักโค้ช ในที่สุดนักเรียนส่วนใหญ่มีความจงรักภักดีและทุ่มเทมากที่สุดมีสิ่งที่เขาสมควรได้รับ ฉันที่ด้านบนของแท่น ฉันรักช่องทางนี้มาก พระเจ้าให้พร
@chanstarox
@chanstarox 10 жыл бұрын
Harry Potter Fan?? :D petunia dursley, privet drive and mrs figg the squib! I see what you did there :) brilliant vid.
@56456546fg
@56456546fg 10 жыл бұрын
currentNeighbor.next.previous, this line i dont totally understand, why is the previous of the next not simply the currentNeighbor?
@ralphschraven339
@ralphschraven339 10 жыл бұрын
We want every element of our DoublyLinkedList to be able to hold a reference to the next element in the list *and* the previous element in the list. Even though right now we know what currentNeighbour is, if we don't state that the element previous to currentNeighbor.next is currentNeighbor, *we can't find that out later on, when currentNeighbor has changed*. In other words, yes, currentNeighbor.next.previous is currentNeighbor, but in order to keep our doubly linked list "doubly linked", we must set it to currentNeighbor before that changes to be something else.
@simranpreetsinghnarang7978
@simranpreetsinghnarang7978 11 жыл бұрын
Thanks alot Sir for ur reply ...
@Chrisymcmb
@Chrisymcmb 7 жыл бұрын
Guys, if your confused, try drawing this out on a piece of paper, it helps a lot. It is taking me a while to learn but ti's worth it :)
@derekbanas
@derekbanas 7 жыл бұрын
Thank you for helping out :)
@Chrisymcmb
@Chrisymcmb 7 жыл бұрын
Thanks you for your lessons :)
@sppanday_
@sppanday_ 6 жыл бұрын
If you guys get stuck, pause the video and search in google what doubly linked list is ...then restart video would be worth it.
@YouB3anz
@YouB3anz 10 жыл бұрын
Your iterator has a few issues as well: -next() can never return the first neighbor. -the constructor sets previousNeighbor to the final link which causes the remove method to malfunction when removing the first neighbor. -remove() does not complete the link backwards when it removes from somewhere in the middle of the list. -also, people should know that remove() should function meaningfully only once per call to next(). I think an easy way to solve these issues is to work with current and next instance variables in your iterator class rather than a previous and current. I'm starting to think you leave these errors in your videos on purpose for people to learn from… either that or you're on crack. That would also explain why you go so fast ;).
@stevenlee7907
@stevenlee7907 9 жыл бұрын
It almost feels like you go so fast in order to get more views. It's a good video but as a beginner it's hard to follow the speed at which you edit everything together... it's too much info too fast. I have to watch over and over and still don't get everything you're saying. I wish you'd be able to slow down the information with more detail than barreling through everything all the time. Don't get me wrong, I appreciate your videos... I just wish you'd help out more people like me (beginners).
@walden_yan
@walden_yan 9 жыл бұрын
+Steven Lee Don't take this the wrong way, but if you can't understand what he is doing, you should go back and look at some beginner topics like object oriented programming. I know he says that this tutorial is also for beginners, but it is best to have a pretty strong foundation of programming knowledge before working with algorithms and data structures. Algorithms is hard at first, but it is good to take your time. The point of algorithms is to be able to produce your own code for specific purposes. When learning a new type of algorithm, make sure to go back and look at everything you learned (in this case, everything in the video), and think about how it works. Derek Banas does a great job of explaining the topics.
@JeffStoneman
@JeffStoneman 7 жыл бұрын
I agree that sometimes he seems to go fast. However, I'd recommend pausing the videos and typing the code as Derek does it. Then, read the code and understand what it's really doing. It takes longer (maybe an extra 20+ mins) on a 20 minute video, but it's the best way I have found for the information to stick. The videos are really great - especially in this Java Algorithm playlist. Highly recommended.
@hovhadovah
@hovhadovah 7 жыл бұрын
+Jeff Stone Better yet, try to sketch it out on paper first and code it yourself. Then if you're utterly and hopelessly stuck, watch the video. It's always a good idea to try to translate your thoughts and diagrams into your own code before watching these tutorials. Copying code (whether literally re-typing it or copy-pasting it) is not a good way to learn, unfortunately.
@sppanday_
@sppanday_ 6 жыл бұрын
KZbin has capability where people like you or me we can pause video and go over everything said, you can even go back to image of code while video is viewed. I have found through research that youtube team doesnt really pay that much if video gets long enough. so derek is trying to commercialise little bit. Otherwise Derek has always uploaded quality videos, in full length. And, this is not for beginner. There are heaps of other videos if you wanna look into simpler version. Derek would add value to someone who already knows most of syntaxes and are taking this tutorial as refreshment rather than anything else.
@nebbo.o4372
@nebbo.o4372 6 жыл бұрын
Take paper and pencil and take notes. Pause the video if you don't understand something and try to figure out what's happening behind the code. Read additional information about the subject. Don't just go for the videos and go with your own speed, nobody forces you to finish everything in one night.
@djb5255
@djb5255 7 жыл бұрын
Petunia's address is wrong.
@derekbanas
@derekbanas 7 жыл бұрын
She moved to get away from "those kind of people" :)
@Akshay-cj3hq
@Akshay-cj3hq 8 жыл бұрын
You lost me at insertInOrder
@realmadridvideos
@realmadridvideos 10 жыл бұрын
"currentNeighbor.next.previous" is the same as "currentNeighbor.next"
@atsudavoh1878
@atsudavoh1878 7 жыл бұрын
You're one of the very best teachers on KZbin but your analogies are very bad and unclear.
@hks1844
@hks1844 11 жыл бұрын
Has anyone ever told you that you sound just like Ed Helms ? lol
@MrValentas
@MrValentas 11 жыл бұрын
I laughed at Petunia Dursley :d
@123japanuser
@123japanuser 12 жыл бұрын
โอ้ โอ้ โอ้ โอ้
@dantewhite9573
@dantewhite9573 6 жыл бұрын
400,000 less views then the 1st video
@thegroosh
@thegroosh 12 жыл бұрын
Oh...
@programcounter13
@programcounter13 5 жыл бұрын
Oh my goodness....take some time to breath while speaking.
@relaxwithkev229
@relaxwithkev229 9 жыл бұрын
ich mag das Video aber wie die andere schon gesagt habe, du bist zu schnell. Wir Anfänger können nicht so schnell überlegen. Aber trotzdem danke
@derekbanas
@derekbanas 9 жыл бұрын
+Kevin Wamba Bitte schön. Es tut mir leid , dass das Video so schnell war .
@sallyzhangt
@sallyzhangt 11 жыл бұрын
Are you a Harry Potter fan? haha
Linked List in Java
17:39
Derek Banas
Рет қаралды 614 М.
Java Hash Tables 3
19:39
Derek Banas
Рет қаралды 63 М.
LinkedList vs ArrayList in Java Tutorial - Which Should You Use?
11:43
Coding with John
Рет қаралды 620 М.
Doubly Linked List | Insert, Delete, Complexity Analysis
17:17
Blue Tree Code
Рет қаралды 71 М.
Solving Programming Problems 2
18:05
Derek Banas
Рет қаралды 36 М.
Simon Sinek's Advice Will Leave You SPEECHLESS 2.0 (MUST WATCH)
20:43
Alpha Leaders
Рет қаралды 2,7 МЛН
Java Hash Tables 2
17:53
Derek Banas
Рет қаралды 102 М.
Set and HashSet in Java - Full Tutorial
20:43
Coding with John
Рет қаралды 244 М.
LinkedList 12 Double Linked Lists
12:11
RobEdwards
Рет қаралды 12 М.
The Absolute Best Intro to Monads For Software Engineers
15:12
Studying With Alex
Рет қаралды 680 М.