- Add a warning about quicksort being stable only with some
operators git-svn-id: svn://svn.gna.org/svn/sgpemv2/trunk@1066 3ecf2c5c-341e-0410-92b4-d18e462d057c
This commit is contained in:
parent
b065d0f099
commit
aedac205ea
|
@ -109,11 +109,11 @@ class CPUPolicy:
|
|||
# @code
|
||||
# # As a lambda anonymous function (preferred)
|
||||
# # (x and y are two DynamicSchedulable objects)
|
||||
# cmpf = lambda x,y: x.someProperty() < y.someProperty()
|
||||
# cmpf = lambda x,y: x.someProperty() <= y.someProperty()
|
||||
#
|
||||
# # As a normal *global* function
|
||||
# def compare(a,b):
|
||||
# return a.someProperty < b.someProperty()
|
||||
# return a.someProperty <= b.someProperty()
|
||||
# cmpf = compare
|
||||
# @endcode
|
||||
#
|
||||
|
@ -124,6 +124,12 @@ class CPUPolicy:
|
|||
# self.sort(queue, cmpf)
|
||||
# @endcode
|
||||
#
|
||||
# Since queue.sort() uses a in-place version of the
|
||||
# quicksort algorithm, note the effect of using "<"
|
||||
# instead than "<=": quicksort wouldn't be stable anymore.
|
||||
# You have been warned. If your policy behaves strangely,
|
||||
# this may be the cause.
|
||||
#
|
||||
# @param self The object caller
|
||||
# @param queue The ReadyQueue to be sorted in place
|
||||
# @param cmpf The binary function to use to compare elements
|
||||
|
|
Loading…
Reference in New Issue