Skip to main content
0 votes
2 answers
291 views

I recently solved the Merge Sorted Array question on leetcode Here is the part of the code I am having doubts on : while (curr >= 0 && p1 >= 0 && p2 >= 0) { // more TC if ...
Suswetha's user avatar
1 vote
1 answer
169 views

I'm trying to prove time complexity of merge sort algorithm in Isabelle HOL: theory Merge_Sort_Time imports Complex_Main "HOL-ex.BigO" begin fun merge :: "'a::linorder list ⇒ 'a list ...
Denis's user avatar
  • 1,325
0 votes
0 answers
72 views

so im trying to make a mergesort for list with tuples, but no matter what i look at i dont see anything wrong with the implementation im doing. But still @tailrec is not being detected by Scala for ...
JokerFever's user avatar
0 votes
0 answers
121 views

I'm writing a Merge Sort to sort a linked list with inline RISCV asm, everything work fine until I start writing the part of lists merging. Here is my function: typedef struct Node { int data; ...
澪人桐's user avatar
1 vote
1 answer
103 views

I am new to Haskell and functional programming. I am trying to write the 3-way merge sort algorithm in Haskell. Problem is, when I run the code in GHCi it just returns *** Exception: stack overflow. I ...
Battos's user avatar
  • 93
-1 votes
1 answer
47 views

I've tried to write function for mergesort, but when I try to debug it I get whether 'stack overflow' or 'violation of access rights when writing to the address'. What might be the problem??? void ...
Ярослава Гурьева's user avatar
-4 votes
1 answer
98 views

I'm trying to make a sorting function that will make an array of the indexes of the "input array." Eg. Array(19,21,15,50,14) would return Array(4,2,0,1,3) That may sound easy, but the ...
Red Impost's user avatar
3 votes
2 answers
163 views

I am a university student stuck on an assignment for my Advanced Algorithms class. The task in simple terms: I'm given an array of 2D points. For each point, I need to display the number of other ...
petdomaa100's user avatar
-6 votes
1 answer
185 views

The merge sort code on Leetcode giving stack-overflow error. ListNode *findMiddle(ListNode *head){ if (!head) return nullptr; ListNode *slow=head; ListNode *fast=head; while (fast!=...
Amit Kumar's user avatar
1 vote
1 answer
141 views

I'm working on an assignment to implement mergesort for singly-linked lists in C++. The merge function needs to merge two sorted lists in-place without creating new nodes. The mergesort function ...
Milad Khazani's user avatar
1 vote
2 answers
75 views

class FirstClass { public static void divide(int[] arr) { if(arr.length == 1) { return; } int mid = arr.length/2; int[] leftHalf = new int[mid]; ...
Mohd. Saad Haider's user avatar
-1 votes
1 answer
110 views

This is my code SLL Natural Merge Sort in C++: #include <stdio.h> #include <stdlib.h> typedef struct Node{ int data; Node* link; }NODE; typedef struct List{ NODE* first; ...
Huy Trần Ngọc's user avatar
0 votes
1 answer
81 views

I'm trying to recreate the merge sorting algorithm and while my code works for lists with length 4 or less when the length gets bigger it crushes. As you'll see the error says that on some point ...
Nico Mcrae's user avatar
0 votes
1 answer
206 views

I am doing a theoretical exercise for a class about a theoretical study of parallelizing the mergesort algorithm and the speed-up obtained for different amounts of cores. I am using the following ...
tiredStudent's user avatar
2 votes
2 answers
73 views

I've been trying to implement MergeSort in Python from the book Introduction to Algorithms and I don't know why this version is not working correctly (it does compile but the list isn't sorted ...
KrzysiekYESS's user avatar

15 30 50 per page
1
2 3 4 5
186