课程: C# Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
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…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。