Skip to content
Snippets Groups Projects
Commit b6b42598 authored by DARWICH ALI's avatar DARWICH ALI
Browse files

m

parent ea75b9fb
No related merge requests found
......@@ -21,8 +21,7 @@ S tete(Liste l){
}
Liste supt(Liste l ){
Liste l1 = l;
if(l1->s == NULL){
free(l1);
if(l == NULL){
return listenouv();
}
else{
......@@ -33,23 +32,25 @@ Liste supt(Liste l ){
}
Nat lng(Liste l){
return (l->s == NULL) ? 1 : 1 + lng(l);
return (l == NULL) ? 0 : 1 + lng(l->s);
}
bool vide(Liste l){
return (lng(l) == 0) ;
}
bool app(Liste l, S x){
if(l == NULL){
//printf("false ?\n");
return false ;
}
else{
//printf("else\n");
if(l->v == x ){
return true ;
}
else{
Liste l1 = l ;
app(supt(l1), x);
free(l1);
app(supt(l1), x);
}
}
}
......@@ -77,21 +78,23 @@ Liste chg1(Liste l , S x , S y){
return l ;
}
else{
chg1(supt(l) ,x ,y);
Liste l1 = l;
ajout(chg1(supt(l1), x ,y),l1->v);
}
}
}
Liste sup1(Liste l , S x){
if( l== NULL){
Liste l1 = l ;
if(l== NULL){
return NULL ;
}
else{
if(l->s->v == x ){
l->s = l->s->s ;
return l ;
if(l->v == x ){
l = l->s;
return l1->s ;
}
else{
sup1(supt(l), x);
sup1(l1->s, x);
}
}
}
......
......@@ -11,10 +11,10 @@ typedef struct strliste{
struct strliste * s ;
} Strliste , *Liste ;
Liste listenouv();
Liste ajout(Liste l, S x);
S tete(Liste l) ;
Liste supt(Liste l);
Liste listenouv();//
Liste ajout(Liste l, S x);//
S tete(Liste l) ;//
Liste supt(Liste l);//
Nat lng(Liste l);
bool vide(Liste l);
bool app(Liste l, S x);
......
File deleted
No preview for this file type
#include "ListeSimple.h"
int main()
{
Liste l = listenouv();
for(int i = 0 ; i< 5 ; i++){
int main(){
Liste l = listenouv();
//printf("vide ? : %d\n",vide(l));
//for(int i = 0 ; i <(int)lng(l) ; i++){l= l->s ; printf(" %d ",l->v) ;}
for(int i = 5 ; i > 0 ; i--){
l = ajout(l , i);
printf("%d\n",tete(l) );
//printf("%d ",tete(l) );
}
for(int i = 5 ; i< 10 ; i++){
//printf("\n");
/*
printf("longueur est : %d\n",lng(l));
*/
//for(int i = 0 ; i <(int)lng(l) ; i++){l= l->s ; printf(" %d ",l->v) ;}
/*for(int i = 5 ; i < 10 ; i++){
l = adjq(l , i);
printf("%d\n",queue(l) );
//printf("%d\n",queue(l) );
}
*/
/*
Liste l1 = l ;
for(int i = 0 ; i <(int)lng(l) ; i++){
printf("%d ",l1->v);
l1 = l1->s ;
}
printf("\n");
printf("%d\n",tete(l) );
//printf("%d\n",tete(l) );
for(int i = 5 ; i< 10 ; i++){
for(int i = 0 ; i < 5; i++){
l = supt(l);
printf("%d\n",tete(l) );
//printf("%d ",tete(l) );
}
printf("\n");
//printf("tete: %d\n",tete(l));
printf("long :%d\n",lng(l) );
printf("vide ? : %d\n",vide(l));
printf("est ce que 5 app a l ? :%d\n",app(l , 0));
*/
/*
l = rech1(l , 2);
Liste l1 = l ;
for(int i = 0 ; i <(int)lng(l) ; i++){
printf("%d ",l1->v);
l1 = l1->s ;
}
printf("\n");
l = chg1(l , 1, 3);
printf("%d\n",lng(l));
l1 = l ;
for(int i = 0 ; i <(int)lng(l) ; i++){
printf("%d ",l1->v);
l1 = l1->s ;
}
printf("\n");
l = sup1(l , 2) ;
l1 = l ;
for(int i = 0 ; i <(int)lng(l) ; i++){
printf("%d ",l1->v);
l1 = l1->s ;
}
printf("\n");
*/
/*
for(int i = 5 ; i < 10 ; i++){
l = adjq(l , i);
//printf("%d\n",queue(l) );
}
Liste l1 = l ;
for(int i = 0 ; i <(int)lng(l) ; i++){
printf("%d ",l1->v);
l1 = l1->s ;
}
printf("\n");
printf("%d\n",queue(l));
l = supq(l);
l = supq(l);
l1 = l ;
for(int i = 0 ; i <(int)lng(l) ; i++){
printf("%d ",l1->v);
l1 = l1->s ;
}
printf("\n");
*/
return 0;
}
\ No newline at end of file
File deleted
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment