Skip to content

Commit 5f31bbd

Browse files
authored
Merge branch 'master' into master
2 parents 30658a2 + e4d9ce7 commit 5f31bbd

File tree

10 files changed

+36
-23
lines changed

10 files changed

+36
-23
lines changed

QuickSort/Ruby/quicksort.rb

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
class Array
2+
def quicksort
3+
return [] if empty?
4+
5+
pivot = delete_at(rand(size))
6+
left, right = partition(&pivot.method(:>))
7+
8+
return *left.quicksort, pivot, *right.quicksort
9+
end
10+
11+
array = [15, 23, 1, 9, 10, 2, 5]
12+
p array.quicksort
13+
end

README.md

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -9,39 +9,39 @@ Language| Java | Python | Rust | C | C++ | JavaScript | Go | C# | Ruby |
99
--- | --- | --- | --- |--- |--- |--- |--- |--- |--- |
1010
A*Search | | | | | :+1: | | | |
1111
BellmanFord | :+1: | | | | | | | |
12-
BestFirstSearch | :+1: | | | | | | | |
12+
BestFirstSearch | :+1: | | | | | | | |
1313
BinarySearch | :+1: | :+1: | | | :+1: | :+1: | :+1: | |
14-
Bitap Algorithm | | | | | :+1: | | | |
15-
BreadthFirstSearch | :+1: | :+1: | | :+1: | | | | |
16-
BubbleSort | :+1: | :+1: | :+1: | :+1: | :+1: | :+1: | | |
17-
DepthFirstSearch | | | | | :+1: | | | |
18-
Dijkstra's | :+1: | | | | :+1: | | | |
19-
Doomsday | :+1: | | | | | :+1: | | |
14+
Bitap Algorithm | | | | | :+1: | | | |
15+
BreadthFirstSearch | :+1: | :+1: | | :+1: | | | | |
16+
BubbleSort | :+1: | :+1: | :+1: | :+1: | :+1: | :+1: | | |
17+
DepthFirstSearch | | | | | :+1: | | | |
18+
Dijkstra's | :+1: | | | | :+1: | | | |
19+
Doomsday | :+1: | | | | | :+1: | | |
2020
ElevatorAlgorithm | :+1: | | | | | | | |
2121
Fibonacci | :+1: | :+1: | | :+1: | | | :+1: | |
2222
FisherYatesShuffle | :+1: | | | | :+1: | | | :+1: |
23-
Floyd'sAlgorithm | | :+1: | | | :+1: | | | |
23+
Floyd'sAlgorithm | | :+1: | | | :+1: | | | |
2424
GreatestCommonDivisor | :+1: | | | :+1: | | | | |
2525
HeapSort | :+1: | | | | :+1: | :+1: | :+1: | | :+1:
26-
HistogramEqualization | :+1: | | | | | | | |
26+
HistogramEqualization | :+1: | | | | | | | |
2727
InsertionSort | :+1: | :+1: | :+1: | | | | :+1: | :+1: |
28-
Johnson algorithm | | | | | :+1: | | | |
28+
Johnson algorithm | | | | | :+1: | | | |
2929
Kadane's algorithm | :+1: | :+1: | | | :+1: | :+1: | :+1: | |
3030
LinearSearch | :+1: | :+1: | | | :+1: | :+1: | | | | |
31-
Longest-Common-Subsequence | :+1: | :+1: | | | :+1: | | | | :+1:
32-
Longest-Increasing-Subsequence | :+1: | | | | | | | |
33-
LongestPath | | | | | :+1: | | | |
34-
MergeSort | :+1: | :+1: | | :+1: | :+1: | :+1: | :+1: | |
35-
MiniMaxWithABPruning | :+1: | | | | | | | |
36-
Modified_Binary_Search | | | | :+1: | | | | |
37-
Postman Sort | | | | :+1: | | | | |
38-
Quick Sort | | | | | | | | :+1: |
39-
Uniform-cost search | :+1: | | | | | :+1: | :+1: | |
40-
RadixSort | :+1: | :+1: | | | :+1: | | | |
41-
RobinCarp | :+1: | | | | | | | |
42-
SelectionSort | :+1: | :+1: | | :+1: | :+1: | :+1: | :+1: | | :+1:
31+
Longest-Common-Subsequence | :+1: | :+1: | | | :+1: | | | | :+1:
32+
Longest-Increasing-Subsequence | :+1: | | | | | | | |
33+
LongestPath | | | | | :+1: | | | |
34+
MergeSort | :+1: | :+1: | | :+1: | :+1: | :+1: | :+1: | |
35+
MiniMaxWithABPruning | :+1: | | | | | | | |
36+
Modified_Binary_Search | | | | :+1: | | | | |
37+
Postman Sort | | | | :+1: | | | | |
38+
Quick Sort | :+1: | :+1: | | | | :+1: | :+1: | :+1: | :+1:
39+
Uniform-cost search | :+1: | | | | | :+1: | :+1: | |
40+
RadixSort | :+1: | :+1: | | | :+1: | | | |
41+
RobinCarp | :+1: | | | | | | | |
42+
SelectionSort | :+1: | :+1: | | :+1: | :+1: | :+1: | :+1: | | :+1:
4343
ShellSort | :+1: | :+1: | | | :+1: | | | |
44-
SieveofEratosthenes | :+1: | :+1: | | | :+1: | | | |
44+
SieveofEratosthenes | :+1: | :+1: | | | :+1: | | | |
4545
UnaryCoding | :+1: | :+1: | | | | :+1: | | |
4646
TernarySearch | | | | | :+1: | | | |
4747

0 commit comments

Comments
 (0)