Skip to content

Commit

Permalink
Update ternary_trees.java
Browse files Browse the repository at this point in the history
  • Loading branch information
Sarvjeet1999 authored Sep 14, 2020
1 parent 17f0925 commit 715d006
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ternary_trees.java
Original file line number Diff line number Diff line change
Expand Up @@ -48,15 +48,16 @@ public static trieNode delete(trieNode root,String word,int i)
char ch=word.charAt(i);
int n=word.length();

if(ch<root.data) return delete(root.left,word,i);
else if(ch>root.data) return delete(root.right,word,i);
if(ch<root.data) root.left = delete(root.left,word,i);
else if(ch>root.data) root.right = delete(root.right,word,i);

else if(ch==root.data)
{
if(i==n-1)
{
if(root.eow==false) return root;
if(root.eow==true) root.eow=false;
//if(root.eow==true) root.eow=false;
root.eow=false;
}
else root.eq=delete(root.eq,word,i+1);

Expand Down

0 comments on commit 715d006

Please sign in to comment.