This commit is contained in:
JunkJumper 2020-10-06 15:26:36 +02:00
parent b456ffc7b7
commit 9401c75cbd
5 changed files with 32 additions and 0 deletions

Binary file not shown.

BIN
Cours/M313_CM5.pdf Normal file

Binary file not shown.

View File

@ -0,0 +1,14 @@
Begin
if isEmpty(msg) // Si msg"-.."
then return getUserObject(morse) //
else if charAt(msg,O)=='-' then // "-"
return decodeletterInmorse(leftChild(morse),substring(msg,1)) // ".."
else if charAt(msg,0)=='.' then
return decodeletterInMorse(rightChild(morse),substring(msg,1))
else return decodeLetterInMorse(morse,substring(msg,1)) //
Function decodeInmorse(ABin morse,ABin morseInUse,String msg); String
In: alphabet morse morse dans un arbre binaire et une copie morseInuse pour pouvoir "remonter à la racine"
Do: renvoie le message en alphabet A-2
Begin

View File

@ -0,0 +1,18 @@
Function decodeInmorse(ABin morse,ABin morseInUse,String msg); String
In: alphabet morse morse dans un arbre binaire et une copie morseInuse pour pouvoir "remonter à la racine"
Do: renvoie le message en alphabet A-2
Begin
if isEmpty(msg)
then return getUserObject(morseInUse)
else if charAt(msg,0)=='-' then
return decodeInMorse(morse,leftchild(morseinuse),substring(msg,1))
else if charAt(msg,0)=='.' then
return decodeletterInMorse(rightChild(morse),substring(msg,1))
else return decodeLetterInMorse(morse,substring(msg,1))
else if charAt(msg,0)=='/' then
return getUserObject(morseInUse)+decodeInmorse(morse,morse,SubString(msg,1))
else if charAt(msg,0)==' ' then
return getUserObject(morseInUse)+' '+ decodeInmorse(morse,morse,SubString(msg,1))
else //optionel/
return getUserObject(morse,morseInUse,substring(msg,1))

Binary file not shown.