# Binary Trees – Linked Lists

Binary trees are useful data structures used to solve specific computational problems. They provide a visual representation of how data can be stored and linked.

Computers use linked lists to store the information of binary trees. This blog post will look at how we can convert a binary tree into a linked list.

#### Binary Tree #1

 Memory Address Node Value Left Pointer Right Pointer 0 K 4 1 1 T 2 3 2 S 5 – 3 U – – 4 A – – 5 L – – 6 – – – 7 – – – … … … …

The Tree is accessed using two pointers:

• RootPointer = 0
• EndPointer = 6

Each time a new element is added to the tree, the EndPointer increments by 1.

#### Binary Tree #2

 Memory Address Node Value Left Pointer Right Pointer 0 T 1 F 2 L 3 B 4 A 5 U 6 C

What would happen if the next value to be added to the tree was letter S?

#### Binary Tree #3

The values have been received/stored in the following order:
N,E,T,F,B,V,U,C,Y

Draw the binary search tree on paper and complete the following link list table:

 Memory Address Node Value Left Pointer Right Pointer

What would happen if the next value to be added to the tree was letter K?

Did you like this challenge?

Click on a star to rate it!

Average rating 3.9 / 5. Vote count: 29

No votes so far! Be the first to rate this post.

As you found this challenge interesting...