|
|
|
|
Posté par
mina15, le mardi 23 janvier 2007 à 23:20:49
|
#include<stdio.h>
#include<stdlib.h> typedef struct noeud * tree; struct noeud {int val; tree fg,fd; }; tree cree_noeud(int val) { tree a; a=(tree)malloc(sizeof(noeud)); if(!a) {printf("pas d espace"); return(NULL); } if(a) { a->fd=NULL; a->fg=NULL; a->val=val; printf("%d",a->val); return(a); } } tree ajout(tree b,tree a,tree r) {a=r; if(a==NULL) { return b; } else { if(b->val<a->val) { if(a->fd==NULL) { a->fd=b; printf("%d",a->val); return(r); } else { r=ajout(b,a->fd,r); return(r); } } else { if(a->fg==NULL) { a->fg=b; printf("%d",a->val); return r; } else { r=ajout(b,a->fg,r); return(r); } } } } void prefixe(tree a) { if(a!=NULL) { printf("%d ",a->val); prefixe(a->fg); prefixe(a->fd); } } void main() {int x,l,h; tree r=NULL,b=NULL,k=NULL,a=NULL;free(r); printf("donner un entier : \n" ); scanf("%d",&x); b=cree_noeud(x); r=ajout( b,a, r); printf("%d",r->val); flushall(); printf("donner un entier : \n"); scanf("%d",&x); b=cree_noeud(x); r=ajout( b,a, r); prefixe(r); } |
| 10/05 20h51 | [Fedora Core] Compléter l'installation de la Fedora | Fedora Core |
| 27/07 05h53 | [Webmaster] Protéger les adresses email contre les bots | Webmaster |
| 14/09 10h42 | [Programmation] Critères de choix d'un langage/framework | Programmation |
| 24/08 20h30 | Plateformes Intel 775 Core2Duo | Overclocking |
| 15/04 01h13 | Conversion d'un nombre entier 32 bits en IP | Perl |
| 23/10 12h49 | Calcul et arbre binaire en C | 3 |
| 18/11 09h44 | Arbres binaire C: fichier ou memoire??? | 4 |
| 13/05 20h30 | Arbre binaire et fichier langage c urgent!!! | 26 |
| 11/05 19h41 | Fusion 2 arbre binaire langage c urgent !!!! | 5 |
![]() | Genopro - Genolog est un logiciel de généalogie permettant de construire un arbre généalogique sur plusieurs générations. Il s'agit... | Catégorie: Bureautique Licence: Freeware/gratuit |
![]() | X-Mas Tree - X-Mas Tree est tout simplement un programme permettant de concevoir un arbre de Noël virtuel. Cette nouvelle version propose... | Catégorie: Graphisme Licence: Freeware/gratuit |
![]() | Binary Clock Screensaver - Le langage binaire est encore mal connu de tous. Cet éditeur a trouvé le moyen d'allier ce langage avec un écran de veille. ... | Catégorie: Personnalisation Licence: Freeware/gratuit |
![]() | CCleaner - CCleaner (Crap Cleaner) est un utilitaire de nettoyage gratuit permettant de garantir un respect de la vie privée en... | Catégorie: Anonymat/Confidentialité Licence: Freeware/gratuit |
![]() | Plantronics CS361N Binaural | Catégorie: Casque audio | |
![]() | Sony CMT-CPZ2 | Catégorie: Chaîne Hi-Fi | 185.00 € Ubaldi |
![]() | Coby CX3CD-610 | Catégorie: Chaîne Hi-Fi | |
![]() | Philips SPD3400CC CD-RW/DVD+/-RW (+/-R | Catégorie: Graveur CD/DVD | 60.79 € Inmac Wstore |