+
Point of view
All features
deferred class ABSTRACT_SORTER [X_]
Summary
Some algorithms to sort any COLLECTION, using a given order relation in deferred methods lt, gt, lte and gte.
Elements are sorted using increasing order: small elements at the beginning of the collection, large at the end (decreasing order is implemented by class REVERSE_COLLECTION_SORTER). Note that "small" means "a is smaller than b" when "lt (a, b)", no matter what lt is.
Direct parents
Insert list: ANY
Known children
Insert list: COLLECTION_SORTER, COMPARATOR_COLLECTION_SORTER, REVERSE_COLLECTION_SORTER, STRING_RECYCLING_ITEM_SORTER
Overview
Features
Auxiliary functions
{}
{ANY}
• is_sorted (c: COLLECTION[X_]): BOOLEAN
Is c already sorted ? Uses lte for comparison.
• has (c: COLLECTION[X_], element: X_): BOOLEAN
• index_of (c: COLLECTION[X_], element: X_): INTEGER_32
• add (c: COLLECTION[X_], element: X_)
Add element in collection c keeping the sorted property.
• insert_index (c: COLLECTION[X_], element: X_): INTEGER_32
retrieve the upper index for which gt
• sort (c: COLLECTION[X_])
Sort c using the default most efficient sorting algorithm already implemented.
• quick_sort (c: COLLECTION[X_])
Sort c using the quick sort algorithm.
• von_neuman_sort (c: COLLECTION[X_])
Sort c using the Von Neuman algorithm.
• heap_sort (c: COLLECTION[X_])
Sort c using the heap sort algorithm.
• bubble_sort (c: COLLECTION[X_])
Sort c using the bubble sort algorithm.
{}
lt (x: X_, y: X_): BOOLEAN
deferred function
{}
gt (x: X_, y: X_): BOOLEAN
effective function
{}
lte (x: X_, y: X_): BOOLEAN
effective function
{}
gte (x: X_, y: X_): BOOLEAN
effective function
{}
is_sorted (c: COLLECTION[X_]): BOOLEAN
effective function
{ANY}
Is c already sorted ? Uses lte for comparison.
has (c: COLLECTION[X_], element: X_): BOOLEAN
effective function
{ANY}
index_of (c: COLLECTION[X_], element: X_): INTEGER_32
effective function
{ANY}
effective procedure
{ANY}
Add element in collection c keeping the sorted property.
insert_index (c: COLLECTION[X_], element: X_): INTEGER_32
effective function
{ANY}
retrieve the upper index for which gt
sort (c: COLLECTION[X_])
effective procedure
{ANY}
Sort c using the default most efficient sorting algorithm already implemented.
quick_sort (c: COLLECTION[X_])
effective procedure
{ANY}
Sort c using the quick sort algorithm.
von_neuman_sort (c: COLLECTION[X_])
effective procedure
{ANY}
Sort c using the Von Neuman algorithm.
heap_sort (c: COLLECTION[X_])
effective procedure
{ANY}
Sort c using the heap sort algorithm.
bubble_sort (c: COLLECTION[X_])
effective procedure
{ANY}
Sort c using the bubble sort algorithm.
von_neuman_line (src: COLLECTION[X_], dest: COLLECTION[X_], count: INTEGER_32, d_count: INTEGER_32, lower: INTEGER_32, imax: INTEGER_32)
effective procedure
{}
von_neuman_inner_sort (src: COLLECTION[X_], dest: COLLECTION[X_], sg1: INTEGER_32, count: INTEGER_32, imax: INTEGER_32)
effective procedure
{}
heap_repair (c: COLLECTION[X_], c_lower: INTEGER_32, first: INTEGER_32, last: INTEGER_32)
effective procedure
{}
Repair the heap from the node number first It considers that the last item of c is number last It supposes that children are heaps.
quick_sort_region (c: COLLECTION[X_], left: INTEGER_32, right: INTEGER_32)
effective procedure
{}