user2890234 February 2016

Sort nested array by content

I have a data structude ST that contains an array of entities of ST.

struct ST {
    ST[];
}

I need to sort it by deep-value.

For example i have an array of ST: [A { B, C, D }, B { C, D }, C, D { E }, E, F]

And i want to get result like this: [E, D, C, B, E, F, A]

Can somebody help me?

Answers


bnm February 2016

The solution depends on what language you are using however the basic idea remains the same. The idea is that each struct can have a value assigned which can then be used for sorting.

A similar question was asked here: Sort ArrayList of custom Objects by property

I hope this helps, but generally you should try asking questions in greater detail

Post Status

Asked in February 2016
Viewed 1,348 times
Voted 11
Answered 1 times

Search




Leave an answer