Chapter 21Binary Search Trees

DOI: 10.1201/9781003257981-21

The previous chapters explained linked lists. If we want to find the node where a specific value is stored, we need to start at the first node (usually called the head) and visit the nodes one by one. If no node stores this value, we have to visit every node until the list's end before reaching that conclusion. In a doubly linked list, each node has two links called (next and prev). A doubly linked list allows for traversing forward using next and backward using prev. Doubly linked lists still have the same limitations: If the list is long, then finding a particular node may require visiting many nodes. If the node to find is at the middle, a doubly linked list needs to visit half ...

Get Intermediate C Programming, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.