Sorting is generally a simple way of searching and performs a subroutine that involves searching in a certain order. I find it easy to use Timsort sorting algorithms and trying to create possible outcomes with them. I did find the labs and the exercise to be difficult, probably because I had trouble remembering to make trees and sorting out my work.
Here is a general form of a function:
def function(key, node):
if node is Null:
return node
elif key < node.key:
return left.node
elif key > node.key:
return right.node
No comments:
Post a Comment