coding fn for conditional fp-tree