a********r 发帖数: 58 | 1 What's the underlying sort algorithm for SET in C++ STL? Thanks! |
t****t 发帖数: 6806 | 2 usually sort() is based on quicksort. however it's implementation defined,
given the complexity requirement is satisfied.
【在 a********r 的大作中提到】 : What's the underlying sort algorithm for SET in C++ STL? Thanks!
|
t******r 发帖数: 88 | 3 恩,对方都问了是SET,就是红黑树,那应该不是quicksort了,SET本来就是有序的吧
【在 t****t 的大作中提到】 : usually sort() is based on quicksort. however it's implementation defined, : given the complexity requirement is satisfied.
|
l******e 发帖数: 12192 | 4 你是对的
【在 t******r 的大作中提到】 : 恩,对方都问了是SET,就是红黑树,那应该不是quicksort了,SET本来就是有序的吧
|
t****t 发帖数: 6806 | 5 哦, 对不起没看见是set.
【在 t******r 的大作中提到】 : 恩,对方都问了是SET,就是红黑树,那应该不是quicksort了,SET本来就是有序的吧
|
a********r 发帖数: 58 | 6 but what's the built-in sorting algorithm for the sorted set if have? thanks
! |
t****t 发帖数: 6806 | 7 someone already told you it's red-black tree. it's always sorted.
thanks
【在 a********r 的大作中提到】 : but what's the built-in sorting algorithm for the sorted set if have? thanks : !
|
a********r 发帖数: 58 | 8 but what's the built-in sorting algorithm for the sorted set if have? thanks
! |
x*******u 发帖数: 2074 | 9 没有set::sort()这个函数的
插入/删除等modifier操作都必须保证整个tree是binary search tree
thanks
【在 a********r 的大作中提到】 : but what's the built-in sorting algorithm for the sorted set if have? thanks : !
|
h*******u 发帖数: 15326 | 10 set里面值修改后不能自动sort,怎么回事。
如果是插入或删除则能保证自动排序
【在 t****t 的大作中提到】 : someone already told you it's red-black tree. it's always sorted. : : thanks
|
t****t 发帖数: 6806 | 11 本来就不能修改. 必须删掉重新加.
【在 h*******u 的大作中提到】 : set里面值修改后不能自动sort,怎么回事。 : 如果是插入或删除则能保证自动排序
|
h*******u 发帖数: 15326 | 12 看来我没用错,不过这个设计。。。呵呵
【在 t****t 的大作中提到】 : 本来就不能修改. 必须删掉重新加.
|
t****t 发帖数: 6806 | 13 这个设计没什么问题啊, 红黑树里的元素要移动本来也是要删掉再重新加的.
【在 h*******u 的大作中提到】 : 看来我没用错,不过这个设计。。。呵呵
|
h*******u 发帖数: 15326 | 14 算法上没错,不过用起来有点不方便了
可能是习惯问题
【在 t****t 的大作中提到】 : 这个设计没什么问题啊, 红黑树里的元素要移动本来也是要删掉再重新加的.
|