GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • rulcode
  • Sign In

This view

  • Original page
  • New address

GeezerVison is showing rulcode.com — BST Insert Visualizer & Solution | Rulcode

Fetching algorithms...

    BST Insert Visualizer & Solution | Rulcode
    Loading problem details...

    17. BST Insert

    PRO
    Medium
    Topics
    Companies
    Hint

    Understand Before Coding

    Visualize This Problem
    Open Visualizer
    Draw Your Approach
    Draw

    Example 1:

    Input: root = [4,2,7,1,3], val = 5
    Output: [4,2,7,1,3,5]
    Explanation: The value 5 is inserted as the right child of 3.

    Example 2:

    Input: root = [40,20,60,10,30,50,70], val = 25
    Output: [40,20,60,10,30,50,70,null,null,25]
    Explanation: The value 25 is inserted as the right child of 20.

    Example 3:

    Input: root = [4,2,7,1,3,null,null,null,null,null,null], val = 5
    Output: [4,2,7,1,3,5]
    Explanation: The value 5 is inserted as the right child of 3.

    Constraints:

    • •
    • •
    • •
    • •
    • •

    Time Complexity

    O(log n)

    Space Complexity

    O(h)

    You are visitor 01402503 — GeezerVison does not store the pages you look up.
    Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.