The Reliability Whisperer

The Reliability Whisperer

Share this post

The Reliability Whisperer
The Reliability Whisperer
Binary Search Trees(BST): Solving Real-World Problems Efficiently

Binary Search Trees(BST): Solving Real-World Problems Efficiently

a must learn data structure

The Reliability Whisperer's avatar
The Reliability Whisperer
Mar 17, 2025
∙ Paid

Share this post

The Reliability Whisperer
The Reliability Whisperer
Binary Search Trees(BST): Solving Real-World Problems Efficiently
Share

Problem Statement:

You need to find the top K elements in a dynamic dataset where K keeps changing over time.

First Thought: Using a Heap

  • If K is fixed, a Min-Heap (priority queue) is a great choice.

  • Time Complexity:

    • Insertion: O(log K)

    • Retrieval: O(K log K) (since extracting K elements requires sorting them)

  • Issue:

    • If K keeps changing, you need to rebuild the …

This post is for paid subscribers

Already a paid subscriber? Sign in
© 2025 The Reliability Whisperer
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share