***************************************************************************** * www.FindStat.org - The Combinatorial Statistic Finder * * * * Copyright (C) 2019 The FindStatCrew * * * * This information is distributed in the hope that it will be useful, * * but WITHOUT ANY WARRANTY; without even the implied warranty of * * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. * ***************************************************************************** ----------------------------------------------------------------------------- Statistic identifier: St000167 ----------------------------------------------------------------------------- Collection: Ordered trees ----------------------------------------------------------------------------- Description: The number of leaves of an ordered tree. This is the number of nodes which do not have any children. ----------------------------------------------------------------------------- References: ----------------------------------------------------------------------------- Code: def statistic(t): stack = [t] nl = 0 while len(stack)!=0: tree = stack.pop() if len(tree) == 0: nl+=1 else: stack.extend(tree) return nl ----------------------------------------------------------------------------- Statistic values: [[]] => 1 [[],[]] => 2 [[[]]] => 1 [[],[],[]] => 3 [[],[[]]] => 2 [[[]],[]] => 2 [[[],[]]] => 2 [[[[]]]] => 1 [[],[],[],[]] => 4 [[],[],[[]]] => 3 [[],[[]],[]] => 3 [[],[[],[]]] => 3 [[],[[[]]]] => 2 [[[]],[],[]] => 3 [[[]],[[]]] => 2 [[[],[]],[]] => 3 [[[[]]],[]] => 2 [[[],[],[]]] => 3 [[[],[[]]]] => 2 [[[[]],[]]] => 2 [[[[],[]]]] => 2 [[[[[]]]]] => 1 [[],[],[],[],[]] => 5 [[],[],[],[[]]] => 4 [[],[],[[]],[]] => 4 [[],[],[[],[]]] => 4 [[],[],[[[]]]] => 3 [[],[[]],[],[]] => 4 [[],[[]],[[]]] => 3 [[],[[],[]],[]] => 4 [[],[[[]]],[]] => 3 [[],[[],[],[]]] => 4 [[],[[],[[]]]] => 3 [[],[[[]],[]]] => 3 [[],[[[],[]]]] => 3 [[],[[[[]]]]] => 2 [[[]],[],[],[]] => 4 [[[]],[],[[]]] => 3 [[[]],[[]],[]] => 3 [[[]],[[],[]]] => 3 [[[]],[[[]]]] => 2 [[[],[]],[],[]] => 4 [[[[]]],[],[]] => 3 [[[],[]],[[]]] => 3 [[[[]]],[[]]] => 2 [[[],[],[]],[]] => 4 [[[],[[]]],[]] => 3 [[[[]],[]],[]] => 3 [[[[],[]]],[]] => 3 [[[[[]]]],[]] => 2 [[[],[],[],[]]] => 4 [[[],[],[[]]]] => 3 [[[],[[]],[]]] => 3 [[[],[[],[]]]] => 3 [[[],[[[]]]]] => 2 [[[[]],[],[]]] => 3 [[[[]],[[]]]] => 2 [[[[],[]],[]]] => 3 [[[[[]]],[]]] => 2 [[[[],[],[]]]] => 3 [[[[],[[]]]]] => 2 [[[[[]],[]]]] => 2 [[[[[],[]]]]] => 2 [[[[[[]]]]]] => 1 [[],[],[],[],[],[]] => 6 [[],[],[],[],[[]]] => 5 [[],[],[],[[]],[]] => 5 [[],[],[],[[],[]]] => 5 [[],[],[],[[[]]]] => 4 [[],[],[[]],[],[]] => 5 [[],[],[[]],[[]]] => 4 [[],[],[[],[]],[]] => 5 [[],[],[[[]]],[]] => 4 [[],[],[[],[],[]]] => 5 [[],[],[[],[[]]]] => 4 [[],[],[[[]],[]]] => 4 [[],[],[[[],[]]]] => 4 [[],[],[[[[]]]]] => 3 [[],[[]],[],[],[]] => 5 [[],[[]],[],[[]]] => 4 [[],[[]],[[]],[]] => 4 [[],[[]],[[],[]]] => 4 [[],[[]],[[[]]]] => 3 [[],[[],[]],[],[]] => 5 [[],[[[]]],[],[]] => 4 [[],[[],[]],[[]]] => 4 [[],[[[]]],[[]]] => 3 [[],[[],[],[]],[]] => 5 [[],[[],[[]]],[]] => 4 [[],[[[]],[]],[]] => 4 [[],[[[],[]]],[]] => 4 [[],[[[[]]]],[]] => 3 [[],[[],[],[],[]]] => 5 [[],[[],[],[[]]]] => 4 [[],[[],[[]],[]]] => 4 [[],[[],[[],[]]]] => 4 [[],[[],[[[]]]]] => 3 [[],[[[]],[],[]]] => 4 [[],[[[]],[[]]]] => 3 [[],[[[],[]],[]]] => 4 [[],[[[[]]],[]]] => 3 [[],[[[],[],[]]]] => 4 [[],[[[],[[]]]]] => 3 [[],[[[[]],[]]]] => 3 [[],[[[[],[]]]]] => 3 [[],[[[[[]]]]]] => 2 [[[]],[],[],[],[]] => 5 [[[]],[],[],[[]]] => 4 [[[]],[],[[]],[]] => 4 [[[]],[],[[],[]]] => 4 [[[]],[],[[[]]]] => 3 [[[]],[[]],[],[]] => 4 [[[]],[[]],[[]]] => 3 [[[]],[[],[]],[]] => 4 [[[]],[[[]]],[]] => 3 [[[]],[[],[],[]]] => 4 [[[]],[[],[[]]]] => 3 [[[]],[[[]],[]]] => 3 [[[]],[[[],[]]]] => 3 [[[]],[[[[]]]]] => 2 [[[],[]],[],[],[]] => 5 [[[[]]],[],[],[]] => 4 [[[],[]],[],[[]]] => 4 [[[[]]],[],[[]]] => 3 [[[],[]],[[]],[]] => 4 [[[[]]],[[]],[]] => 3 [[[],[]],[[],[]]] => 4 [[[],[]],[[[]]]] => 3 [[[[]]],[[],[]]] => 3 [[[[]]],[[[]]]] => 2 [[[],[],[]],[],[]] => 5 [[[],[[]]],[],[]] => 4 [[[[]],[]],[],[]] => 4 [[[[],[]]],[],[]] => 4 [[[[[]]]],[],[]] => 3 [[[],[],[]],[[]]] => 4 [[[],[[]]],[[]]] => 3 [[[[]],[]],[[]]] => 3 [[[[],[]]],[[]]] => 3 [[[[[]]]],[[]]] => 2 [[[],[],[],[]],[]] => 5 [[[],[],[[]]],[]] => 4 [[[],[[]],[]],[]] => 4 [[[],[[],[]]],[]] => 4 [[[],[[[]]]],[]] => 3 [[[[]],[],[]],[]] => 4 [[[[]],[[]]],[]] => 3 [[[[],[]],[]],[]] => 4 [[[[[]]],[]],[]] => 3 [[[[],[],[]]],[]] => 4 [[[[],[[]]]],[]] => 3 [[[[[]],[]]],[]] => 3 [[[[[],[]]]],[]] => 3 [[[[[[]]]]],[]] => 2 [[[],[],[],[],[]]] => 5 [[[],[],[],[[]]]] => 4 [[[],[],[[]],[]]] => 4 [[[],[],[[],[]]]] => 4 [[[],[],[[[]]]]] => 3 [[[],[[]],[],[]]] => 4 [[[],[[]],[[]]]] => 3 [[[],[[],[]],[]]] => 4 [[[],[[[]]],[]]] => 3 [[[],[[],[],[]]]] => 4 [[[],[[],[[]]]]] => 3 [[[],[[[]],[]]]] => 3 [[[],[[[],[]]]]] => 3 [[[],[[[[]]]]]] => 2 [[[[]],[],[],[]]] => 4 [[[[]],[],[[]]]] => 3 [[[[]],[[]],[]]] => 3 [[[[]],[[],[]]]] => 3 [[[[]],[[[]]]]] => 2 [[[[],[]],[],[]]] => 4 [[[[[]]],[],[]]] => 3 [[[[],[]],[[]]]] => 3 [[[[[]]],[[]]]] => 2 [[[[],[],[]],[]]] => 4 [[[[],[[]]],[]]] => 3 [[[[[]],[]],[]]] => 3 [[[[[],[]]],[]]] => 3 [[[[[[]]]],[]]] => 2 [[[[],[],[],[]]]] => 4 [[[[],[],[[]]]]] => 3 [[[[],[[]],[]]]] => 3 [[[[],[[],[]]]]] => 3 [[[[],[[[]]]]]] => 2 [[[[[]],[],[]]]] => 3 [[[[[]],[[]]]]] => 2 [[[[[],[]],[]]]] => 3 [[[[[[]]],[]]]] => 2 [[[[[],[],[]]]]] => 3 [[[[[],[[]]]]]] => 2 [[[[[[]],[]]]]] => 2 [[[[[[],[]]]]]] => 2 [[[[[[[]]]]]]] => 1 ----------------------------------------------------------------------------- Created: Nov 09, 2013 at 00:51 by Viviane Pons ----------------------------------------------------------------------------- Last Updated: May 20, 2016 at 21:19 by Martin Rubey