Question 2 Your Uncle James Bond Went Missing 3 Years Ago When He Went On An Office Trip. You Miss Him A Lot. He Said He Worked In A Bank, But He Always Had So Many Office Trips, You Always Found That Strange. Anyways, 3 Years After His Disappearance, You

匿名用户 最后更新于 2021-12-01 19:31 物理类Physics

Question 2 Your uncle James Bond went missing 3 years ago when he went on an office trip. You miss him a lot. He said he worked in a bank, but he always had so many office trips, you always found that strange. Anyways, 3 years after his disappearance, you got a letter with only one message "I open at the close". You immediately knew it was from James, as it is your favourite quote from your favourite book "Harry Potter and he is the only one who knows it. You got the last harry potter book and opened the page with the quote and at the bottom in your uncle's handwriting the following note was written: 1. aaasttoodrrrrfy 2. taught in summer 3. 10010111010011111100011011011110 You immediately understood what you had to do. James taught you a variable length encoding algorithm in the last summer vacation you had with him. You have to find the code of each character in the first line using the encoding algorithm and then use the code of each character to decode the third line. James also gave you some special instructions in case you had to use that algorithm, so that you can decode the code correctly. The instructions are: . If any characters have same frequency, then the character that appears first has higher priority (e.g, in above example r and t have same frequency, since r appears before t, it will also appear before t in the queue when generating the tree) A new node will always be placed immediately before the next higher frequency node in the queue. E.g. this new node should be inserted just before C and after B Now that you have read all instructions clearly, complete the tasks below: Use the appropriate encoding algorithm to find the code of each character in line 1 of your uncle's note. Generate the tree, show step by step process. [7] b. Use the character codes found in (a) to decode the code in line 3 of your uncle's note [3]

已邀请: