Im currently working with some data, which is part of a very large data set (height, about 6000 elements per timestep - timestep every minute over days at a time). I need to differentiate between different "layers" in the data per timestep - which im doing with a binary tree, writing a programme in python. The layers are defined by a coefficient, which is part of the data set. The coefficient stays more or less constant when the material is constant, and so when the coefficient changes, it implies a layer ie change in material. So, I take the whole height range (node 0), and find the smallest coefficent in this range. This then splits the layer in 2 - nodes 1 and 2. I then take the range of node 1, and do the same thing (finding the minimum coefficient), which gives me nodes 3 and 4. And so on and so on. It works well, and I have my head wrapped around it quite well. I just got thinking today - is there another data structure that exists that could achieve a similar thing/works in a similar way?