Introduction to Linked Lists, Arrays vs Linked Lists, Advantages/Disadvantages - C++ Data Structures

preview_player
Показать описание
A linked list is a data structure used to store and organize data. This tutorial is an introduction to linked lists. You will learn how to use linked lists, the important advantages and disadvantages of linked lists, the differences between linked lists and arrays, and how to implement a linked list in the C++ programming language. I'll also teach you how linked lists work with functions and how you can access elements of the linked list (nodes) and how you can pass the linked list to a function.

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️

Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

I use it to enhance the performance, features, and support for C, C#, and C++ development in Visual Studio.
It is a powerful, secure text editor designed specifically for programmers.

However, please don't feel obligated to do so. I appreciate every one of you, and I will continue to share valuable content with you regardless of whether you choose to support me in this way. Thank you for being part of the Code Beauty community! ❤️😇

Contents:
00:00 - What will you learn in this course?
00:40 - Introduction to linked lists, What are linked lists?
03:35 - Differences between linked lists and arrays, advantages/disadvantages
07:28 - How to implement a linked list in C++
12:52 - How to link the nodes (How to link the elements of the linked list)
16:03 - Linked lists and functions

Other tutorials mentioned in this course:

Tag me on you Instagram story:
Рекомендации по теме
Комментарии
Автор

📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.

CodeBeauty
Автор

I struggle with my professor's way of explaining this. You did it in just 24 mins. Thank you.

HollowGuy
Автор

I am a college student who is watching in Korea
There is no such high quality C++ video in Korea
Thank you for the good video!!

soniusMu
Автор

Learned more in 24 mins than my professor in 2 hours. Thank you!

Tylasian
Автор

You're the only one that finally made this understandable to me. Thank you so much plz continue this series !! I would like to see the series upgrade to the intermediate level. Thank you again, Saldina!

SalmanKhan-wkpk
Автор

void printList(Node *head)
{

if (head->Next != nullptr)
{
cout << head->Value << endl;
printList(head->Next);
}
else {
cout << head->Value << endl;
delete[] head;

}
}


A little bit recursion worked well in this case ... Thank you for all your efforts Saldina.

eminbaybarstimurstudent
Автор

I decided to watch the entire video at 1am for fun instead of going to sleep. Linked lists have never been this clear to me until now, thanks to you!

garcj
Автор

I recently discovered your channel and I just have to say that you are doing an amazing job with these videos. You have a great teaching style and I love the way you use practical examples to illustrate concepts.
I use C++ when working with microcontrollers like the Arduino, and while there are a few syntax differences it is very similar, so your videos have been a great resource.

I know you get many requests for other languages as well, and as a YouTuber myself I understand that it's impossible to entertain them all. If I were to make a request I would love to see you do a series on Python after you conclude the C++ tutorial series. So you can add that to the list!

I wish you every success with your YouTube channel.

Dronebotworkshop
Автор

You are a life saver I have taken data structures three times and never understood it especially linked lists and you made it so simple THANK YOU T--T

artisticnights
Автор

your videos are insane, you made me feel that c++ wasn´t as difficult as it was being for me at university, thanks a lot and best wishes from Spain.

Neiltxu
Автор

If people don't want to use public variables in a class (not pretty cool to use public variables in classes and not so great to practice) they can check this code right here. I did some OOP things:

class Nod { // Nod = Node in my language

int valoare; // valoare = value in my language
Nod* next;
public:
// I did a constructor also to avoid making a very big column of initializations. If I don't pass the next Node, then the default value is a nullptr;
Nod(int valoare, Nod *next = nullptr) : valoare(valoare), next(next) {}
// Here are some getters and setters that can access the private variables.


void setValoare(int valoare) {
Nod::valoare = valoare;
}

void setNext(Nod *next) {
Nod::next = next;
}

int getValoare() const {
return valoare;
}

Nod *getNext() const {
return next;
}
};

void printList(Nod* n) {
while(n){
std::cout<< n->getValoare() << " ";
n = n->getNext(); // This is a pointer so that's why you can do this.
}
}
int main() {
// linked list example with 4 elements:
Nod* head = new Nod(1);
Nod* second = new Nod(2);
Nod* third = new Nod(3);
Nod* last = new Nod(4);

// here I was pretty lazy to implement the pointer in constructor thing (the stuff you need to pass as a parameter to the construct to point to the next node) so I did this:



head->setNext(second);
second->setNext(third);
third->setNext(last);

printList(head);
// std::cout << "Hello, World!" << std::endl;
return 0;
}


Hope it helps

sebastianionel
Автор

My last year until I graduate BS computer Science ... Thank you so much your lessons are great.

joehibbler
Автор

Love how you explain everything so simple and easy!

milkamilkica
Автор

video posted on 24/Feb/2021, Today 8/Dec/2021 still helpful and will continues being helpful. *Thanks Saldina*

learntoearn
Автор

I caught the beginning but was distracted through the middle. I caught the question, my answer was "It needs the Head. It requires a basis, a point of reference from which to start".
I start my degree next week, and even though I have no previous experience, when you said the answer was the same as mine I cannot express the joy I felt.
Thanks so much for taking the time to make videos like this. It may seem like "revision" to someone familiar, but to someone like me (and your recommendations on learning Java at the start), I don't know it's hard to explain.
But you're so damn attractive I can't concentrate lol and it's mostly why I was walking around listening half the time. I can never look at Batman the same way again. However, I'm sure I'll manage :)

In all serious, you're wonderful. You and many others like you ( e.g. freecodecamp) have really opened my eyes to a wonderful new world for me to explore. I'm so excited!
Please, don't stop. Any of you.

MushroomGravy
Автор

Thank you so much, I didn't have much knowledge about pointers to begin with, yet your explanation was so nice that I didn't need to revisit it at all.

vedkorla
Автор

Thank you so much, your way of explaining is so clear and understandable. I really needed this video!!

bubble_gum_witch
Автор

thanks a lot CodeBeauty. I am BCA student at manipal university jaipur, I struggke understanding this concept from other tutorial, but yours is super easy to grasp. thanks again

handsoncoding
Автор

By watching this video I have contemplated not only the beauty of code, but also the beauty of programmers. Thanks a lot for that video! Seems to be one of the most beneficial.

Michael-tfhj
Автор

as a long-ago C/C++ dev (c. 1998) and a current Kotlin Java dev, this is relevant to my work and interests!

tsalVlog