Skip to content

Commit

Permalink
no mut
Browse files Browse the repository at this point in the history
  • Loading branch information
Okm165 committed Dec 29, 2023
1 parent 5b09904 commit 22000c6
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/common/merge_sort.cairo
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ fn merge_sort<T, +Copy<T>, +Drop<T>, +PartialOrd<T>>(arr: Array<T>) -> Array<T>

// Create left and right arrays
let middle = len / 2;
let (mut left_arr, mut right_arr) = arr.split(middle);
let (left_arr, right_arr) = arr.split(middle);

// Recursively sort the left and right arrays
let mut sorted_left = merge_sort(left_arr);
let mut sorted_right = merge_sort(right_arr);
let sorted_left = merge_sort(left_arr);
let sorted_right = merge_sort(right_arr);

let mut result_arr = array![];
merge_recursive(sorted_left, sorted_right, ref result_arr, 0, 0);
Expand All @@ -34,11 +34,11 @@ fn merge_sort<T, +Copy<T>, +Drop<T>, +PartialOrd<T>>(arr: Array<T>) -> Array<T>
/// # Returns
/// * `Array<usize>` - Sorted array
fn merge_recursive<T, +Copy<T>, +Drop<T>, +PartialOrd<T>>(
mut left_arr: Array<T>,
mut right_arr: Array<T>,
left_arr: Array<T>,
right_arr: Array<T>,
ref result_arr: Array<T>,
left_arr_ix: usize,
right_arr_ix: usize
left_arr_ix: u32,
right_arr_ix: u32
) {
if result_arr.len() == left_arr.len() + right_arr.len() {
return;
Expand Down

0 comments on commit 22000c6

Please sign in to comment.