Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add js codes to avl_tree.js #323

Merged
merged 3 commits into from
Feb 5, 2023
Merged

add js codes to avl_tree.js #323

merged 3 commits into from
Feb 5, 2023

Conversation

what-is-me
Copy link
Contributor

If this PR is related to coding or code translation, please read the contribution guideline, fill out the checklist, and paste the console outputs to the PR.

  • I've tested the code and ensured the outputs are the same as the outputs of reference codes.
  • I've checked the codes (formatting, comments, indentation, file header, etc) carefully.
  • The code does not rely on a particular environment or IDE and can be executed on a standard system (Win, macOS, Ubuntu).

console output


插入结点 1 后,AVL 树为
——— 1

插入结点 2 后,AVL 树为
    /——— 2
——— 1

插入结点 3 后,AVL 树为
    /——— 3
——— 2
    \——— 1

插入结点 4 后,AVL 树为
        /——— 4
    /——— 3
——— 2
    \——— 1

插入结点 5 后,AVL 树为
        /——— 5
    /——— 4
   |    \——— 3
——— 2
    \——— 1

插入结点 8 后,AVL 树为
        /——— 8
    /——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

插入结点 7 后,AVL 树为
        /——— 8
    /——— 7
   |    \——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

插入结点 9 后,AVL 树为
            /——— 9
        /——— 8
    /——— 7
   |    \——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

插入结点 10 后,AVL 树为
            /——— 10
        /——— 9
       |    \——— 8
    /——— 7
   |    \——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

插入结点 6 后,AVL 树为
            /——— 10
        /——— 9
       |    \——— 8
    /——— 7
   |   |    /——— 6
   |    \——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

插入结点 7 后,AVL 树为
            /——— 10
        /——— 9
       |    \——— 8
    /——— 7
   |   |    /——— 6
   |    \——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

删除结点 8 后,AVL 树为
            /——— 10
        /——— 9
    /——— 7
   |   |    /——— 6
   |    \——— 5
——— 4
   |    /——— 3
    \——— 2
        \——— 1

删除结点 5 后,AVL 树为
            /——— 10
        /——— 9
    /——— 7
   |    \——— 6
——— 4
   |    /——— 3
    \——— 2
        \——— 1

删除结点 4 后,AVL 树为
        /——— 10
    /——— 9
   |    \——— 7
——— 6
   |    /——— 3
    \——— 2
        \——— 1

查找到的结点对象为 [object Object],结点值 = 7
  • some changes in TreeNode.js may caused by the formatter plugin (Prettier - Code formatter)

@vercel
Copy link

vercel bot commented Feb 4, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Comments Updated
hello-algo ⬜️ Ignored (Inspect) Feb 5, 2023 at 6:14AM (UTC)

Copy link
Owner

@krahets krahets left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix and clean code!

@krahets krahets merged commit e3f0151 into krahets:master Feb 5, 2023
@krahets krahets added bug Bug fixes code Code-related labels Feb 5, 2023
@krahets
Copy link
Owner

krahets commented Feb 5, 2023

Hi! Please don't forget adding the file header in the code files for the next PR~

@what-is-me
Copy link
Contributor Author

Ok, thanks for your remind.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Bug fixes code Code-related
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants