# All possible Red Black Trees with this set {1,2,3,4,5}

I have to write all possible Red Black Trees which can represent these 5 numbers {1,2,3,4,5}.

Now we have 120 ways to write 1,2,3,4,5

{1,2,3,4,5} {1,2,3,5,4} {1,2,4,3,5} {1,2,4,5,3} {1,2,5,3,4}
{1,2,5,4,3} {1,3,2,4,5} {1,3,2,5,4} {1,3,4,2,5} {1,3,4,5,2}
{1,3,5,2,4} {1,3,5,4,2} {1,4,2,3,5} {1,4,2,5,3} {1,4,3,2,5}
{1,4,3,5,2} {1,4,5,2,3} {1,4,5,3,2} {1,5,2,3,4} {1,5,2,4,3}
{1,5,3,2,4} {1,5,3,4,2} {1,5,4,2,3} {1,5,4,3,2} {2,1,3,4,5}
{2,1,3,5,4} {2,1,4,3,5} {2,1,4,5,3} {2,1,5,3,4} {2,1,5,4,3}
{2,3,1,4,5} {2,3,1,5,4} {2,3,4,1,5} {2,3,4,5,1} {2,3,5,1,4}
{2,3,5,4,1} {2,4,1,3,5} {2,4,1,5,3} {2,4,3,1,5} {2,4,3,5,1}
{2,4,5,1,3} {2,4,5,3,1} {2,5,1,3,4} {2,5,1,4,3} {2,5,3,1,4}
{2,5,3,4,1} {2,5,4,1,3} {2,5,4,3,1} {3,1,2,4,5} {3,1,2,5,4}
{3,1,4,2,5} {3,1,4,5,2} {3,1,5,2,4} {3,1,5,4,2} {3,2,1,4,5}
{3,2,1,5,4} {3,2,4,1,5} {3,2,4,5,1} {3,2,5,1,4} {3,2,5,4,1}
{3,4,1,2,5} {3,4,1,5,2} {3,4,2,1,5} {3,4,2,5,1} {3,4,5,1,2}
{3,4,5,2,1} {3,5,1,2,4} {3,5,1,4,2} {3,5,2,1,4} {3,5,2,4,1}
{3,5,4,1,2} {3,5,4,2,1} {4,1,2,3,5} {4,1,2,5,3} {4,1,3,2,5}
{4,1,3,5,2} {4,1,5,2,3} {4,1,5,3,2} {4,2,1,3,5} {4,2,1,5,3}
{4,2,3,1,5} {4,2,3,5,1} {4,2,5,1,3} {4,2,5,3,1} {4,3,1,2,5}
{4,3,1,5,2} {4,3,2,1,5} {4,3,2,5,1} {4,3,5,1,2} {4,3,5,2,1}
{4,5,1,2,3} {4,5,1,3,2} {4,5,2,1,3} {4,5,2,3,1} {4,5,3,1,2}
{4,5,3,2,1} {5,1,2,3,4} {5,1,2,4,3} {5,1,3,2,4} {5,1,3,4,2}
{5,1,4,2,3} {5,1,4,3,2} {5,2,1,3,4} {5,2,1,4,3} {5,2,3,1,4}
{5,2,3,4,1} {5,2,4,1,3} {5,2,4,3,1} {5,3,1,2,4} {5,3,1,4,2}
{5,3,2,1,4} {5,3,2,4,1} {5,3,4,1,2} {5,3,4,2,1} {5,4,1,2,3}
{5,4,1,3,2} {5,4,2,1,3} {5,4,2,3,1} {5,4,3,1,2} {5,4,3,2,1}


But this is too much, I need to construct 120 RBT and then take out the ones which are the same, is there any tip how can I take some out immediately before even trying to construct the RBT for them ?