Define a scheme procedure named tree-sort which takes a


Define a Scheme procedure, named tree-sort, which takes a list of numbers and outputs the same list, but in sorted order. Your procedure should sort the list by:

(a) inserting the numbers into a binary search tree and, then,

(b) extracting from the binary search tree a list of the elements in sorted order.

To get started, write a procedure called insert-list which takes a list of numbers L and a tree T, and returns the tree that results by inserting all numbers from L into T.

Then write a function called sort-extract which takes a binary search tree and outputs the elements of the tree in sorted order. (We did this in class!)

Then, finally, put these two functions together to achieve tree-sort.

Solution Preview :

Prepared by a verified Expert
Business Economics: Define a scheme procedure named tree-sort which takes a
Reference No:- TGS02235511

Now Priced at $20 (50% Discount)

Recommended (99%)

Rated (4.3/5)