Competitions

In this lesson, I'll share some points of applications of self-balancing BST and what we expect in competitions.

We'll cover the following

Application

Since the 3 operations (insertion, searching and deletion) take O(logN)O(logN) time each. One straightforward application is a set where you can insert and remove elements and check if a given element belongs in the set.

This will become more evident as we solve some sample problems in later lessons.


Competitions

Similar to a data structure like queue and stacks. Self-balancing is a standard data structure with enormous application in problems of every difficulty and in a complex, compound data structure.

So it becomes necessary to have this data structure as a block box that you can use as a set in competition and not implement pointer-based, rotating BSTs during a live contest.

Once we’ve understood the workings, we’ll see how to leverage STL to do exactly this.


There are 3 containers from C++ STL that we will be using for Balanced BST operations. These are

  1. Set
  2. MultiSet
  3. Map

Get hands-on with 1400+ tech skills courses.