{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

2c03-review - 00002 - probability average length a 01 2 0.4...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
2 q:=p+1; while q<>(L.last +1) do if L.elements[q]= L.elements[p] then while q<>(L.last +1) do begin (1) L.elements[q]:= L.elements[q+1] L.last:=L.last-1 end else q:= q+1 p:=p+1 end end O(n 2 ). It looks like 3 nested loops, so O(n 3 ). By more careful investigation, we can see the while loop(1) is same as DELETE. Even there are two outer loops, DELETE can be executed at most n times, and DELETE itself is O(n). Therefore, O(n 2 ). 3. [10] 1.0 0 1 0.6 0.4 0 1 0 1 0.2 0.4 0.2 0.2 0 1 a c b 0.12 0.08 0 1 d 0.04 0.08 f e Char code length
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: probability average length a 01 2 0.4 0.8 b 11 2 0.2 0.4 c 10 2 0.2 0.4 d 001 3 0.08 0.24 e 0001 4 0.08 0.32 f 0000 4 0.04 0.16 Average code length 2 × 0.4 + 2 × 0.2 + 2 × 0.2 + 3 × 0.08 + 4 × 0.08 + 4 × 0.04 = 2.32 The optimal Hoffman code is not unique, however, the average length is unique. 4.[10] a. [6] Pat A b a b a a J 1 2 3 4 5 6 F(j) 1 2 3 1 b.[4] Same for standard algorithm and KMP. For instance x = abc, pat = ac....
View Full Document

  • Spring '03
  • janicki
  • Lawrence Lessig, Code and Other Laws of Cyberspace, Code: Version 2.0, Free Culture, Pat J F, probability average length

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern