Is it possible for you to write the whole code for this and not just the structure
Fantastic news! We've Found the answer you've been seeking!
Question:
Is it possible for you to write the whole code for this and not just the structure outline? The actual specifications are listed here.
Transcribed Image Text:
DESCRIPTION: In this assignment you are required to implement prefix-free codes using binary trees with linked nodes. For this, you have to write the Java classes BinTree and TNode in the same package. Class BinTree uses binary trees with linked nodes to represent prefix-free codes. Class TNode represents the nodes of the binary tree. You also need to perform the time and space complexity analysis of your algorithms. You are not allowed to use any predefined Java methods other than those de- fined in the classes java.util.ArrayList, java.lang.String and java.lang. Math. DEFINITIONS: A prefix-free code (used in data compression) is a set of binary sequences (sequences of 0's and 1's) such that none of them is a prefix of another. For instance, the set A = {0, 10, 110, 111} is a prefix-free code. On the other hand, the set {0, 10, 100, 111} is not a prefix-free code because the sequence 10 is a prefix of 100. The elements of the prefix-free code are referred to as (binary) codewords. A prefix-free code can be used to encode a sequence of symbols from an alphabet B (i.c., convert the sequence of symbols into a bitstream) as follows. Each symbol in alphabet B = {0, c1, c2,,cn} is assigned a distinct binary codeword. Then we can encode any sequence of symbols by replacing every symbol by the corresponding binary codeword. For instance, assume that alphabet B contains 4 symbols. Then they are c0, c1, c2, c3. Further, assume that symbol c0 is assigned 0, c1 is assigned 10, 2 is assigned 110 and c3 is assigned 111. Consider now the following sequence of symbols over the alphabet B: "c2 c3 cl c2 c0 c0 c0". This sequence is encoded into the bitstream "11011110110000". Conversely, a bit sequence is decoded by dividing it first into non-overlapping code- words and then replacing each codeword with the corresponding alphabet symbol. For instance, the sequence "0011001010111" can be parsed as follows: "0,0,110,0,10,10,111". Then the decoded alphabet sequence is "c0 c0 c2 c0 cl cl c3". Note that the prefix-free property ensures that the parsing of the binary sequence into codewords is unique. A prefix-free code can be represented using a binary tree. Note first that any path in the tree, from some node to one of its descendants, can be regarded as a sequence of branches. By replacing any left branch with 0 and any right branch with 1 we obtain a binary sequence that represents the path. In a binary tree representation of a prefix-free code, the paths from the root to the leaves represent the codewords. Thus, the number of leaves equals the number of codewords. Each leaf stores the alphabet symbol corresponding to the binary codeword that describes the path from the root to that leaf. DESCRIPTION: In this assignment you are required to implement prefix-free codes using binary trees with linked nodes. For this, you have to write the Java classes BinTree and TNode in the same package. Class BinTree uses binary trees with linked nodes to represent prefix-free codes. Class TNode represents the nodes of the binary tree. You also need to perform the time and space complexity analysis of your algorithms. You are not allowed to use any predefined Java methods other than those de- fined in the classes java.util.ArrayList, java.lang.String and java.lang. Math. DEFINITIONS: A prefix-free code (used in data compression) is a set of binary sequences (sequences of 0's and 1's) such that none of them is a prefix of another. For instance, the set A = {0, 10, 110, 111} is a prefix-free code. On the other hand, the set {0, 10, 100, 111} is not a prefix-free code because the sequence 10 is a prefix of 100. The elements of the prefix-free code are referred to as (binary) codewords. A prefix-free code can be used to encode a sequence of symbols from an alphabet B (i.c., convert the sequence of symbols into a bitstream) as follows. Each symbol in alphabet B = {0, c1, c2,,cn} is assigned a distinct binary codeword. Then we can encode any sequence of symbols by replacing every symbol by the corresponding binary codeword. For instance, assume that alphabet B contains 4 symbols. Then they are c0, c1, c2, c3. Further, assume that symbol c0 is assigned 0, c1 is assigned 10, 2 is assigned 110 and c3 is assigned 111. Consider now the following sequence of symbols over the alphabet B: "c2 c3 cl c2 c0 c0 c0". This sequence is encoded into the bitstream "11011110110000". Conversely, a bit sequence is decoded by dividing it first into non-overlapping code- words and then replacing each codeword with the corresponding alphabet symbol. For instance, the sequence "0011001010111" can be parsed as follows: "0,0,110,0,10,10,111". Then the decoded alphabet sequence is "c0 c0 c2 c0 cl cl c3". Note that the prefix-free property ensures that the parsing of the binary sequence into codewords is unique. A prefix-free code can be represented using a binary tree. Note first that any path in the tree, from some node to one of its descendants, can be regarded as a sequence of branches. By replacing any left branch with 0 and any right branch with 1 we obtain a binary sequence that represents the path. In a binary tree representation of a prefix-free code, the paths from the root to the leaves represent the codewords. Thus, the number of leaves equals the number of codewords. Each leaf stores the alphabet symbol corresponding to the binary codeword that describes the path from the root to that leaf.
Expert Answer:
Related Book For
Posted Date:
Students also viewed these algorithms questions
-
"internet radios" for streaming audio, and personal video recorders and players. Describe design and evaluation processes that could be used by a start-up company to improve the usability of such...
-
can someone solve this Modern workstations typically have memory systems that incorporate two or three levels of caching. Explain why they are designed like this. [4 marks] In order to investigate...
-
Cost-Volume-Profit (CVP) analysis can be used to determine the effect of changes in costs and volumes on a company's net profits. This project assignment assumes that you are newly hired as an...
-
Allied Shelving and Equipment, Inc., sells and installs shelving systems. National Deli, LLC, contracted with Allied to provide and install a parallel rack system (a series of large shelves) in...
-
From secondary data sources, obtain sales for an entire industry and the sales of the major firms in that industry for any year. Compute the market shares of each major firm. Using another source,...
-
An investment is guaranteed to have a unique value of IRR if which of the following is true? a. Alternating positive and negative cash flows b. An initial negative cash flow followed by all positive...
-
On October 1, 2013, Adria Lopez launched a computer services company called Success Systems, which provides consulting services, computer system installations, and custom program development. Adria...
-
Suppose carpet for a 12 ft by 10 ft room costs $400. Find the cost to carpet a room 36 ft by 30 ft. The cost to carpet the room is $
-
1. Choose one of the documents in the world of your work, then take a photo, and find 10 misspellings in the document, then analyze!
-
Review | Constants | Periodic Table A 4.5 g latex balloon is filled with 2.6 g of helium. When filled, the balloon is a 31-cm-diameter sphere. When released, the balloon accelerates upward until it...
-
Use this article below to give the best example with supporting points to make a example of an Annotated biography ...
-
Your company is considering launching a new line of stoves. The manufacturing plant required for producing the new line of stoves costs $40,000,000 (today) and will be depreciated down to zero over...
-
X transfers prop (basis $5K/ FMV $60K) for 600 shares of a newly formed Aces Corp. Y receives 400 shares in Aces corp. for services rendered to the corp. Each share is worth $100. Do X and/or Y have...
-
Pls code according to the description. And pls tidy your code - a snippet would be really appreciated and i will rate helpful right away for a correct answer. Lastly DONT GOOGLE or FAKE the answer i...
-
You have just been assigned to provide client services to the following entities. For each, identify three resources you could consult in order to better understand the company's business model and...
-
Pearl Medavoy will invest $10,240 a year for 20 years in a fund that will earn 10% annual interest. . If the first payment into the fund occurs today, what amount will be in the fund in 20 years? If...
-
During its 2017 year-end inventory count, Lamaline Ltd. included inventory it had received on consignment from a supplier. Lamaline uses a periodic inventory control system. Explain the impact of...
-
Why do companies invest in other companies?
-
Why is the direct writeoff method of accounting for bad debts not appropriate in accrual accounting?
-
Select the statement that best describes organizational versus organized crime: 1. Organizational and organized crime are essentially the sameboth center on crimes committed by organizations. 2. Some...
-
Three people check into a hotel. They pay $30 to the manager and go to their room. The manager suddenly remembers that the room rate is $25 and gives $5 to the bellboy to return to the people. On the...
-
A scientist has two bucketsone holds 4 gallons and the other holds 5 gallonsas well as an unlimited water supply. By using nothing but the buckets and water, how can you accurately measure 3 gallons...
Study smarter with the SolutionInn App