文章列表
非原创,稍做总结,保存起来以便日后查看,希望能帮到大家。
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.Stack;
/**
* A BinaryTree consists of "nodes"--each "node" is itself a BinaryTree. Each
* node has a parent (unless it is the root) ...
public class LCSProblem
{
public static void main(String[] args)
{
String[] x = {"","A", "B", "C", "B", "D", "A", "B"};
String[] y = {"","B", "D", "C&q ...
/*************************************************************************
* Compilation: javac Knapsack.java
* Execution: java Knapsack N W
*
* Generates an instance of the 0/1 knapsack problem with N items
* and maximum weight W and solves it in time and space proportional
* to N * W ...
class QueensApp
{
private int[] intArray;
private int nElems;
private int count;
public QueensApp(int len)
{
intArray = new int[len];
nElems = len;
}
public int getCount()
{
return this.count;
}
private boolean isConsistent(int n)
{
for(int i = 0; i < n; i++ ...