# 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.

157 questions
Filter by
Sorted by
Tagged with
2answers
90 views

### Quicksort implementation in JavaScript

I implemented Quicksort in JavaScript. I'm trying to follow the best principles in JavaScript. In Ruby when you declare classes your able to use private for the ...
2answers
91 views

### HybridSort of QuickSort and MergeSort

I'll try to publish a paper about the programming language I've made (ArithmeticExpressionCompiler, short AEC) in Osječki Matematički List and, in order to demonstrate its usability for implementing ...
0answers
34 views

### Sorting Algorithm Visualiser in Javascript

I'm new to Javascript and Web Dev in general, so they'll likely be some conventions that I'm not aware of. I'm at an odds of whether to use Javascript's functional features more. In my opinion it's ...
0answers
65 views

### Python's quicksort algorithm

I was playing around with sorting methods, brushing up on my algorithms. I have made the following implementation of quicksort: ...
1answer
38 views

### QuickSort Algorithm (Python)

This is my implementation of Quick Sort Algorithm : ...
1answer
35 views

...
0answers
53 views

### QuickSort - List Interface Java

Yes, this is one of my assignments. Question: I am asked to rewrite a generic QuickSort algorithm using only Java List Interface. The purpose is that the algorithm can be executed for both ...
2answers
34 views

### Radix sort is deceiving

I wanted to compare radix_sort to quick_sort for values limited to 0..127 so I implemented this : ...
0answers
37 views

### Quick Sort in rust

I followed the Algorithms book implementation of quick sort. ...
1answer
78 views

### Is this a correct implementation of quicksort in C?

I'm learning C at the moment and chose implementing quicksort as an exercise. My code is sorting correctly, but afterwards I looked at some tutorials online about quicksort. And they implement it ...
1answer
65 views

### C# Quicksort Assignment

For my CS minor I was assigned to implement the Quicksort algorithm in C#. I gave it a go and found that I like the implementation of the algorithm more than Mergesort. Now that I've got my Quicksort ...
1answer
87 views

### Quick sort algorithm in Rust

I have written this Rust code to implement the quick sort algorithm. Could you review it and tell me if it is idiomatic or not? Especially about my use of the slices? ...
2answers
125 views

### Improving quick sort algorithm (Python)

I'm learning algorithm and this is my implementation of quick sort, please guide how can i improve it further and what are other more optimal ways to implement quick sort? ...
1answer
148 views

### Reverse quick sort in Fortran

I have written a quick sort routine to inplace sort an array in descending order: ...
1answer
48 views

### Quick Sort implementation in python

Implemented the quick sort algorithm in python, It was just for learning it, now I want to port it to C. Thoughts on the quality of my python implementation? ...
2answers
114 views

### Quick Sort Implementation with iterators

Most quicksort examples online use C-style arrays and indexes. I have written below quicksort implementation with STL style iterators. It looks fine to me, but I feel like I may be making more than ...
1answer
76 views

### Quick Sort Algorithm (Python)

QuickSort is a Divide and Conquer algorithm, which picks an element as "pivot" and partitions a given list around the pivot. There are many different versions of Quick Sort, as to how to pick a pivot ...
3answers
98 views

### Quicksort for ints

I have written the following quicksort without using online help. It seems to be fine, but is there anything to improve? ...
1answer
120 views

### Quicksort in JavaScript assuming an immutable array

Update: further succinct versions below (inspired by Haskell) Quick sort in JS assuming an immutable array: ...
0answers
140 views

### Engineering an even faster qsort

I understand that C++ STL template sort runs faster than qsort in C because ...
0answers
280 views

### Median of three partitioning taking more time than standard quicksort in java

I implemented a standard quicksort and I have a project where I need to improve it. I am trying to make quicksort faster by implementing median of 3 partitioning. I copied codes from trusted ...
0answers
161 views

### Median of 3 partitioning taking more time than quicksort in java [duplicate]

I have a quicksort code in java which I want to improve. The improved code should take less time than the quicksort code. However when using my improved code which implement median of 3 partitioning, ...
0answers
49 views

### Sorts (merge, quick, bubble) in Python

I'm new to python, and I wrote the following code. Please review, critique and enhance. This project compares quicksort, mergesort and bubblesort write/test the partition routine for quicksort. (20 ...
1answer
149 views

### Quicksort template (for sorting corresponding arrays)

I needed a function for sorting two corresponding arrays. So I wrote this code to sort N corresponding arrays! The really "metaprogrammy" way to do it would be to use ...
1answer
118 views

### Quicksort in C with unit testing framework

This is my quicksort There are many like it but This quicksort is mine. So, quicksort, in C, with a big framework to test it six ways from Sunday. Passed the tests nicely, but there may be warts, or ...
2answers
87 views

