Tuesday, 31 March 2015

Slog 8

week9's topic is about inserting on Binary search Tree. To begin with, Binary search tree is a very special abstract data type, because the data in binary search tree is sorted. To be more precise, numbers on left children nodes are always less than their parent nodes and numbers on right children nodes are always greater than their parent nodes. Therefore, it makes easier for computer scientist to insert numbers into binary search tree. Firstly, we need to compare the number we want to insert with the number in the parent node, if the number is less than the number in the parent node, we will insert our number at the left hand side and running recursion on it, otherwise right hand side. As a result, it reduces the running time of inserting function and it will be a very useful method in the future.

No comments:

Post a Comment