mirror of
https://github.com/RGBCube/serenity
synced 2025-07-28 14:07:45 +00:00
AK: Make single pivot quick_sort guarantee a max stack depth of log(n)
- The change to quick_sort requires SimpleIterator to support assignment. - Rename quick_sort to single_pivot_quick_sort to make it easier to choose a specific implementation (not based on signature). - Ensure single_pivot_quick_sort does not copy the pivots - Expand sorts_without_copy test case to cover both single and dual pivot implementations.
This commit is contained in:
parent
40da077f6c
commit
9068398f6b
3 changed files with 105 additions and 19 deletions
|
@ -78,6 +78,13 @@ public:
|
|||
constexpr const ValueType* operator->() const { return &m_container[m_index]; }
|
||||
constexpr ValueType* operator->() { return &m_container[m_index]; }
|
||||
|
||||
SimpleIterator& operator=(const SimpleIterator& other)
|
||||
{
|
||||
m_index = other.m_index;
|
||||
return *this;
|
||||
}
|
||||
SimpleIterator(const SimpleIterator& obj) = default;
|
||||
|
||||
private:
|
||||
static constexpr SimpleIterator begin(Container& container) { return { container, 0 }; }
|
||||
static constexpr SimpleIterator end(Container& container)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue