-
Notifications
You must be signed in to change notification settings - Fork 22
review tp1 #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
AyoubDaoudia
wants to merge
14
commits into
rakati:main
Choose a base branch
from
AyoubDaoudia:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
review tp1 #2
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
ee4664f
Update get_third_largest.c
AyoubDaoudia fc379c9
Update iterative_fibo.c
AyoubDaoudia c12d586
Update recursive_fibo.c
AyoubDaoudia 17aa9c4
Update print_table.c
AyoubDaoudia 39d2d8a
Update get_third_largest.c
AyoubDaoudia e40560d
Update get_third_largest.c
AyoubDaoudia cbbd9f9
Update rand_fill_table.c
AyoubDaoudia 8a85b65
Update primes.c
AyoubDaoudia d568cdc
Update primes.c
AyoubDaoudia aa80d15
Update primes_opt.c
AyoubDaoudia 33b690a
Update header.h
AyoubDaoudia b19ba0a
Update recursive_fibo.c
AyoubDaoudia 1ec4399
Finished this exercise
AyoubDaoudia 895b41b
TP 3&4 finished
AyoubDaoudia File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| #ifndef HEADER | ||
| #define HEADER | ||
|
|
||
| #include <stdio.h> | ||
| #include <stdlib.h> | ||
| #include <time.h> | ||
|
|
||
| struct celluleDouble | ||
| { | ||
| int element; | ||
| struct celluleDouble * suivant; | ||
| struct celluleDouble * precedent; | ||
| }; | ||
| typedef struct celluleDouble celluleDouble; | ||
|
|
||
| struct listeDouble | ||
| { | ||
| celluleDouble * debut; | ||
| celluleDouble * fin; | ||
| unsigned longueur; | ||
| }; | ||
| typedef struct listeDouble listeDouble; | ||
|
|
||
|
|
||
| #endif | ||
|
|
||
| int listeDoubleVide(listeDouble); | ||
| void affichageListeDouble(listeDouble); | ||
| void ajoutDebut(int, listeDouble *); | ||
| void ajoutFin(int,listeDouble *); | ||
| void suppressionDebut(listeDouble *); | ||
| void suppressionFin(listeDouble *); | ||
| void libererListeDouble(listeDouble); |
Binary file not shown.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,118 @@ | ||
| #include "dlistHeader.h" | ||
|
|
||
|
|
||
| int listeDoubleVide(listeDouble L) | ||
| { | ||
| if(L.debut==NULL) | ||
| return 1; | ||
| return 0; | ||
| } | ||
|
|
||
|
|
||
| void affichageListeDouble(listeDouble L) | ||
| { | ||
| if(listeDoubleVide(L)==1) | ||
| { | ||
| printf("[]\n"); | ||
| return; | ||
| } | ||
| celluleDouble *temp=L.debut; | ||
| printf("["); | ||
| while(temp->suivant!=NULL) | ||
| { | ||
| printf("%d, ",temp->element); | ||
| temp=temp->suivant; | ||
| } | ||
| if(temp!=NULL) | ||
| printf("%d",temp->element); | ||
| printf("]\n"); | ||
| } | ||
|
|
||
|
|
||
|
|
||
| void ajoutDebut(int x,listeDouble * L) | ||
| { | ||
| celluleDouble * C=(celluleDouble *)malloc(sizeof(celluleDouble)); | ||
| C->element=x; | ||
| C->suivant=L->debut; | ||
| C->precedent=NULL; | ||
|
|
||
| if(listeDoubleVide(*L)==1) | ||
| { | ||
| L->debut=C; | ||
| L->fin=C; | ||
| L->longueur=1; | ||
| return; | ||
| } | ||
| L->debut->precedent=C; | ||
| L->debut=C; | ||
| L->longueur+=1; | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| void ajoutFin(int x,listeDouble *L) | ||
| { | ||
| celluleDouble * C=(celluleDouble *)malloc(sizeof(celluleDouble)); | ||
| C->element=x; | ||
| C->precedent=L->fin; | ||
| C->suivant=NULL; | ||
|
|
||
| if(listeDoubleVide(*L)==1) | ||
| { | ||
| ajoutDebut(x,L); | ||
| return; | ||
| } | ||
| L->fin->suivant=C; | ||
| L->fin=C; | ||
| L->longueur+=1; | ||
| return; | ||
| } | ||
|
|
||
| void suppressionDebut(listeDouble * L) | ||
| { | ||
| if(listeDoubleVide(*L)==1) | ||
| return; | ||
| if(L->longueur==1) | ||
| { | ||
| L->longueur=0; | ||
| if(L->debut!=NULL) | ||
| free(L->debut); | ||
| L->debut=NULL; | ||
| return; | ||
| } | ||
| celluleDouble * temp=L->debut; | ||
| L->debut=L->debut->suivant; | ||
| L->longueur-=1; | ||
| free(temp); | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| void suppressionFin(listeDouble * L) | ||
| { | ||
| if(listeDoubleVide(*L)==1) | ||
| return; | ||
| if(L->longueur==1) | ||
| { | ||
| suppressionDebut(L); | ||
| return; | ||
| } | ||
| celluleDouble * temp=L->fin; | ||
| L->fin=L->fin->precedent; | ||
| L->fin->suivant=NULL; | ||
| L->longueur-=1; | ||
| free(temp); | ||
| return; | ||
| } | ||
|
|
||
|
|
||
| void libererListeDouble(listeDouble L) | ||
| { | ||
| while(L.debut!=NULL) | ||
| { | ||
| celluleDouble * temp=L.debut; | ||
| L.debut=L.debut->suivant; | ||
| free(temp); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,26 @@ | ||
| #ifndef HEADER | ||
| #define HEADER | ||
|
|
||
| #include<stdio.h> | ||
| #include<stdlib.h> | ||
| //#include "liste_simple.h" | ||
|
|
||
| struct cellule | ||
| { | ||
| int element; | ||
| struct cellule * suivant; | ||
|
|
||
| }; | ||
| typedef struct cellule cellule; | ||
| typedef struct cellule * liste; | ||
|
|
||
| #endif | ||
|
|
||
| int testVide(liste); | ||
| unsigned longueur(liste); | ||
| void affichageListe(liste); | ||
| void ajoutDebut(int,liste *); | ||
| void ajoutFin(int,liste *); | ||
| void suppressionDebut(liste *); | ||
| void suppressionFin(liste *); | ||
| void liberer(liste); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,116 @@ | ||
| #include "listHeader.h" | ||
|
|
||
|
|
||
| int testVide(liste L) | ||
| { | ||
| if(L==NULL) | ||
| return 1; | ||
| return 0; | ||
| } | ||
|
|
||
| unsigned longueur(liste L) | ||
| { | ||
| unsigned l=0; | ||
| if(testVide(L)==0) | ||
| { | ||
| liste temp=L; | ||
| while(temp!=NULL) | ||
| { | ||
| l+=1; | ||
| temp=temp->suivant; | ||
| } | ||
| } | ||
| return l; | ||
| } | ||
|
|
||
| void affichageListe(liste L) | ||
| { | ||
| if(L==NULL) | ||
| printf("[ ]"); | ||
| else | ||
| { | ||
| printf("["); | ||
| liste temp=L; | ||
| while(temp->suivant!=NULL) | ||
| { | ||
| printf("%d, ",temp->element); | ||
| temp=temp->suivant; | ||
| } | ||
| if(temp!=NULL) | ||
| printf("%d",temp->element); | ||
| printf("]\n"); | ||
| } | ||
| } | ||
|
|
||
| void ajoutDebut(int x,liste * L) | ||
| { | ||
| cellule * C=(cellule *)malloc(sizeof(cellule)); | ||
| C->element=x; | ||
| C->suivant=*L; | ||
| *L=C; | ||
| return; | ||
| } | ||
|
|
||
| void ajoutFin(int x,liste * L) | ||
| { | ||
| liste C=(liste)malloc(sizeof(cellule)); | ||
| C->element=x; | ||
| C->suivant=NULL; | ||
| if(*L==NULL) | ||
| *L=C; | ||
| else | ||
| { | ||
| liste temp=*L; | ||
| while(temp->suivant!=NULL) | ||
| temp=temp->suivant; | ||
| temp->suivant=C; | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| void suppressionDebut(liste * L) | ||
| { | ||
| if(L!=NULL) | ||
| { | ||
| liste temp=*L; | ||
| *L=(*L)->suivant; | ||
| free(temp); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| void suppressionFin(liste * L) | ||
| { | ||
| if(L==NULL) | ||
| { | ||
| return; | ||
| } | ||
| if((*L)->suivant==NULL) | ||
| { | ||
| free(*L); | ||
| *L=NULL; | ||
| } | ||
| else | ||
| { | ||
| liste temp=*L; | ||
| liste temp_1=*L; | ||
| while(temp->suivant!=NULL) | ||
| { | ||
| temp_1=temp; | ||
| temp=temp->suivant; | ||
| } | ||
| temp_1->suivant=NULL; | ||
| free(temp); | ||
| } | ||
| return; | ||
| } | ||
|
|
||
| void liberer(liste L) | ||
| { | ||
| while(L!=NULL) | ||
| { | ||
| liste temp=L; | ||
| L=L->suivant; | ||
| free(temp); | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What this line does?