Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
P
prog-c
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
stefan.nikolic
prog-c
Commits
00d6af06
Commit
00d6af06
authored
6 months ago
by
Nikolic
Browse files
Options
Downloads
Patches
Plain Diff
Ajout de la function recherche
parent
40a47028
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
24-25/TP14/arbinaire_morse.c
+42
-0
42 additions, 0 deletions
24-25/TP14/arbinaire_morse.c
24-25/TP14/arbinaire_morse.h
+12
-1
12 additions, 1 deletion
24-25/TP14/arbinaire_morse.h
with
54 additions
and
1 deletion
24-25/TP14/arbinaire_morse.c
+
42
−
0
View file @
00d6af06
...
...
@@ -7,9 +7,11 @@ tree init(){
node
*
new
=
NULL
;
return
new
;
}
tree
nextLeft
(
node
*
node
){
return
node
->
left
;
}
tree
nextRight
(
node
*
node
){
return
node
->
right
;
}
...
...
@@ -29,3 +31,43 @@ void parcours_infix(node * node, int n){
parcours_infix
(
nextRight
(
node
),
n
+
1
);
}
}
int
depth
(
node
*
node
,
int
nbmax
,
int
nb
){
if
(
node
==
NULL
)
return
nb
;
int
tmp
=
0
;
tmp
=
depth
(
node
->
left
,
nbmax
,
nb
++
);
if
(
tmp
>
nbmax
){
nbmax
=
tmp
;
}
tmp
=
depth
(
node
->
right
,
nbmax
,
nb
++
);
if
(
tmp
>
nbmax
){
nbmax
=
tmp
;
}
return
nbmax
;
}
char
recherche
(
char
*
morse
,
tree
tree
){
int
j
=
0
;
while
(
morse
[
j
]
!=
'\0'
)
{
// Si le caractère est un point on descend à gauche dans l'arbre
if
(
morse
[
j
]
==
'.'
){
if
(
tree
->
left
==
NULL
){
return
'\0'
;
}
tree
=
tree
->
left
;
}
// Si le caractère est un tiret on desencde à gauche dans l'arbre
else
if
(
morse
[
j
]
==
'-'
){
if
(
tree
->
right
==
NULL
){
return
'\0'
;
}
tree
=
tree
->
right
;
}
j
++
;
}
return
tree
->
d
;
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
24-25/TP14/arbinaire_morse.h
+
12
−
1
View file @
00d6af06
...
...
@@ -35,3 +35,14 @@ void nood_print(node * data);
* Function permettant d'effectuer un parcours d'ordre infixe (GRD)
*/
void
parcours_infix
(
node
*
node
,
int
n
);
/*
* Function permettant de calculer la profondeur de l'arbre
*/
int
depth
(
node
*
node
,
int
nbmax
,
int
nb
);
/*
* Function permettant de trouver à partir d'une séquance morse de quel characère il s'agit
*/
char
recherche
(
char
*
morse
,
tree
tree
);
\ No newline at end of file
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