What is hash?
How hash map works?
Different from other col, containers, data structures?
Complexity
http://www.cplusplus.com/reference/stl/
http://stackoverflow.com/questions/40471/differences-between-hashmap-and-hashtable
http://en.wikipedia.org/wiki/Hash_function
Array
Array List
Linked List
Tree Map
Hash Map
Dictionary
(access, insert, delete, space, next)
Speaking of Complexity - Check out this AWESOME PDF OF COMPLEXITY ANALYSIS WIN
Tuesday, January 31, 2012
Monday, January 23, 2012
SVN Repository 2.0 Spike
Instructions found HERE
Copy and paste is messy, so check out the text file HERE
(Note - forgot a message on my first attempt importing a directory.)
Resources:
how to clear history
Copy and paste is messy, so check out the text file HERE
(Note - forgot a message on my first attempt importing a directory.)
Resources:
how to clear history
Friday, January 20, 2012
Take Three - Java IO and Sorting
EDIT-
Jan 21, 2012
It was brought to my attention that there are libraries to implement different sorting algorithms.
I've decided NOT to reinvent the wheel (though I do intend to learn wheel-crafting in case I am ever in a jam).
C++ version of assignment :
NOTE:
Works on my machine, but compiling on trucks/moons doesn't work (doesn't recognize 'strtok' - scope issue? Perhaps there is an alternative? )
Main Resources :
fstream
STL Containers
STL Algorithms
Readtextfile
strtok
stringstream
convert-int-to-string
Looked At (Not so much used)
functors-and-their-uses
Bloom_filter
EmacsCheatSheet
TAKE THREE DRAFT:
So far, Version 3 on its way... Plus a few thoughts:
How can I add color.... hmmm.....
Resources :
http://en.wikipedia.org/wiki/Function_object
http://www.roseindia.net/java/beginners/java-write-to-file.shtml
http://en.wikipedia.org/wiki/Merge_sort
Looked At (not so much used)
http://en.wikipedia.org/wiki/First-class_function
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
Jan 21, 2012
It was brought to my attention that there are libraries to implement different sorting algorithms.
I've decided NOT to reinvent the wheel (though I do intend to learn wheel-crafting in case I am ever in a jam).
C++ version of assignment :
NOTE:
Works on my machine, but compiling on trucks/moons doesn't work (doesn't recognize 'strtok' - scope issue? Perhaps there is an alternative? )
Main Resources :
fstream
STL Containers
STL Algorithms
Readtextfile
strtok
stringstream
convert-int-to-string
Looked At (Not so much used)
functors-and-their-uses
Bloom_filter
EmacsCheatSheet
So far, Version 3 on its way... Plus a few thoughts:
realized I forgot to print a file with the other versions. (Fixed it)- What's better?
- sorting as you add data
- sorting after you've added all data
- What about functors?
- make different functors for different algorithms?
- switch functors and compare times?
How can I add color.... hmmm.....
Resources :
http://en.wikipedia.org/wiki/Function_object
http://www.roseindia.net/java/beginners/java-write-to-file.shtml
http://en.wikipedia.org/wiki/Merge_sort
Looked At (not so much used)
http://en.wikipedia.org/wiki/First-class_function
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
http://docs.oracle.com/javase/6/docs/api/java/util/Comparator.html
http://docs.oracle.com/javase/tutorial/java/javaOO/innerclasses.html
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:
Main Differences:
Primary In-Class Difficulties :
Later Difficulties :
Nouns and Verbs - Data structures and Algorithms
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
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
Thursday, January 19, 2012
ezSVN - Tired of Typing
- CURRENT WORRY ITEM #1:
- CS svn appeared to be 'broken' for ~5 minutes this afternoon. (FREAKOUT)
- SOLUTION FOR WORRY #1:
- Back up for my back up: Project Locker account
- username smgonzal@unm.edu, (pw = left l-based)
- URL: https://pl5.projectlocker.com/smgonzal/Academic/svn
- CURRENT WORRY ITEM #2:
- Tired of typing "svn checkout yadayadayada...." and can never remember the full path.
- SOLUTION FOR WORRY #2:
- svnget.sh - checks out specified svn repository
- possible arguments include ece, rc, cs, domegl, and pl
- next step GUI??? Perhaps???
- CURRENT WORRY ITEM #3:
- Couldn't remember how to svn something without checking out entire repository first...
- SOLUTION FOR WORRY #3:
- svnadd.sh - imports specified file to specified repository WITHOUT checking out first
- svnadd.sh [FILE_TO_IMPORT] [REPOSITORY_ABBREV]
- possible svn arguments include : ece, rc, cs, pl
Resources:
Bash Guides (for those of us too lazy to commit this stuff to memory)
http://tldp.org/LDP/Bash-Beginners-Guide/html/sect_07_01.html
http://www.linuxtutorialblog.com/post/tutorial-conditions-in-bash-scripting-if-statements
People
DJMK
SMG : http://cs.unm.edu/~smgonzal/svnHowTo.txt
File IO ....in Java (!)
GNU nano 2.2.6 File: fileIO.java
//all io stuff we need
import java.io.*;
public class fileIO{
public static void main(String[] args){
//What file will we read?
// File myFile = new File("./textFile.txt");
//create a filereader
FileReader fr = new FileReader("/nfs/student/s/smgonzal/textFile.txt");
//create buffered reader
BufferedReader br = new BufferedReader(fr);
int numWords = 0;
//make string tokenizer
StringTokenizer st;
//pseudo code...
// while (not at end of file)
// {
// buffered reader gets next line
// give it to tokenizer
//
// //what if .,! etc are tokens though... this would be inacccurate
// numWords = numWords + st.countTokens();
// }
System.out.println("number of Words: " + numWords);
}
};
Resources Used:
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/BufferedReader.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html#File(java.lang.String)
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileReader.html
http://www.abbeyworkshop.com/howto/java/readFile/index.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html
looked at (not so much used):
http://www.roseindia.net/java/beginners/java-word-count.shtml
http://stackoverflow.com/questions/5748656/unreported-exception-java-io-filenotfoundexception-must-be-caught-or-declared-t
//all io stuff we need
import java.io.*;
public class fileIO{
public static void main(String[] args){
//What file will we read?
// File myFile = new File("./textFile.txt");
//create a filereader
FileReader fr = new FileReader("/nfs/student/s/smgonzal/textFile.txt");
//create buffered reader
BufferedReader br = new BufferedReader(fr);
int numWords = 0;
//make string tokenizer
StringTokenizer st;
//pseudo code...
// while (not at end of file)
// {
// buffered reader gets next line
// give it to tokenizer
//
// //what if .,! etc are tokens though... this would be inacccurate
// numWords = numWords + st.countTokens();
// }
System.out.println("number of Words: " + numWords);
}
};
Resources Used:
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/BufferedReader.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/File.html#File(java.lang.String)
http://docs.oracle.com/javase/1.4.2/docs/api/java/io/FileReader.html
http://www.abbeyworkshop.com/howto/java/readFile/index.html
http://docs.oracle.com/javase/1.4.2/docs/api/java/util/StringTokenizer.html
looked at (not so much used):
http://www.roseindia.net/java/beginners/java-word-count.shtml
http://stackoverflow.com/questions/5748656/unreported-exception-java-io-filenotfoundexception-must-be-caught-or-declared-t
Wednesday, January 18, 2012
Subscribe to:
Comments (Atom)