Sort list from the middle


I must admit that I don’t have so many ideas how to solve my issue, therefore I have no code attached. I would be grateful for any suggestions

For example I have this list of numbers:

1, 2, 3, 4, 5, 6, 7, 8

I would like to sort list to a tree in the following way:

[1,8] [2,7] [3,6] [4,5]

So the first and last item will be connected in one branch of the tree, then second and next-to-last in second branch of the tree and so on.

Do you have any ideas?

Hi Alena,

I am not sure , if I understood your problem correctly.
But the simplest way would be to split your list in half , reverse the second list and weave them together ( with grafted inputs, so you get a tree).


2 Likes (5.4 KB)


Thank you so much!!!