Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 4624584
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T03:09:00+00:00 2026-05-22T03:09:00+00:00

I have an AVL tree while each node consists of: Key Value The AVL

  • 0

I have an AVL tree while each node consists of:

  • Key
  • Value

The AVL tree is ordered by the keys.

So if I got 2 keys and now I want to find the maximum value between those 2 keys.
I’ve tried adding additional information to each node like the max value in the left subtree and same for the right subtree but I can’t get the right algorithm without “losing” some nodes between.

Complexity time: O(log n) worst case.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T03:09:01+00:00Added an answer on May 22, 2026 at 3:09 am

    What other operations do you need on this composite tree, and what complexity bounds do you require for them?

    If the only restriction is on this look-up-the-max-value-for-a-range-of-keys(j, k) operation, then there is the silly solution of precomputing all these n^2 maxima in arbitrarily much time; you’d store all values for fixed k in an array in node k in the tree; then your operation is reduced to a lookup. However, if you’d want to support insert or delete, the complexity would be something like O(n^2).

    A more realistic option would be to store the max of each subtree. There are at most O(log(n)) subtrees between any two nodes, and you encounter all of them on the way from the root to your two keys j and k or just underneath them in the tree, so that would be O(log(n)). This way you’d still have O(log(n)) insertion, but I think deletion would potentially be O(n) now since it’s complicated to restore the maximum of a subtree out of which you’ve removed an entry.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have an AVL Tree. Each node looks like this: typedef struct { Node
I'm working on an AVL tree assignment and I have a quick question about
I have a large AVL Tree which I build some times during program from
I have the following AVL tree: 10 / \ 5 12 / \ /
Sometimes it makes sense to have a key-ordered dictionary. In C++, this is often
Assume that I have two AVL trees and that each element from the first
Have finally got a responsive site working (of a fashion). What I want to
I have created an AVL tree implementation, but as an AVL tree is quite
I am trying to implement an AVL tree and not sure about the best
I want to save my objects according to a key in the attributes of

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.