Ask your own question, for FREE!
Computer Science 5 Online
OpenStudy (hyroko):

Hello, I have an issue with a recursive method I have in my program, which when called on the file I need to call it on, it recurses too deep and gives me a stack overflow error. With this program, I need to read in a file, convert capital letters to lowercase, trim all spaces and all non-alphabetical symbols, then create a binary tree and convert that binary tree into a huffman tree using a priority queue. Then I need to output the resulting condensed file, and compare the size of the file with the original. Here's the code I'm having trouble with currently. public static BinaryTree readBinaryTree( Scanner scan){ //read a line and trim leading and trailing spaces then creates Binary tree. String data = scan.next(); if(data.equals("null")){ return null; } else{ BinaryTree leftTree = readBinaryTree(scan); BinaryTree rightTree = readBinaryTree(scan); return new BinaryTree<>(data, leftTree, rightTree); } }

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Latest Questions
Arriyanalol: i need help
11 hours ago 7 Replies 1 Medal
Arriyanalol: CONGRATS to me
14 hours ago 8 Replies 2 Medals
Legomaster346: What colleges are good that are near Arab Alabama?
1 week ago 5 Replies 0 Medals
Arriyanalol: i need help
1 week ago 6 Replies 2 Medals
Arizona: does anyone know the percentage rate of 30,000 and 40,000
1 week ago 0 Replies 0 Medals
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!