From the course: C# Algorithms
Unlock this course with a free trial
Join today to access over 25,500 courses taught by industry experts.
Linked list algorithms - C# Tutorial
From the course: C# Algorithms
Linked list algorithms
- [Instructor] Although there is a linked list data structure available in C#, not every algorithm you'll ever need will be built into the standard library. Instead, you may need to create your own data structure with your own algorithms to manipulate your data more efficiently. For example, let's say we want to delete the back half of a linked list. It would be nice to have access to those next pointers, because all we would have to do is set the appropriate next pointer equal to null. In fact, we can actually create our own linked list using classes, specifically, a linked list class and a node class. In the code, we have a linked list class that has an attribute called head. This represents the first item in the list, or the head of the list. We also have an inner class called node. This is used by the linked list. Each node has two attributes: data and a reference to the next node in the list. Let's create a linked list from our custom linked list class. We'll use the built-in…
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.