### Quick Sort c program

I recently learned quick sort through https://www.geeksforgeeks.org/quick-sort/ but found it hard to follow. So, from what I understand wrote the following program. ...
0answers
178 views

### Qsort in C++ using vector

I tried to make a simple qsort() function in a functional way, it takes a vector and a bool pred() Suggestions as to make it more functional, optimize it, and/or ...
2answers
130 views

### Evaluation of a variation of quick-sort (pivot-selection)

Here is a variation of quick-sort where-in the pivot selection is based on calculating the average of the values of the highest and lowest numbers. ...
1answer
286 views

### Python implementation of Quicksort using list comprehensions

I wrote an implementation of quicksort that I think is pythonic. I based it off of this common Haskell implementation: ...
2answers
2k views

### Concurrent quicksort in C++

I have a task to write a concurrent version of quicksort algorithm, to speed it up. This is what I wrote: ...
1answer
74 views

### Quicksort implementation with pivotal calculated as middle element

I read quick sort algorhitm and implemented in like this: ...
1answer
131 views

### Pythonic quick sort

I'm new to the world of python, and wrote this quick sort implementation which was taught to us in an algorithms class. I would like to learn to write code less like C++ and more pythonic. Could you ...
1answer
105 views

### Quicksort in JavaScript, using nested functions

I come from Java/Swift environment. So, I'm used to show the user of my code only "what is necessary". For JavaScript I use Visual Code. When I try to use the Intellisense feature, it shows all my ...
0answers
97 views

### Classical Single Pivot QuickSort implementation in Java using Generics

I have coded the following quick sort implementation. There are few things that still makes this code ugly and redundant. 1. Handling Arrays of Primitives I have to write a separate implementation of ...
1answer
2k views

### Quick Sort in x86 assembly (MASM)

My task was to implement Quick Sort in assembly from pseudocode. ...
1answer
876 views

### QuickSort in Java with Lomuto Partition or Hoare Partition

I have developed a quick sort in java, that can work with both Lomuto Partition Strategy, or Hoare Partition Strategy. Both of them sort the array correctly. I would like to have it code reviewed ...
2answers
4k views

### Quick Sort on C++ vector

I've seen other implementations around, but they seem pretty complicated. This seems to work for me, but is there anything I'm missing? Also, any tips on how I can improve the quality of the code is ...
3answers
185 views

### Quick sort with a predicate

I want to pass a predicate into quick sort. The issue I'm running into is that the predicate must have two arguments, the pivot and the element of the list's tail. As far as I know though, predicates ...
1answer
1k views

### Quick sort implemented in Rust

First attempt at writing Rust code. What do you think of the formatting? I think the type conversions are pretty messy. How can I make it more idiomatic? ...
0answers
582 views

### Quick Sort Implementation on Python

I tried to implement quick sort. Quick sort is a divide and conquer algorithm. It continues to choose a pivot point and break down the collection into single-element lists, before combing them back ...
2answers
7k views

### Sorting an ArrayList of Vehicles using quick sort

For an assignment I have to sort an ArrayList of Vehicle objects using the quick sort method. I have come up with two implementations for this, which would be the best to use? Is method 1 considered ...
2answers
379 views

### First quicksort algorithm

The program is separated in main.cpp, quicksort.cpp, partition.cpp and swap.cpp. There is also a header file to each .cpp file. The idea is from this site. As you can see, I tried to be very modular. ...
2answers
637 views

### Quicksort implementation in C++

I was wondering if this implementation of quicksort could be improved. Are there any things that I have done wrong? ...
3answers
1k views

### Quick Sort C++ Implementation

I'm learning C++ and algorithms myself, and as training I had to write quicksort by myself.All feedback on coding style/clarity and concepts are welcomed! ...
1answer
3k views

### Iterative in-place quicksort

I have implemented an iterative in-place quicksort algorithm in Python, which by default selects the pivot as the last element: ...
0answers
397 views

### Last element pivot Quicksort exercise in TypeScript

Never being good in "algorithming", I'm now trying to improve the situation a bit. An algorithm below is the attempt to home brew yet another quicksort. This time, specifically with a "last-element" ...
1answer
15k views

### Sort data from a text file in descending order using quick sort

I have a text file containing the following data. ...
1answer
1k views

### Iterative quicksort in Java

I have this quicksort implementation that relies on heap memory instead of actual stack. It uses two integer stacks for keeping track what subranges are yet to be sorted. When a partition routine is ...
3answers
278 views

...
4answers
3k views

### Quick Sort Implementation C++11

Here is qsort implementation using iterators as it is in std::sort ...