public Node search(Problem problem, State initialState) { 
		// Make a node with the initial problem state
		Node firstNode= new Node(initialState);
		// Insert node into the frontier data structure
		List<Node> frontier= new ArrayList<Node>();
		frontier.add(firstNode);
		// (Variables needed later on)
		List<Node> successorNodes= null;
		boolean solutionFound= false;
		// WHILE final state not found AND frontier is NOT empty DO
		while(!solutionFound && !frontier.isEmpty()){
			// Remove first node from the frontier
			firstNode= frontier.remove(0);
			// IF node contains final state
			if(problem.isFinalState(firstNode.getState()))
				// THEN final state found
				solutionFound= true;
			// IF node does not contain final state
			else
			{
				// EXPAND node's state
				successorNodes = expand(firstNode, problem);
				// Insert successor nodes into the frontier
				if(successorNodes != null && !successorNodes.isEmpty())
					frontier.addAll(successorNodes);
				// Sort frontier in ascending order of f(n)
				Collections.sort(frontier);
			}
		}
		// IF final state found THEN return sequence of actions found
		// ELSE return "solution not found"
		return solutionFound ? firstNode : null;
	}