public static FunctionBitPatternsGTree createTree(List<InstructionSequence> instSeqs,
			PatternType patternType, PercentageFilter percentageFilter) {
		FunctionBitPatternsGTreeRootNode root = new FunctionBitPatternsGTreeRootNode();
		Map<GTreeNode, Map<String, GTreeNode>> nodeMap =
			new HashMap<GTreeNode, Map<String, GTreeNode>>();

		//for each node, want to find the children quickly instead of iterating through the 
		//list of children
		//need a map nodes - > keys -> nodes
		for (InstructionSequence currentSeq : instSeqs) {
			GTreeNode currentNode = root;
			int maxLevel = currentSeq.getInstructions().length;
			String[] currentInsts = currentSeq.getInstructions();
			for (int level = 0; level < maxLevel; level++) {
				StringBuilder keyBuilder = new StringBuilder();

				if (currentInsts[level] == null) {
					break;//out of instructions for this sequence
				}

				keyBuilder.append(currentSeq.getInstructions()[level]);
				keyBuilder.append(":");
				keyBuilder.append(Integer.toString(currentSeq.getSizes()[level]));
				String key = keyBuilder.toString();

				//make sure there is a map keys -> nodes for the current node
				Map<String, GTreeNode> currentNodeChildMap = nodeMap.get(currentNode);
				if (nodeMap.get(currentNode) == null) {
					currentNodeChildMap = new HashMap<String, GTreeNode>();
					nodeMap.put(currentNode, currentNodeChildMap);
				}
				//check if the current node has a child of the appropriate type
				//if it does: increment the count and proceed
				//otherwise: create a new node, and to map and set as a child
				GTreeNode currentNodeChild = currentNodeChildMap.get(key);
				if (currentNodeChild == null) {
					currentNodeChild = new FunctionBitPatternsGTreeNode(key,
						currentSeq.getInstructions()[level], currentSeq.getSizes()[level]);
					((FunctionBitPatternsGTreeNode) currentNodeChild).incrementCount(1);
					currentNodeChildMap.put(key, currentNodeChild);
					currentNode.addNode(currentNodeChild);
				}
				else {
					((FunctionBitPatternsGTreeNode) currentNodeChild).incrementCount(1);
				}
				currentNode = currentNodeChild;
			}
		}
		FunctionBitPatternsGTree tree = new FunctionBitPatternsGTree(root, patternType);
		tree.setTotalNum(instSeqs.size());
		root.sort();
		root.filterByPercentage(percentageFilter);
		return tree;
	}
Creates a tree for a list of instructions of a certain type and applies a percentage filter.
@param instSeqs {@link InstructionSequence}s which will make of the tree
@param patternType {@link PatternType} of the instructions
@param percentageFilter {@link PercentageFilter} to apply
@return newly-created tree
Ghidra/Features/BytePatterns/src/main/java/ghidra/bitpatterns/info/FunctionBitPatternsGTree.java