From the course: Nail Your C++ Interview
Unlock the full course today
Join today to access over 23,400 courses taught by industry experts.
Linked lists in C++ - C++ Tutorial
From the course: Nail Your C++ Interview
Linked lists in C++
- [Instructor] A linked list is a list constructed with pointers. Pointers are just address locations and in a link list, they can be used to reference the next item in the list or in a double link list, you can use two pointers, one to point to the next item and one to point to the previous item. So remember to reference a pointer, you use the asterisk and an arrow when assigning the pointers data. A linked list is a great interview question because it allows an interviewer to see whether you know some advanced topics in C++ such as pointers and structs. Recall that structs are simply classes without the methods. If you add a pointer to a struct to act as the link, you now have a node. Each node linked together creates a linked list. By moving the pointer to not include a node in the list you have virtual leap deleted that node from the list, but you didn't delete the data from memory. This may be a fast way to grow…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.