generated from eigerco/beerus
-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
## Pull Request type Please check the type of change your PR introduces: - [ ] Bugfix - [ ] Feature - [ ] Code style update (formatting, renaming) - [x] Refactoring (no functional changes, no API changes) - [ ] Build-related changes - [ ] Documentation content changes - [ ] Other (please describe): Rework the sorting package to introduce a common API that all sorting algorithm should follow from now on. BREAKING CHANGES: API
- Loading branch information
Showing
8 changed files
with
136 additions
and
220 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use alexandria_data_structures::vec::{Felt252Vec, VecTrait}; | ||
|
||
pub trait Sortable { | ||
fn sort<T, +Copy<T>, +Drop<T>, +PartialOrd<T>>(array: Span<T>) -> Array<T>; | ||
} | ||
|
||
pub trait SortableVec { | ||
fn sort<T, +Copy<T>, +Drop<T>, +PartialOrd<T>, +Felt252DictValue<T>>( | ||
array: Felt252Vec<T> | ||
) -> Felt252Vec<T>; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
pub mod bubble_sort; | ||
pub mod merge_sort; | ||
mod bubble_sort; | ||
pub mod interface; | ||
mod merge_sort; | ||
pub mod quick_sort; | ||
|
||
#[cfg(test)] | ||
mod tests; | ||
|
||
use bubble_sort::bubble_sort_elements; | ||
use merge_sort::merge; | ||
// use quick_sort::quick_sort; // Cannot do as name collide. | ||
|
||
pub use bubble_sort::BubbleSort; | ||
pub use interface::{Sortable, SortableVec}; | ||
pub use merge_sort::MergeSort; | ||
pub use quick_sort::QuickSort; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.