Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

translate the following algorithm into C language (context is coding/decoding) input: L1: listes separated(caractre, longueur) output: L2: listes separated(caractre, code) sorted by lenght L1=sorted_by_lenght(L1) //

translate the following algorithm into C language (context is coding/decoding)

input: L1: listes separated(caractre, longueur) output: L2: listes separated(caractre, code) sorted by lenght

L1=sorted_by_lenght(L1)

// If same lenght then sort by alphabetical order i don't know how to write it in algorithmic

L2[0]->code = 0 L2[0]->char = L1[0]->char control_lenght = 0 previous_lenght = 0 n= size L1

for i =1 to n-1 do L2[i]->char = L1[i]->char control_lenght = L1[i]--->lenght previous_lenght = L1[i-1]--->lenght L2[i]->code = (L2[i-1]->code+1) * 2^(previous_lenght-control_lenght) end for return L2

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2014 Nancy France September 15 19 2014 Proceedings Part 2 Lnai 8725

Authors: Toon Calders ,Floriana Esposito ,Eyke Hullermeier ,Rosa Meo

2014th Edition

3662448505, 978-3662448502

More Books

Students also viewed these Databases questions

Question

Why isnt choosing a legal entity a one-time event?

Answered: 1 week ago