Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9257987
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T12:16:45+00:00 2026-06-18T12:16:45+00:00

As they say, true quicksort sorts in-place . So the standard short Haskell code

  • 0

As they say, “true quicksort sorts in-place”. So the standard short Haskell code for quicksort,

quicksort :: Ord a => [a] -> [a]
quicksort []     = []
quicksort (p:xs) = (quicksort lesser) ++ [p] ++ (quicksort greater)
  where
    lesser  = filter (< p) xs
    greater = filter (>= p) xs

what algorithm/computational process is it describing, after all?

It surely isn’t what Tony Hoare devised, lacking its most defining feature, the in-place partitioning algorithm.

(the answer might be well known, but not yet here on SO).


correction: this question is in fact a duplicate: the answer is known on SO after all: cf. Pseudo-quicksort time complexity .

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-18T12:16:46+00:00Added an answer on June 18, 2026 at 12:16 pm

    It’s quicksort for linked lists.

    Yup, this is quicksort, just not in-place. It matches the high-level algorithm for quicksort whilst changing the low-level implementation to match the data structure of linked lists. That’s why it’s quicksort for linked lists.

    I’d prefer to say “quicksort was originally developed to work in-place” than “true quicksort is done in-place”. There are many variants of quicksort including picking pivots randomly to avoid worse-case behaviour etc.. This is a sensible, clear definition of quicksort for linked lists.

    This definition exactly matches how we teach quicksort to 16 year-old maths students in the UK. (We’re teaching algorithms, not programming.) In-place very much obscures the purpose and design, which is why we don’t teach that detail, despite being a million miles from teaching functional programming or linked lists. (That doesn’t change the fact that the pair-swapping trick in-place algorithm is best when you have destructive update arrays.)

    There is a time penalty to this definition, since it traverses the list twice for the two sublists. It’s certainly possible to rewrite this to partition rather than filter, but I assert that that’s optimising rather than changing the fundamental algorithm here, quicksort.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The following code was taken from the book I'm studying and they say that
In java they say don't concatenate Strings, instead you should make a stringbuffer and
Im learning Mockito and in chapter 16 they say you should not use partial
I have read a document that they say: In java there two types of
In the Apple Docs, they say that NSDateFormatter uses the Unicode for spec. I've
In the BubbleLevel example from apple they implement an +initialize method. They say: +initialize
In Odersky et al's Scala book, they say use lists. I haven't read the
Many people have argued about function size. They say that functions in general should
when I read document about asyntask , they say that: should not update UI
In the newest version of ADT (version 20 preview 3), they say that it's

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.