CHAPTER 6
LINKED LISTS
Chapter 5 introduced you to singly linked lists and doubly linked lists, and how to perform basic operations on those data structures. This chapter shows you how to perform a variety of tasks that involve more than the basic operations in the previous chapter.
The first part of this chapter contains code samples that add the numbers in a linked list in several different ways, followed by code samples that display the first k and the last k elements in a linked list.
The code samples in the second portion of this chapter reverse a singly linked list and remove duplicates. You will also see how to concatenate two lists and how to merge two ordered lists. In addition, you will learn how to find the middle element of a linked ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access