Skip to main content

Red–Black Tree

  • Chapter
  • First Online:
  • 994 Accesses

Abstract

A redblack tree (RBT) is a type of Binary Search Tree where a new parameter color for each node has been defined (Figure 12-1). We learned that after some insert and delete operations, the binary search trees become unbalanced which creates a linked list. Redblack trees solve this problem by balancing elements. Each node has a color which can be black or red. Thus, when declaring a node for the RBT, it must contain a key/value, a color, the reference to a parent node, and the references for the children nodes. RBTs are very useful for worst-case scenarios when processing search, insertion, and deletion operations.

This is a preview of subscription content, log in via an institution.

Buying options

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   49.99
Price excludes VAT (USA)
  • Available as EPUB and PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   64.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Author information

Authors and Affiliations

Authors

Rights and permissions

Reprints and permissions

Copyright information

© 2020 Elshad Karimov

About this chapter

Check for updates. Verify currency and authenticity via CrossMark

Cite this chapter

Karimov, E. (2020). Red–Black Tree. In: Data Structures and Algorithms in Swift. Apress, Berkeley, CA. https://doi.org/10.1007/978-1-4842-5769-2_12

Download citation

Publish with us

Policies and ethics