Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,152,667 members, 7,816,745 topics. Date: Friday, 03 May 2024 at 04:12 PM

Implement The Quick Sort Algorithm In Your Language. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / Implement The Quick Sort Algorithm In Your Language. (1166 Views)

Thread For Nairaland Algorithm Questions / Nigerian Developers How Did You Master Algorithm And Problem Solving / Simple Algorithm Exercise (2) (3) (4)

(1) (Reply) (Go Down)

Implement The Quick Sort Algorithm In Your Language. by Nobody: 11:04pm On Oct 17, 2017
I'm trying to run benchmark tests using AB.

I want to test the efficiency of languages against the quick sort algorithm.
Id appreciate anyone willing to help me test as I'm quite busy...


In Go I have :


package qsort

import "math/rand"

func QuickSort(slice []int) []int {
length := len(slice)

if length <= 1 {
sliceCopy := make([]int, length)
copy(sliceCopy, slice)
return sliceCopy
}

m := slice[rand.Intn(length)]

less := make([]int, 0, length)
middle := make([]int, 0, length)
more := make([]int, 0, length)

for _, item := range slice {
switch {
case item < m:
less = append(less, item)
case item == m:
middle = append(middle, item)
case item > m:
more = append(more, item)
}
}

less, more = QuickSort(less), QuickSort(more)

less = append(less, middle...)
less = append(less, more...)

return less
}

1 Like

Re: Implement The Quick Sort Algorithm In Your Language. by Kod3007(m): 11:17pm On Oct 17, 2017
grin
i would have written it in php but php is your primary language undecided
Re: Implement The Quick Sort Algorithm In Your Language. by melodyogonna(m): 11:51pm On Oct 17, 2017
DanielTheGeek:
I'm trying to run benchmark tests using AB.

I want to test the efficiency of languages against the quick sort algorithm.
Id appreciate anyone willing to help me test as I'm quite busy...


In Go I have :

try to alwalys embed ur code between "[code][/code]".
Re: Implement The Quick Sort Algorithm In Your Language. by Nobody: 8:07pm On Oct 18, 2017
melodyogonna:

try to alwalys embed ur code between "[code][/code]".

Well, I know. It just seems to break things....

Where's your code solution?
Re: Implement The Quick Sort Algorithm In Your Language. by Nobody: 9:57pm On Oct 18, 2017
Boss ur code is cool.
Re: Implement The Quick Sort Algorithm In Your Language. by Nobody: 10:05pm On Oct 18, 2017
proxy20:
Boss ur code is cool.

Thanks, should I expect any implementation from you?
Re: Implement The Quick Sort Algorithm In Your Language. by Nobody: 10:10pm On Oct 18, 2017
DanielTheGeek:


Thanks, should I expect any implementation from you?

Just here to learn you guys write quicksort in Java, js, c#,python, ruby,haskell,c++ or more
Re: Implement The Quick Sort Algorithm In Your Language. by Nobody: 10:17pm On Oct 18, 2017
proxy20:


Just here to learn you guys write quicksort in Java, js, c#,python, ruby,haskell,c++ or more

Well the bosses seem to be asleep or have abandoned NL. Maybe I should follow because the reception of this thread is just discouraging...
Re: Implement The Quick Sort Algorithm In Your Language. by Kod3007(m): 1:03am On Oct 19, 2017
DanielTheGeek:


Well the bosses seem to be asleep or have abandoned NL. Maybe I should follow because the reception of this thread is just discouraging...
Reception of almost every post on NL nowadays is discouraging, Many views ....trickling comments cry
Re: Implement The Quick Sort Algorithm In Your Language. by QueryUnical: 8:59pm On Oct 19, 2017
DanielTheGeek:
I'm trying to run benchmark tests using AB.

I want to test the efficiency of languages against the quick sort algorithm.
Id appreciate anyone willing to help me test as I'm quite busy...


In Go I have :



C++
https://www.google.com/search?client=firefox-b&q=implementing+quicksort+in+C%2B%2B&oq=implementing+quicksort+in+C%2B%2B&gs_l=psy-ab.12..0i30k1.36302.44589.0.46624.15.14.0.0.0.0.896.1644.6-2.2.0....0...1.1.64.psy-ab..13.2.1642...0.0.fExOXEHt5Gg&gfe_rd=cr&dcr=0&ei=9QLpWYlhjNVe2Ym20AI

Java
https://www.google.com/search?q=quicksort+algorithm+Java&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&dcr=0&ei=XgPpWa6DF4zVXtmJttAC


C#
https://www.google.com/search?q=implementing+quicksort+in+C%23&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&dcr=0&ei=aQPpWab5HIzVXtmJttAC


Python
https://www.google.com/search?q=implementing+quicksort+in+python&ie=utf-8&oe=utf-8&client=firefox-b&gfe_rd=cr&dcr=0&ei=dwPpWeTQGIzVXtmJttAC

(1) (Reply)

Blockchain Programmer Needed / I Need A Programming Partner / Problem Opening The Ms Word 2010 File Format - .doc

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 16
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.