Finding a binary prefix code provided lengths












0














Firstly, I am relatively new to this particular forum, and I usually use Stack exchange (maths). I do not know if this is the right place to post so please be aware in case, I should ask this question on a different stack exchange.



For the following numbers: 1,2,3,3,3. Find a binary prefix code for these lengths.



In my working out I realise by the sum of 3^x, where x is each of the respective numbers is {/frac 5/9}



Then with 3 symbols I have the following prefix code:



With length 1, I have the code 0. With length 2, I have the code 10. With 3 words that have length 3 I have the codes: 110, 111, 112.



I am asking this question because my tutor said that 112 was a possible code. I have only thought of this now, but since I am required to find a binary code how can there be a code 112? Should it not be something like 011? From my understanding, the code which is binary should only contain 0's and 1's.



I have attempted to contact my tutor but to no avail.



Any help would be welcome.



Thnx










share|cite|improve this question



























    0














    Firstly, I am relatively new to this particular forum, and I usually use Stack exchange (maths). I do not know if this is the right place to post so please be aware in case, I should ask this question on a different stack exchange.



    For the following numbers: 1,2,3,3,3. Find a binary prefix code for these lengths.



    In my working out I realise by the sum of 3^x, where x is each of the respective numbers is {/frac 5/9}



    Then with 3 symbols I have the following prefix code:



    With length 1, I have the code 0. With length 2, I have the code 10. With 3 words that have length 3 I have the codes: 110, 111, 112.



    I am asking this question because my tutor said that 112 was a possible code. I have only thought of this now, but since I am required to find a binary code how can there be a code 112? Should it not be something like 011? From my understanding, the code which is binary should only contain 0's and 1's.



    I have attempted to contact my tutor but to no avail.



    Any help would be welcome.



    Thnx










    share|cite|improve this question

























      0












      0








      0


      1





      Firstly, I am relatively new to this particular forum, and I usually use Stack exchange (maths). I do not know if this is the right place to post so please be aware in case, I should ask this question on a different stack exchange.



      For the following numbers: 1,2,3,3,3. Find a binary prefix code for these lengths.



      In my working out I realise by the sum of 3^x, where x is each of the respective numbers is {/frac 5/9}



      Then with 3 symbols I have the following prefix code:



      With length 1, I have the code 0. With length 2, I have the code 10. With 3 words that have length 3 I have the codes: 110, 111, 112.



      I am asking this question because my tutor said that 112 was a possible code. I have only thought of this now, but since I am required to find a binary code how can there be a code 112? Should it not be something like 011? From my understanding, the code which is binary should only contain 0's and 1's.



      I have attempted to contact my tutor but to no avail.



      Any help would be welcome.



      Thnx










      share|cite|improve this question













      Firstly, I am relatively new to this particular forum, and I usually use Stack exchange (maths). I do not know if this is the right place to post so please be aware in case, I should ask this question on a different stack exchange.



      For the following numbers: 1,2,3,3,3. Find a binary prefix code for these lengths.



      In my working out I realise by the sum of 3^x, where x is each of the respective numbers is {/frac 5/9}



      Then with 3 symbols I have the following prefix code:



      With length 1, I have the code 0. With length 2, I have the code 10. With 3 words that have length 3 I have the codes: 110, 111, 112.



      I am asking this question because my tutor said that 112 was a possible code. I have only thought of this now, but since I am required to find a binary code how can there be a code 112? Should it not be something like 011? From my understanding, the code which is binary should only contain 0's and 1's.



      I have attempted to contact my tutor but to no avail.



      Any help would be welcome.



      Thnx







      computability information-theory coding-theory binary






      share|cite|improve this question













      share|cite|improve this question











      share|cite|improve this question




      share|cite|improve this question










      asked Jan 4 at 14:10









      princetongirl818princetongirl818

      828




      828






















          2 Answers
          2






          active

          oldest

          votes


















          1















          With 3 words that have length 3 I have the codes: 110, 111, 112




          Your try:



          L C
          1 0
          2 10
          3 110
          3 111
          3 112


          If you are looking for a binary prefix-free code , then 112 does not make sense.



          Before looking for such a code, with prescribed lengths, you might test if it's possible. A necessary and sufficient criterion is Kraft's inequality: $sum 2^{-l_i} le 1$.
          In this case we have $frac12 + frac 14 + 3 frac18=frac98>1$
          Hence, it's not possible to find a binary prefix-free code with those lengths.



          BTW: I have no idea why you've you've computed $sum 3^{-l_i} $ (I guess that's you meant). That would make sense if you wanted a ternary code. In that case, yes, the Kraft's inequality is verified, and you can build a ternary prefix-free code (your try is fine).






          share|cite|improve this answer























          • Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
            – princetongirl818
            Jan 5 at 21:35



















          1














          I would think but cannot be certain that 112 is not a binary code because 2 is not a binary number, and that it should be 0's and 1's only. However I am not completely sure.






          share|cite|improve this answer





















          • Thank you for your help I appreciate it.
            – princetongirl818
            Jan 5 at 21:21











          Your Answer





          StackExchange.ifUsing("editor", function () {
          return StackExchange.using("mathjaxEditing", function () {
          StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
          StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
          });
          });
          }, "mathjax-editing");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "69"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          noCode: true, onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3061678%2ffinding-a-binary-prefix-code-provided-lengths%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          2 Answers
          2






          active

          oldest

          votes








          2 Answers
          2






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          1















          With 3 words that have length 3 I have the codes: 110, 111, 112




          Your try:



          L C
          1 0
          2 10
          3 110
          3 111
          3 112


          If you are looking for a binary prefix-free code , then 112 does not make sense.



          Before looking for such a code, with prescribed lengths, you might test if it's possible. A necessary and sufficient criterion is Kraft's inequality: $sum 2^{-l_i} le 1$.
          In this case we have $frac12 + frac 14 + 3 frac18=frac98>1$
          Hence, it's not possible to find a binary prefix-free code with those lengths.



          BTW: I have no idea why you've you've computed $sum 3^{-l_i} $ (I guess that's you meant). That would make sense if you wanted a ternary code. In that case, yes, the Kraft's inequality is verified, and you can build a ternary prefix-free code (your try is fine).






          share|cite|improve this answer























          • Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
            – princetongirl818
            Jan 5 at 21:35
















          1















          With 3 words that have length 3 I have the codes: 110, 111, 112




          Your try:



          L C
          1 0
          2 10
          3 110
          3 111
          3 112


          If you are looking for a binary prefix-free code , then 112 does not make sense.



          Before looking for such a code, with prescribed lengths, you might test if it's possible. A necessary and sufficient criterion is Kraft's inequality: $sum 2^{-l_i} le 1$.
          In this case we have $frac12 + frac 14 + 3 frac18=frac98>1$
          Hence, it's not possible to find a binary prefix-free code with those lengths.



          BTW: I have no idea why you've you've computed $sum 3^{-l_i} $ (I guess that's you meant). That would make sense if you wanted a ternary code. In that case, yes, the Kraft's inequality is verified, and you can build a ternary prefix-free code (your try is fine).






          share|cite|improve this answer























          • Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
            – princetongirl818
            Jan 5 at 21:35














          1












          1








          1







          With 3 words that have length 3 I have the codes: 110, 111, 112




          Your try:



          L C
          1 0
          2 10
          3 110
          3 111
          3 112


          If you are looking for a binary prefix-free code , then 112 does not make sense.



          Before looking for such a code, with prescribed lengths, you might test if it's possible. A necessary and sufficient criterion is Kraft's inequality: $sum 2^{-l_i} le 1$.
          In this case we have $frac12 + frac 14 + 3 frac18=frac98>1$
          Hence, it's not possible to find a binary prefix-free code with those lengths.



          BTW: I have no idea why you've you've computed $sum 3^{-l_i} $ (I guess that's you meant). That would make sense if you wanted a ternary code. In that case, yes, the Kraft's inequality is verified, and you can build a ternary prefix-free code (your try is fine).






          share|cite|improve this answer















          With 3 words that have length 3 I have the codes: 110, 111, 112




          Your try:



          L C
          1 0
          2 10
          3 110
          3 111
          3 112


          If you are looking for a binary prefix-free code , then 112 does not make sense.



          Before looking for such a code, with prescribed lengths, you might test if it's possible. A necessary and sufficient criterion is Kraft's inequality: $sum 2^{-l_i} le 1$.
          In this case we have $frac12 + frac 14 + 3 frac18=frac98>1$
          Hence, it's not possible to find a binary prefix-free code with those lengths.



          BTW: I have no idea why you've you've computed $sum 3^{-l_i} $ (I guess that's you meant). That would make sense if you wanted a ternary code. In that case, yes, the Kraft's inequality is verified, and you can build a ternary prefix-free code (your try is fine).







          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Jan 5 at 16:13

























          answered Jan 5 at 15:17









          leonbloyleonbloy

          40.3k645107




          40.3k645107












          • Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
            – princetongirl818
            Jan 5 at 21:35


















          • Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
            – princetongirl818
            Jan 5 at 21:35
















          Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
          – princetongirl818
          Jan 5 at 21:35




          Thank you sir, for your help. This makes a lot more sense. I have marked your solution as the verified answer.
          – princetongirl818
          Jan 5 at 21:35











          1














          I would think but cannot be certain that 112 is not a binary code because 2 is not a binary number, and that it should be 0's and 1's only. However I am not completely sure.






          share|cite|improve this answer





















          • Thank you for your help I appreciate it.
            – princetongirl818
            Jan 5 at 21:21
















          1














          I would think but cannot be certain that 112 is not a binary code because 2 is not a binary number, and that it should be 0's and 1's only. However I am not completely sure.






          share|cite|improve this answer





















          • Thank you for your help I appreciate it.
            – princetongirl818
            Jan 5 at 21:21














          1












          1








          1






          I would think but cannot be certain that 112 is not a binary code because 2 is not a binary number, and that it should be 0's and 1's only. However I am not completely sure.






          share|cite|improve this answer












          I would think but cannot be certain that 112 is not a binary code because 2 is not a binary number, and that it should be 0's and 1's only. However I am not completely sure.







          share|cite|improve this answer












          share|cite|improve this answer



          share|cite|improve this answer










          answered Jan 4 at 23:18









          Teddy MontgomeryTeddy Montgomery

          132




          132












          • Thank you for your help I appreciate it.
            – princetongirl818
            Jan 5 at 21:21


















          • Thank you for your help I appreciate it.
            – princetongirl818
            Jan 5 at 21:21
















          Thank you for your help I appreciate it.
          – princetongirl818
          Jan 5 at 21:21




          Thank you for your help I appreciate it.
          – princetongirl818
          Jan 5 at 21:21


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Mathematics Stack Exchange!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          Use MathJax to format equations. MathJax reference.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f3061678%2ffinding-a-binary-prefix-code-provided-lengths%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          1300-talet

          1300-talet

          Has there ever been an instance of an active nuclear power plant within or near a war zone?