[Utility] Binary Heap (sort)

The place to discuss scripting and game modifications for X³: Reunion.

Moderators: Moderators for English X Forum, Scripting / Modding Moderators

Post Reply
Posts: 2279
Joined: Thu, 29. Jan 04, 09:19

[Utility] Binary Heap (sort)

Post by AalaarDB » Thu, 17. Nov 05, 03:04

A binary heap is a type of lazy sort, with best on top and the rest in a 'heap'. The key is an integer, with lowest on top. To use it, initialize a maxSize+1 array, and set first element to 0. Insert all data like normal, but to get it back into sorted order, remove element 1 (like pop top element but I didn't wrap it) continuously until element 0 reads 0.

This file is only intended for other scripters who want to sort data. Binary Heap Sort

Post Reply

Return to “X³: Reunion - Scripts and Modding”