Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cours
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
algorithmique
cours
Commits
6c48041d
Commit
6c48041d
authored
1 month ago
by
paul.albuquer
Browse files
Options
Downloads
Patches
Plain Diff
Edit cours_22.md
parent
1f0bc20a
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#39540
passed
1 month ago
Stage: test
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
slides_2023/cours_22.md
+15
-15
15 additions, 15 deletions
slides_2023/cours_22.md
with
15 additions
and
15 deletions
slides_2023/cours_22.md
+
15
−
15
View file @
6c48041d
...
...
@@ -3,7 +3,7 @@ title: "Arbres quaternaires"
date
:
"
2024-04-30"
---
# Rappel sur ls arbres quaternaires
# Rappel sur l
e
s arbres quaternaires
## Définition?
...
...
@@ -65,7 +65,7 @@ date: "2024-04-30"
```
C
matrice symétrie(matrice)
pour i de 0 à nb_colonnes(matrice)
/
2
pour i de 0 à nb_colonnes(matrice)
/
2
pour j de 0 à nb_lignes(matrice)
échanger(matrice[i][j], matrice[nb_colonnes(matrice)-1-i][j])
retourne matrice
...
...
@@ -152,7 +152,7 @@ rien rotation_gauche(arbre)
IG=2 | ID=3 IG=2 | ID=3
```
*
Écrire le vrai (5min, matrix)
*
Écrire le vrai
code
(5min, matrix)
. . .
...
...
@@ -164,7 +164,7 @@ void rotate(node *qt) {
qt->child[0] = qt->child[1];
qt->child[1] = qt->child[3];
qt->child[3] = tmp;
for (int i=0;
i < 4
; i++) {
for (int i=0;
i<CHILDREN
; i++) {
rotate(qt->child[i]);
}
}
...
...
@@ -204,19 +204,19 @@ void rotate(node *qt) {
# Compression sans perte (3/5)
*
Si un nœud a tous ses enfants égaux:
*
Donner la
valeur
au
nœud,
*
Supprimer
l
es enfants.
*
R
emonter
jusqu'
à la racine.
*
Stocker cette
valeur
dans ce
nœud,
*
Supprimer
s
es enfants.
*
Jusqu'à r
emonter à la racine.
## Écrire le pseudo-code (5min, matrix)
. . .
```
C
rien compression_sans_perte
s
(arbre)
rien compression_sans_perte(arbre)
si !est_feuille(arbre)
pour i de 0 à 3
compression_sans_perte
s
(arbre.enfant[i])
compression_sans_perte(arbre.enfant[i])
si derniere_branche(arbre)
valeur, toutes_égales = valeur_enfants(arbre)
si toutes_egales
...
...
@@ -235,14 +235,14 @@ rien compression_sans_pertes(arbre)
```
C
void lossless_compression(node *qt) {
if (!is_leaf(qt)) {
for (int i
=
0; i
<
CHILDREN; i++) {
for (int i
=
0; i
<
CHILDREN; i++) {
lossless_compression(qt->child[i]);
}
if (is_last_branch(qt)) {
int val = -1;
if (last_value(qt, &val)) {
qt->info = val;
for (int i
=
0; i
< 4
; ++i) {
for (int i
=
0; i
<CHILDREN
; ++i) {
free(qt->child[i]);
qt->child[i] = NULL;
}
...
...
@@ -258,7 +258,7 @@ void lossless_compression(node *qt) {
```
C
bool is_last_branch(node *qt) {
for (int i = 0; i <
4
; ++i) {
for (int i = 0; i <
CHILDREN
; ++i) {
if (!is_leaf(qt)) {
return false;
}
...
...
@@ -267,7 +267,7 @@ bool is_last_branch(node *qt) {
}
bool last_value(node *qt, int *val) {
int info = qt->child[0];
for (int i = 1; i <
4
; ++i) {
for (int i = 1; i <
CHILDREN
; ++i) {
if (info != qt->child[i]) {
return false;
}
...
...
@@ -325,7 +325,7 @@ bool last_value(node *qt, int *val) {
. . .
*
Si $
\s
igma<
\t
heta$, $
\t
heta$ est la
**tolérance**
:
*
Si $
\s
igma<
\t
heta$,
où
$
\t
heta$ est la
**tolérance**
:
*
Remplacer la valeur du pixel par la moyenne des enfants.
*
Remonter les valeurs dans l'arbre.
...
...
@@ -498,7 +498,7 @@ rien iteration_temporelle(étoiles, dt)
| 10^11 | 10^22 | 1e+16 | ~300M ans |
+--------+-------+-------+-----------+
*
Typiquement il y a des milliers-millions d'itérations.
*
Typiquement
,
il y a des milliers-millions d'itérations.
*
Il y a $10^{11}$ étoiles dans la galaxie.
*
Houston we have a problem.
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment