 Hey everybody, it's Brian. Welcome to the 39th Qt tutorial with C++ and GUI programming. Today we're going to be covering the Q-length list. I'll go ahead and Create just a simple console program. I'll call this linked Put it in the usual location All right, and let's just add a few includes here And in case you're wondering about my sloppy typing. Yes, I'm still not wearing my glasses. So Just bear with me here The ironic thing is though, um, my video game scores have actually gone up since I quit wearing my glasses I can't figure that one out. I can barely see the screen yet. My score has gone up All right, so what is a Q-length list and why do we need it? Well Q-length list is like the Q-list which you've been working with, but it's linked. What does that mean? well what it means is instead of Allocating all the memory together in one contagious chunk The items can be spread out memory and to do that as a visual representation just kind of show you Wikipedia's link list description and this is a This is not language specific. This is not platform specific. This is a general computer term a linked list if you will each item Contains a pointer to the next Or I should say, you know, it's got a list inside of it that links to the next item What that means is that these don't have to be all in the same chunk of memory They could be spread out all over the place This could be an address 1 this could be address 20 this could be address 3 and it jumps around So what's really the difference between a list and a linked list? Well a list is Very fast rating the list. So if you just want to iterate through the list It's a very fast doing that because it's all in one contagious chunk Now vendor specific might be a little different depending on which vendor you're using But it's all in one contagious chunks. It's very fast now when you go to Insert something say in the middle of that list. It's very slow because it has to Find a chunk of memory big enough for the new list size create a whole new list and do all sort of stuff That may or may not be cute true with cute under the hood I'm not quite sure how they handle it, but that's a general a list a linked list on the other hand It's very fast to insert or delete things because it just changes these pointers But to iterate over the list it has to find the pointer move to that point in memory find the next one move to that point in memory And just keep going and going and going so that's the main difference between the two But the the implementation is almost identical. So say list actually we can just say Bear with me one moment Sorry about that. My mouse cord was hung up on something so we could just populate this list here And we'll just say let's say I had one three and five We'll say for each int I In our list and let's just say cue debug We're gonna print some stuff out here and you will say I Save and run this See see our implementation is identical, but under the hood. It's a drastically different animal here In case you've never seen this before we're just inputting the list you can still use the same old try and true method a pen Well pretty short tutorial. I just wanted you to really understand the differences between a list and a linked list and why you need the two Really all you need to remember is when you see the word linked linked list. Just think of pointers. It's very fast insertions and deletions This is Brian. Thank you for watching. I hope you found this video educational and entertaining