Binary Tree Sort

A place for DM32 owners to share their Programs, Data, Equations and State Files. Please feel free to post programs and other resources here, to share with the DM32 user community. Also feel free to post requests for programs of a particular type you may be looking for. The most convenient format to share these is by posting a State File (something.d32) attachment, but program or equation listings is OK too. Note that State Files are really text files with a .d32 extension, so treat them cautiously as you should all materials downloaded from public sources.
Post Reply
Calcman54
Posts: 25
Joined: Sat Mar 10, 2018 12:24 am
Location: Toronto Canada

Binary Tree Sort

Post by Calcman54 »

The binary tree sort algorithm requires placing values into a tree root system in such a way that the retrieved values are sorted.

For a detailed explanation check out the following wikipedia page.

https://en.wikipedia.org/wiki/Binary_tree_sort

The attached spreadsheet has an example of how this works on the DM32.

The program in the attached d32 file will sort up to 290 values. This routine requires more registers than QuickSort because the program must have separate blocks of registers for:
1. Unsorted Values
2. Root system.
3. Sorted values.
4. Recursion stack.

The limit can be extended by using global registers -100 to -999 but that can wait for another day.

Wayne
Attachments
DM32 Binary Tree Sort.xlsx
(26.76 KiB) Downloaded 14 times
BinSort.d32
(1.81 KiB) Downloaded 8 times
Post Reply