... doesn't give you any side-effect, you're right. It's FP pure. But it is copying the whole array every time :) That's where the problem is.
If you truly improve the performance of your sort, you should really focus on choosing better pivots I picked the first for simplicity
I think you may even set pivot equal 0 each iteration and even then it would be faster than version with ... :)
... ruins this algorithm. Most of algorithms have to be impure to be useful.
So you can dramatically improve it by getting rid of excess copies. I think it'd be better even in educational point of view
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
...
doesn't give you any side-effect, you're right. It's FP pure. But it is copying the whole array every time :) That's where the problem is.I think you may even set pivot equal 0 each iteration and even then it would be faster than version with
...
:)...
ruins this algorithm. Most of algorithms have to be impure to be useful.So you can dramatically improve it by getting rid of excess copies. I think it'd be better even in educational point of view