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 3230846
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T16:58:30+00:00 2026-05-17T16:58:30+00:00

I have created an AVL tree implementation, but as an AVL tree is quite

  • 0

I have created an AVL tree implementation, but as an AVL tree is quite a complex structure, I need to test it. So the question is – how can I test it?

Up to this moment I have the following tests:

  1. basic sanity check – checks that
    for every node height equals max.
    height of child nodes + 1, balance is in [-1, 1], left child’s
    key < this node’s key < right
    child’s key, and there are no
    circular references (like left child
    of a node is a node himself);

  2. check that inorder traversal on an AVL tree
    (and on a binary search tree in the whole)
    will return values from the underlying set in order;

  3. check that an AVL tree’s height is strictly less than
    1.44*log2(N+2)-1 (there N is number of elements) – proved by AVL tree creators;

  4. visual check – doesn’t work that well, I try to draw a tree (rootnode in the first line, his direct children on the next line, childen of rootnode’s direct childen on the third line and so on), but that works only on small trees, for big trees it becomes a complete mess;

  5. Russian wikipedia says that it is proven experimentally, that for two insertions one rebalancing needed and for five removals also one rebalancing needed, but is it really so? English wikipedia says nothing about it, and for my AVL one rebalancing needed for two insertions or for four removals, which is not quite the same.

Maybe these tests are enough, but if there are any more tests, not difficult to implement, why not do it?

  • 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-17T16:58:31+00:00Added an answer on May 17, 2026 at 4:58 pm

    A key property of an AVL tree is that each of its sub-trees is also an AVL tree. That means that covering the basic scenarios should give you a broad coverage of the AVL tree functionality.

    In other words, these tests done on the smallest tree structure that allows them are the most important ones:

    • Creating a new tree.
    • Inserting the first value.
    • Inserting a bigger value.
    • Inserting a smaller value.
    • Inserting a value that causes LL Rotation.
    • Same for the other rotations.
    • Same for Removing.
    • All the variants of Finding values.

    If your implementation passes these tests, it would probably pass them on larger trees.
    Note that performance and memory usage is not tested here.

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

Sidebar

Related Questions

Have created a c++ implementation of the Hough transform for detecting lines in images.
I have created a webservice in .net 2.0, C#. I need to log some
I have created a windows service which is set to start automatically. This service
I have created a cookie using php and now I need to create a
I have created a template for Visual Studio 2008 and it currently shows up
I have created a custom dialog for Visual Studio Setup Project using the steps
I have created a PHP-script to update a web server that is live inside
I have created a UserControl that has a ListView in it. The ListView is
I have created a C# class file by using a XSD-file as an input.
I have created a few small flash widgets that stream .mp3 audio from an

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.