Skip to main content
1 vote
0 answers
143 views

I'm studying sorting algorithms at the moment and I have one question that is actually quite well-known but still I can't find a full answer that is comprehensive enough for me. So, the topic is libc++...
nastyAA's user avatar
  • 11
2 votes
1 answer
144 views

I am trying to implement Quick Sort in GNU COBOL (version 3.2.2) using a recursive subprogram. The sorting logic is standard and works perfectly in other languages (C, Python), but when I run it in ...
TranTrung's user avatar
-2 votes
1 answer
185 views

I’m trying to implement an in-place Quick Sort in Python. I have two slightly different versions of my partitioning logic, and I’m confused because both seem correct on small arrays, but the second ...
Lisguen's user avatar
  • 11
0 votes
0 answers
152 views

I have implemented the quicksort algorithm using the last element as the pivot. Now I want to generate an array for the best-case scenario. This is the function that I wrote, but I am not sure that it ...
Claudiu's user avatar
2 votes
1 answer
72 views

I have a question regarding the following code I found on github: fun quicksort nil = nil | quicksort (pivot :: rest) = let fun split(nil) = (nil,nil) | split(x :: xs) = ...
dvk512's user avatar
  • 59
-2 votes
1 answer
119 views

I was tasked to write up a C program to sort an array using quicksort, without using recursion. Original array: -25, 87, 12, -6, 91, 3, -48, 70, 19, -33, 55, 2, -18, 99, 41, -72, 63, 15, -90, 27, 8, -...
Thunder's user avatar
  • 21
1 vote
2 answers
107 views

I am trying to sort the tuples in the 2D array based on a single column value similar to Javascript's sort function. arr.sort((a,b) => a[0] - b[0]) C Code : #include<stdio.h> #...
Bittu970's user avatar
  • 107
1 vote
1 answer
107 views

I am trying to solve the "Kth Largest Element in an Array" problem on LeetCode. I have two different approaches that both theoretically have the same time complexity (O(n) on average), but ...
459zyt's user avatar
  • 115
0 votes
1 answer
73 views

For this assignment I'm supposed to test my quicksort class using a variety of different pivots and a variety of ArrayLists in different arrangements. The class works fine with a random pivot, or a ...
Drake's user avatar
  • 19
0 votes
1 answer
107 views

I'm implementing the partition function for QuickSort, and I've come across behavior that seems confusing. Specifically, in the partition logic: int partition(int A[], int low, int high) { int ...
Omm's user avatar
  • 37
0 votes
1 answer
88 views

In pp.296 Sedgewick & et al.'s Algorithm, 4rd edition, the author wrote: The optimum value of the cutoff M is system-dependent, but any value between 5 and 15 is likely to work well in most ...
Kt Student's user avatar
2 votes
1 answer
187 views

Studying quicksort , I discovered some weird behaviours of the partitioning algorithm (taught by our instructor) when testing it out for random pivots . After quite some research, I found out I was ...
MkB's user avatar
  • 21
1 vote
1 answer
142 views

I am trying to the run the following quick sort algorithm and get the following error when I debug it with gdb: Program received signal SIGSEGV, Segmentation fault. 0x000055555555530a in partition (...
skm's user avatar
  • 43
0 votes
0 answers
51 views

I have a few functions here that are taking strings from an array and sorting them alphabetically. SortList is the main function, which calls functions CompareString, LastName, and FirstName. ...
Antonio 1113's user avatar
0 votes
1 answer
68 views

I have written an assignment for a data structures class and am having trouble figuring out how to "Implement the main quicksort function that recursively sorts the subarrays formed by ...
Gabriel Denney-Martell's user avatar

15 30 50 per page
1
2 3 4 5
217