Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Вивчайте Binary Tree | Trees Part I
Data Structure & Algorithms PART I

bookBinary Tree

Trees can be binary and non-binary.

We think trees may be hard to implement if you are a beginner in programming.

So, we are going to implement in Python only 2 types of Trees: the BST, and the AVL, as they are one of the most popular ones.

With other types of trees, we will 'make friends' briefly.

In nearest future, when you are ready to study other types of trees, we will do that!

Let’s go! Trees are waiting for us!

A Binary Tree is a tree that has at most 2 children. The structure of each node is not complicated. Every node has:

  • Data inside it;
  • Left child pointer;
  • Right child pointer.
12345
class TreeNode(object): def __init__(self, val): self.val = val self.left = None self.right = None
copy

It is like you can point and your children, but they may exist or not. Frequently speaking, computer programming families look weirdo, isn’t it?)

question mark

What statement is wrong?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 2

Запитати АІ

expand

Запитати АІ

ChatGPT

Запитайте про що завгодно або спробуйте одне із запропонованих запитань, щоб почати наш чат

Suggested prompts:

Запитайте мені питання про цей предмет

Сумаризуйте цей розділ

Покажіть реальні приклади

Awesome!

Completion rate improved to 4.35

bookBinary Tree

Свайпніть щоб показати меню

Trees can be binary and non-binary.

We think trees may be hard to implement if you are a beginner in programming.

So, we are going to implement in Python only 2 types of Trees: the BST, and the AVL, as they are one of the most popular ones.

With other types of trees, we will 'make friends' briefly.

In nearest future, when you are ready to study other types of trees, we will do that!

Let’s go! Trees are waiting for us!

A Binary Tree is a tree that has at most 2 children. The structure of each node is not complicated. Every node has:

  • Data inside it;
  • Left child pointer;
  • Right child pointer.
12345
class TreeNode(object): def __init__(self, val): self.val = val self.left = None self.right = None
copy

It is like you can point and your children, but they may exist or not. Frequently speaking, computer programming families look weirdo, isn’t it?)

question mark

What statement is wrong?

Select the correct answer

Все було зрозуміло?

Як ми можемо покращити це?

Дякуємо за ваш відгук!

Секція 3. Розділ 2
some-alt