• 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); } }
Computer Science
  • Stacey Warren - Expert brainly.com
Hey! We 've verified this expert answer for you, click below to unlock the details :)
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
  • schrodinger
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!

Looking for something else?

Not the answer you are looking for? Search for more explanations.