diff options
author | RossTheRoss <msattr@gmail.com> | 2019-12-08 11:46:01 -0600 |
---|---|---|
committer | RossTheRoss <msattr@gmail.com> | 2019-12-08 11:46:01 -0600 |
commit | 39cd2060dcc056f5fdd1733bc34fe5252e3b0b17 (patch) | |
tree | 3098dc72f1c5960edfe9d892acff0603a8956382 /csci1913/Java/project3/project3_strap012.java | |
parent | Start & Finish final Lab (13) (diff) | |
download | homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.tar homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.tar.gz homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.tar.bz2 homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.tar.lz homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.tar.xz homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.tar.zst homework-39cd2060dcc056f5fdd1733bc34fe5252e3b0b17.zip |
Start project
Diffstat (limited to 'csci1913/Java/project3/project3_strap012.java')
-rw-r--r-- | csci1913/Java/project3/project3_strap012.java | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/csci1913/Java/project3/project3_strap012.java b/csci1913/Java/project3/project3_strap012.java new file mode 100644 index 0000000..c8a4719 --- /dev/null +++ b/csci1913/Java/project3/project3_strap012.java @@ -0,0 +1,53 @@ +package project3; + +class AnagramTree { + private TreeNode head; + private class TreeNode { + private byte[] summary; + private WordNode words; + private TreeNode left, right; + private TreeNode(String word) { + summary = stringToSummary(word); + // words = new WordNode(word); + left = null; right = null; + } + } + + private class WordNode { + private String word; + private WordNode next; + private WordNode(String word) { + this.word = word; + next = null; + } + } + + public AnagramTree() { + head = new TreeNode("e"); + } + + public void add (String word) { + + } + + public void anagrams() { + + } + + private int compareSummaries(byte[] left, byte[] right) { + for (int i = 0; i < 25; i++) { + if (left[i] != right[i]) { + return left[i] - right[i]; + } + } + return 0; + } + + private byte[] stringToSummary(String word) { + byte[] temp = new byte[26]; + for (byte i = 0; i < word.length(); i++) { + temp[i] = (byte) (word.charAt(i) - ('a' + i)); + } + return temp; + } +}
\ No newline at end of file |