DS Practical 1
DS Practical 1
class: SYBCS
Roll.no:
DSA II Assignment No.1
********************************************************
Q.1) Write a c program for pre_order Traversal
#include<stdio.h>
#include<malloc.h>
struct node{
int data;
struct node* left;
struct node* right;
};
int main(){
preOrder(p);
return 0;
}
OUTPUT:
41526
struct node{
int data;
struct node* left;
struct node* right;
};
preOrder(p);
printf("\n");
postOrder(p);
return 0;
}
OUTPUT:
41526
52164
Q.3) Write Program for implementation to find leaf count of a given Binary tree
#include <stdio.h>
#include <stdlib.h>
return(node);
}
getchar();
return 0;
}
OUTPUT:
Leaf count of the tree is 3