diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..35eb1dd --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Main.java b/src/Main.java index 930198c..9db5d88 100644 --- a/src/Main.java +++ b/src/Main.java @@ -11,5 +11,25 @@ public static void main(String[] args) { // for you, but you can always add more by pressing . System.out.println("i = " + i); } + + boolean result = isUnique("always"); + System.out.println(result); + } + + public static boolean isUnique(String word) { + private CharTreeNode add(CharTreeNode root, char value){ + if (root == null) { + root = new CharTreeNode(value); + }else if (value <= root.data) { + root.left = add(root.left, value); + }else { + root.right = add(root.right, value); + } + return root; + } + private boolean contains(CharTreeNode root, char value){ + return root != null && (root.data == value || (value < roo.data && contains (root.left, value)) || (value >= root.data && contains(root.left, value))); + } + return false; } } \ No newline at end of file