Блог пользователя taratam

Автор taratam, 9 лет назад, По-английски

I implemented avl tree and works correctly, if keys are different or duplicates are not so much. When i try to insert or delete 10000 times random keys in range [0;5] in some moment tree becomes not avl. Is there any reason that rotations broke avl tree constraints if keys duplicates?

  • Проголосовать: нравится
  • -9
  • Проголосовать: не нравится

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

No,it always should be balanced if you follow rotation rules correctly even when there's duplicates

»
9 лет назад, # |
  Проголосовать: нравится 0 Проголосовать: не нравится

Is there any reason that rotations broke avl tree constraints if keys duplicates?

I think that the only possible reason is that your implementation isn't correct :)

»
9 лет назад, # |
Rev. 2   Проголосовать: нравится 0 Проголосовать: не нравится

I solved it!