if isempty(treturn true else return (root(tvand allsmaller(left( ),vand allsmaller(right( ),vallbigger(tree tvalue vif isempty(treturn true else return (root(tvand allbigger(left( ),vand allbigger(right( ),vhoweverthe simplest or most obvious algorithm is not always the most efficient exerciseidentify what is inefficient about this algorithmand formulate more efficient algorithm sorting using binary search trees sorting is the process of putting collection of items in order we shall formulate and discuss many sorting algorithms laterbut we are already able to present one of them the node values stored in binary search tree can be printed in ascending order by recursively printing each left sub-treerootand right sub-tree in the right order as followsprintinorder(tree tif not isempty(tprintinorder(left( )print(root( )printinorder(right( )thenif the collection of items to be sorted is given as an array of known size nthey can be printed in sorted order by the algorithmsort(array of size nt emptytree for , , - insert( [ ],tprintinorder(twhich starts with an empty treeinserts all the items into it using insert(vtto give binary search treeand then prints them in order using printinorder(texercisemodify this algorithm so that instead of printing the sorted valuesthey are put back into the original array in ascending order