Skip to main content

Questions tagged [quick-sort]

Quicksort is a sorting algorithm invented by C. A. R. Hoare that has an average-case complexity of O(n log n), worst-case complexity of O(n^2). It is one of the fastest general-purpose sorting algorithms in practice.

0 votes
3 answers
222 views

I implemented quick sort after merge sort as part of LeetCode question for sorting an array. The solution code can be found at https://leetcode.com/problems/sort-an-array/solutions/7180269/i-...
Dovud Jo'rayev's user avatar
4 votes
1 answer
340 views

Is this code for quicksort using the first index as a pivot correct? Also if I want to use the last or middle index as a pivot how would the whole code change? ...
Kqehzo's user avatar
  • 41
3 votes
1 answer
98 views

I've implemented a solution to generate the worst-case scenario for QuickSort using the middle pivot strategy in Java. The goal is to rearrange an input array to produce the worst performance during ...
Lydia Yuan's user avatar
4 votes
4 answers
1k views

I've been away from Programming and the Tech Industry for sometime. I thought I'd look at and try some of the older basic stuff. I bushed up to QuickSort and found most existing implementations of it, ...
Amal Krishnan's user avatar
3 votes
3 answers
209 views

Here's my second program in C, and my time/space analysis of this code. I have been reading Modern C and I attempted this challenge on page 26. The prior pages are pretty much the only exposure I have ...
user14464173's user avatar
2 votes
2 answers
225 views

Quick sort is a sorting algorithm in which we select any random element as pivot from the array and we do the partition of the array around that pivot. Basically we place all the elements smaller than ...
Strange Alchemist's user avatar
1 vote
1 answer
182 views

I have implemented the K-Way Partitioning algorithm which is based on the Peter Taylor's solution. Which works but i want fill the q array which is the borders of ...
user avatar
3 votes
1 answer
383 views

My implementation of 3 way quick sort for strings. It supposed to sort very large set of 800,000,000 objects. This is why I added ...
Nick's user avatar
  • 1,656
3 votes
0 answers
139 views

I've implemented a destructive merge and quick sort in common lisp, but the code feels verbose and highly imperative. I was wondering if anyone could offer guidance on idioms that could make the code ...
bfair's user avatar
  • 131
2 votes
1 answer
788 views

I'm relatively new to c++ programming. I have a few years of experience writing simple Arduino programs, but I always kept to the basics. I also have some more experience with Python. I set myself the ...
iHnR's user avatar
  • 121
5 votes
2 answers
278 views

I wrote a sorting program so that if the optional argument -i is present then the sorting should be done without taking into account lowercase / uppercase letters. ...
Mike's user avatar
  • 319
1 vote
1 answer
2k views

I have been searching for ways to make my algorithm more efficient but most answers told me to divide the array into two differente arrays one of less elements and one of greater elements and then ...
Luigi_S_R's user avatar
0 votes
1 answer
73 views

I am having trouble with applying to 3 steps needed to proof correctness, most likely because I did not formally study CS or Mathematics and am still learning about loop and class invariants. The ...
MPC's user avatar
  • 61
3 votes
1 answer
1k views

The goal is to have a function that can sort a series of all object types that implement the comparable interface. I'm not trying to improve the performance of the sort. I'm only trying to optimize my ...
BugSquanch's user avatar
3 votes
2 answers
190 views

I was wondering if there is anything that I could do to make my code look cleaner and more descriptive for educational purposes? ...
Farzin's user avatar
  • 133

15 30 50 per page
1
2 3 4 5
12