1 views

Uploaded by Yoshida アマリナ

data structure

- Chapter3 - MGT162
- Chapter3 - MGT162
- Neural Networks
- Sample Descriptive Essay About a Visit to Disneyworld [Amal]
- Command Prompt Tricks
- Zakat Folio
- The Subtle Art of Not Giving a F*ck: A Counterintuitive Approach to Living a Good Life
- Sapiens: A Brief History of Humankind
- The Unwinding: An Inner History of the New America
- Hidden Figures: The American Dream and the Untold Story of the Black Women Mathematicians Who Helped Win the Space Race
- Elon Musk: Tesla, SpaceX, and the Quest for a Fantastic Future
- Shoe Dog: A Memoir by the Creator of Nike
- Never Split the Difference: Negotiating As If Your Life Depended On It
- Maybe You Should Talk to Someone: A Therapist, HER Therapist, and Our Lives Revealed
- John Adams
- Devil in the Grove: Thurgood Marshall, the Groveland Boys, and the Dawn of a New America
- Grit: The Power of Passion and Perseverance
- Yes Please
- This Changes Everything: Capitalism vs. The Climate
- A Heartbreaking Work Of Staggering Genius: A Memoir Based on a True Story

You are on page 1of 2

**Binary search tree is a binary tree in which each internal node x
**

stores an element such that the element stored in the left subtree of

x are less than or equal to x and elements stored in the right

subtree of x are greater than or equal to x.

2. Explain 3 types of binary tree.

a) Preorder traversal

b) Inorder traversal

c) Postorder traversal

3. Explain about the traversal in binary tree (Inorder, preorder

and postorder).

a) Preorder traversal

i. Start form the root node. Write it down

ii.

Then go to the leftmost node from the root node in the

left subtree. On its way to the left most node, right down

all the nodes as it comes.

iii.

When the leftmost node is reached, write it down

iv.

Then visit the right subtree of the leftmost node’s parent

node.

v. Write down the first node of the right subtree

vi.

Now proceed in the same way as step ii – v till ‘writing

down’ of all the nodes is finished.

b) Inorder traversal

i. Start form the root node

ii.

Then go to the leftmost node from the root node in the

left subtree.

iii.

When the leftmost node is reaches, write it down.

iv.

Then visit/go to the leftmost node’s parent node. Write it

down.

v. Then visit/go to the first node of the right subtree.

vi.

Proceed in the same way as in step ii – v till ‘writing

down’ of all the node is finished.

c) Postorder traversal

i. Start from the root.

ii.

The go to the leftmost node from the root node in the

left subtree.

iii.

When the leftmost node is reached, write it down.

iv.

Then visit/go to the leftmost node’s parent node.

v. Then visit/o to the first node of the right subtree.

4. b) Complete binary tree: Complete binary tree is a binary tree in which every level.vi. So no leaves with only one child. What is the difference between a full binary tree and a complete binary tree? a) Full binary tree: A full binary tree is a tree in which every node other tan the leaves has two children. Proceed in the same way as in step ii – v till ‘writing down’ of all nodes is finished. . is completely filled and all nodes are as far left as possible. except possibly the last. It seems to mean a balanced tree. usually distinguished as “left” and “right”. A binary tree is a tree data structure in which each node has at most two child nodes.