Introduction to Java Programming and Data Structures, Comprehensive Version Plus MyProgrammingLab with Pearson EText -- Access Card Package
Question
Book Icon
Chapter 25, Problem 25.17PE
Program Plan Intro

Program Plan:

  • Include the required import statement.
  • Define the main class.
    • Declare the necessary variables
    • Using start initialize the required.
      • Create border pane, tree view, text field and button.
      • Set the tree view as center, alignment.
      • Add an action event to the button.
      • Create a scene and place the pane in the stage.
      • Set the title.
      • Place the scene in the stage.
      • Display the stage.
    • Define the main method using public static main.
      • Initialize the call.
    • Define “decode” method.
      • Declare the variable
      • Check the length of the “bits”.
        • If the “bits” value is “0” set that value into left subtree, if the “bits” value is “1” set the value into right subtree.
      • If the left subtree is null, leaf is detected and restart from the root.
      • Return the “result”.
    • Define “encode” method.
      • Declare and set the value.
      • Check the length of the “text”.
        • Calculate the result.
        • Return the “result”.
    • Define “getCode” method.
      • Check the “root” value is null
      • The variable “codes” is declared and allocates memory for that variable.
      • Call the “assignCode” method.
      • Return the “codes” value.
    • Define “assignCode” method.
      • Check if root of left subtree value is not null.
        • If the condition is true, calculate the left and right subtree value and call the “assignCode” method with the respective parameters.
      • Otherwise calculate the “root” element value.
    • Define “getHuffmanTree” method.
      • Create a heap to hold the trees.
      • Add the values into the heap tree.
      • If the heap tree is greater than 1, remove the smallest and next smallest weight from the tree and combine the two trees.
      • Finally return the tree.
    • Define “getCharacterFrequency” method.
      • Declare the variable.
      • The try-catch block is used to check the input file is present or not and count the number of characters in that file.
      • Return the total counts.
    • Define “TreeView” class.
      • Declare the required variables.
      • Define the constructor.
      • Define the “setTree” method.
        • Add the value.
        • Call the “repaint” method.
      • Define the “repaint” method.
        • Clear the pane
        • Display the tree recursively.
    • Define the “displayTree” method.
      • Check if the left node value is not equal to null.
        • Draw a line to the up node.
        • Draw the left subtree recursively.
      • Check if the right node value is not equal to null.
        • Draw a line to the down node.
        • Draw the left subtree recursively.
      • Display the node.
    • Define “Tree” class.
      • Declare the variable.
      • Create a tree with two subtrees,
      • Create a tree containing a leaf node.
      • Compare the trees based on their weights.
    • Define “Node” class.
      • Declare the required variables.
      • Create a default constructor.
      • Create a node with the particular weight and character.
    • Define “Heap” class.
      • Create the object for the ArrayList
      • Create the default constructor.
      • Create a heap from an array of objects.
      • Define “add” method.
        • Add the new object into the heap.
        • Check the “currentIndex” value is greater than 0.
          • Swap if the current object is greater than its parents.
          • Assign “parentIndex” value into “currentIndex” variable.
      • Define “remove” method.
        • Check the condition and remove the root from the heap.
        • Declare and compute the left and right child index.
        • Then find the maximum value between two children.
        • Swap if the current node is less than maximum value.
        • Finally return the value.

Blurred answer
Students have asked these similar questions
4G+ Vo) % 1.1. LTE1 : Q B NIS شوز طبي ۱:۱۷ کا A X حاز هذا على إعجاب Mohamed Bashar. MEDICAL SHOE شوز طبي ممول . اقوى عرض بالعراق بلاش سعر القطعة ١٥ الف سعر القطعتين ٢٥ الف سعر 3 قطع ٣٥ الف القياسات : 40-41-42-43-44- افحص وكدر ثم ادفع خدمة التوصيل 5 الف لكافة محافظات العراق ופרסם BNI SH ופרסם DON JU WORLD DON JU MORISO DON JU إرسال رسالة III Messenger التواصل مع شوز طبي تعليق باسم اواب حمید
A manipulator is identified by the following table of parameters and variables:a. Obtain the transformation matrices between adjacent coordinate frames and calculate the global transformation matrix.
Which tool takes the 2 provided input datasets and produces the following output dataset? Input 1: Record First Last Output: 1 Enzo Cordova Record 2 Maggie Freelund Input 2: Record Frist Last MI ? First 1 Enzo Last MI Cordova [Null] 2 Maggie Freelund [Null] 3 Jason Wayans T. 4 Ruby Landry [Null] 1 Jason Wayans T. 5 Devonn Unger [Null] 2 Ruby Landry [Null] 6 Bradley Freelund [Null] 3 Devonn Unger [Null] 4 Bradley Freelund [Null] OA. Append Fields O B. Union OC. Join OD. Find Replace Clear selection
Knowledge Booster
Background pattern image
Similar questions
SEE MORE QUESTIONS
Recommended textbooks for you
Text book image
C++ Programming: From Problem Analysis to Program...
Computer Science
ISBN:9781337102087
Author:D. S. Malik
Publisher:Cengage Learning
Text book image
Programming Logic & Design Comprehensive
Computer Science
ISBN:9781337669405
Author:FARRELL
Publisher:Cengage
Text book image
EBK JAVA PROGRAMMING
Computer Science
ISBN:9781337671385
Author:FARRELL
Publisher:CENGAGE LEARNING - CONSIGNMENT
Text book image
C++ for Engineers and Scientists
Computer Science
ISBN:9781133187844
Author:Bronson, Gary J.
Publisher:Course Technology Ptr
Text book image
Microsoft Visual C#
Computer Science
ISBN:9781337102100
Author:Joyce, Farrell.
Publisher:Cengage Learning,
Text book image
Programming with Microsoft Visual Basic 2017
Computer Science
ISBN:9781337102124
Author:Diane Zak
Publisher:Cengage Learning