Friday, January 20, 2012

Take Two - Java File Reading

I got the bare basics working (see SVN ) but wanted to try storing words for later...

Version 2.0 <-CLK IT:
  • gives Total word count
  • gives unique word count
  • stores words in hashtable --(currently re-evaluating this decision... not sold)

Main Differences:
  • It runs.
  • Imported only required header files
  • Stores words in Hashtable if unique

Primary In-Class Difficulties :
  • Lack of Java programming experience
    • Main Issue = how to compile and run???
    • javac FILENAME.java
    • java FILENAME          //NO '.java' HERE!!!!!!
  • Unfamiliar with Classes/Data structures/Variables/ Java Quirks
    • Examples:
      • must include Boolean (not a given like in c++)
      • .java file needs to be a class, not just have main

Later Difficulties :

Nouns and Verbs - Data structures and Algorithms
  •  How to store the data?
    • I want to find the most commonly used words - I want a hierarchy, not just a single string-value pair (<-boring)
    • Considered Hash tables
      • How do I index or access in any order when my keys are non-numeric? Enum, but...eh. Shouldn't it be simpler?
    • Considering Vector of String-Int pairs
      • Could methodically insert
  • How to sort the data?
    • Algorithms
    • Heap sort? Merge sort? Some....Sort? 
      • n log(n)  for heap/merge

Version Three : The SORT-o-MATIC - coming soon to a blog near you.


References:
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Hashtable.html
http://www.java-samples.com/showtutorial.php?tutorialid=375 --not as helpful as I thought
http://en.wikipedia.org/wiki/Sorting_algorithm --WAAY too much I don't know here. Wow.
http://today.java.net/pub/a/today/2006/11/07/nuances-of-java-5-for-each-loop.html -- not working as expected
http://stackoverflow.com/questions/968347/can-a-java-file-have-more-than-one-class
http://stackoverflow.com/questions/513832/how-do-i-compare-strings-in-java
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/Vector.html

No comments:

Post a Comment