private static void countWords(String file,String count, String struct) {
    	DataCounter<String> counter = null;
    	// divide into several situations and create different structures
    	if(count.equals("-b"))
    		counter= new BinarySearchTree<String>(new StringComparator());
    	else if(count.equals("-m"))
    		counter = new MoveToFrontList<String>(new StringComparator());
    	else if(count.equals("-a"))
    		counter = new AVLTree<String>(new StringComparator());
    	else
    		System.err.println("error");
    	
    	try {
            FileWordReader reader = new FileWordReader(file);
            String word = reader.nextWord();
            while (word != null) {
                counter.incCount(word);
                word = reader.nextWord();
            }
        } catch (IOException e) {
            System.err.println("Error processing " + file + " " + e);
            System.exit(1);
        }
    	DataCount<String>[] counts = getCountsArray(counter);
    	// get different info and use different method of sorting
        if(struct.equals("-is"))
			insertionSort(counts, new DataCountStringComparator());
        else if(struct.equals("-hs"))
        	heapSort(counts, new DataCountStringComparator());	
        else
        	System.err.println("error");
        for (DataCount<String> c : counts)
            System.out.println(c.count + " \t" + c.data);
    }