Add ru version (#1865)

* Add Russian docs site baseline

* Add Russian localized codebase

* Polish Russian code wording

* Update ru code translation.

* Update code translation and chapter covers.

* Fix pythontutor extraction.

* Add README and landing page.

* placeholder of profiles

* Use figures of English version

* Remove chapter paperbook
This commit is contained in:
Yudong Jin
2026-03-28 04:24:07 +08:00
committed by GitHub
parent 2ca570cc33
commit 772183705e
1958 changed files with 108186 additions and 0 deletions
+54
View File
@@ -0,0 +1,54 @@
// File: avl_tree_test.go
// Created Time: 2023-01-08
// Author: Reanon (793584285@qq.com)
package chapter_tree
import (
"fmt"
"testing"
. "github.com/krahets/hello-algo/pkg"
)
func TestAVLTree(t *testing.T) {
/* Инициализация пустого AVL-дерева */
tree := newAVLTree()
/* Вставка узла */
// Обратите внимание, как AVL-дерево сохраняет баланс после вставки узла
testInsert(tree, 1)
testInsert(tree, 2)
testInsert(tree, 3)
testInsert(tree, 4)
testInsert(tree, 5)
testInsert(tree, 8)
testInsert(tree, 7)
testInsert(tree, 9)
testInsert(tree, 10)
testInsert(tree, 6)
/* Вставка повторяющегося узла */
testInsert(tree, 7)
/* Удаление узла */
// Обратите внимание, как AVL-дерево сохраняет баланс после удаления узла
testRemove(tree, 8) // Удаление узла степени 0
testRemove(tree, 5) // Удаление узла степени 1
testRemove(tree, 4) // Удаление узла степени 2
/* Поиск узла */
node := tree.search(7)
fmt.Printf("\nНайденный объект узла = %#v, значение узла = %d\n", node, node.Val)
}
func testInsert(tree *aVLTree, val int) {
tree.insert(val)
fmt.Printf("\nПосле вставки узла %d AVL-дерево имеет вид\n", val)
PrintTree(tree.root)
}
func testRemove(tree *aVLTree, val int) {
tree.remove(val)
fmt.Printf("\nПосле удаления узла %d AVL-дерево имеет вид\n", val)
PrintTree(tree.root)
}