Skip to main content
edited title
Link
Zesar
  • 689
  • 1
  • 4
  • 6

Quick-sort mya linked list?

Tweeted twitter.com/StackCodeReview/status/696687594097221632
deleted 9 characters in body
Source Link
Joseph
  • 25.4k
  • 2
  • 26
  • 37

The linked list works well and is basically wrapping two variables in a closure in an object, the variables are "head" and "rest" (think LISP´s car and cdr).

  I have also added some useful functions like map, fold, forEach, merge, reverse and sort among others.

All work well except for sort. as it only works with the default compare-function. I know that the reason is of how i append the list back together after a comparison.

Anyone has a better ideaAll work well except for sort. As it only works with the default compare-function. I know that the reason is of how this might be done? merge-sort?i append the list back together after a comparison.

Anyone has a better idea of how this might be done? merge-sort? Also suggestions on other parts of the project are welcome! :-)

The linked list works well and is basically wrapping two variables in a closure in an object, the variables are "head" and "rest" (think LISP´s car and cdr).

  I have also added some useful functions like map, fold, forEach, merge, reverse and sort among others.

All work well except for sort. as it only works with the default compare-function. I know that the reason is of how i append the list back together after a comparison.

Anyone has a better idea of how this might be done? merge-sort?

Also suggestions on other parts of the project are welcome! :-)

The linked list works well and is basically wrapping two variables in a closure in an object, the variables are "head" and "rest" (think LISP´s car and cdr). I have also added some useful functions like map, fold, forEach, merge, reverse and sort among others.

All work well except for sort. As it only works with the default compare-function. I know that the reason is of how i append the list back together after a comparison.

Anyone has a better idea of how this might be done? merge-sort? Also suggestions on other parts of the project are welcome! :-)

edited tags
Link
Quill
  • 12.1k
  • 5
  • 41
  • 94
Source Link
Zesar
  • 689
  • 1
  • 4
  • 6
Loading