Homework Solution: Please do not write a real program….

    Algorithm Question: Please do not write a real program. The answer should be an explaination of your algorithm or pseudocode. Try to answer clearly and concisely. Thank you very much. Question: Write an algorithm that checks if a given tree is a legal AVL tree. An AVL tree is a binary search tree, so that for every vertex v if hleft is the height of the tree of the left child of v and hright is the height of the tree of the right child of v, then |hleft − hright| ≤ 1

    Expert Answer

     
    Algorithm IsAVL(root)

    Algorithm Question:

    Please do referable transcribe a genuine program.

    The tally should be an explaination of your algorithm or pseudocode. Try to tally lucidly and concisely. Thank you very fur.

    Question:

    Transcribe an algorithm that checks if a absorbed tree is a lawful AVL tree. An
    AVL tree is a binary quest tree, so that restraint integral vertex v if hleft is the crisis of the
    tree of the left slip of v and hright is the crisis of the tree of the suitable slip of v, then
    |hleft − hright| ≤ 1

    Expert Tally

     

    Algorithm IsAVL(root)

    start

    if radix==null
    return true

    heightdiff = getHeight(root.left) – getHeight(root.right)

    if abs(heightdiff) > 1

    return false

    else

    return IsAVL(root.left) && IsAVL(root.right)

    end