private List<Itemset> aprioriGen(List<Itemset> seed, int k) {
		
		List<Itemset> candidateList;
		
		// Populate candidate large itemsets by either a sql query
		// or hand-written main-memory join algorithm
		if (usesql) {
			DBAccess db = new DBAccess();
			//this returns a new candidate list
			candidateList = db.populateLargeItemSet(seed, k);
		}
		else {
			// do the join in the memory, it returns a new candidate list 
			candidateList = populateLargeItemSet(seed, k);
		}
		
		/* 
		 * Optimize by evaluating subsets of each candidate of size k-1. If any candidate's subsets 
		 * are not contained in the seed, delete that candidate
		 */
		List<Itemset> removeList = new ArrayList<Itemset>();
		for (Itemset is : candidateList)
		{
			boolean remove = false;
			List<Itemset> subsets = populateSubsets(is, k);
			
			for (Itemset subsetIs : subsets) {
				boolean isFound = false;
				for (Itemset seedIs : seed) {
					if (seedIs.containsSameItems(subsetIs)) {
						isFound = true;
						break;
					}		
				}
				if (!isFound) {
					remove = true;
					break;
				}
			}
			
			if (remove)
				removeList.add(is);
		}
		
		candidateList.removeAll(removeList);
		
		return candidateList;
	}