Skip to main content


Showing posts from May, 2010

Installing ns-3.37 and ns-3.35 in Ubuntu | Ubuntu 22.04 | NS3

Multiple Versions of ns3 in Ubuntu 22.04 In this post, we are going to install two versions of ns3 namely ns-3.35 and ns-3.37  My OS is : Ubuntu 22.04 LTS (Long Term Support) ns-3.35 uses waf and (./waf --run scratch/first)  ns-3.37 uses cmake  (./ns3 run scratch/ So we will install both the packages  Go through the video for complete instructions To start with  $ sudo apt update  $ sudo apt install build-essential autoconf automake libxmu-dev g++ python3 python3-dev pkg-config sqlite3 cmake python3-setuptools git qtbase5-dev qtchooser qt5-qmake qtbase5-dev-tools gir1.2-goocanvas-2.0 python3-gi python3-gi-cairo python3-pygraphviz gir1.2-gtk-3.0 ipython3 openmpi-bin openmpi-common openmpi-doc libopenmpi-dev autoconf cvs bzr unrar gsl-bin libgsl-dev libgslcblas0 wireshark tcpdump sqlite sqlite3 libsqlite3-dev  libxml2 libxml2-dev libc6-dev libc6-dev-i386 libclang-dev llvm-dev automake python3-pip libxml2 libxml2-dev libboost-all-dev  I have downloaded both the versions of ns3 fr

Inorder, preorder, post order traversals using C

TRAVERSALS #include<stdio.h> #include<conio.h> typedef struct node { int data; struct node*left; struct node*right; }tree; tree* createtree(); tree* insert(tree*,tree*); void preorder(tree*); void inorder(tree*); void postorder(tree*); void main() { int ch; tree*bt; clrscr(); bt=createtree(); printf("\n \tBINARY TREE TRAVERSAL \n"); printf("\n \t1.traversals \n"); printf("\n \t2.exit\n"); printf("\n \tenter your choice \n"); scanf("%d",&ch); if(bt==NULL) { printf("\nbinary tree is empty\n"); return; } switch(ch) { case 1: printf("\n \t preorder traversal \n"); preorder(bt); printf("\n \t inorder traversal \n"); inorder(bt); printf("\n \t postorder traversal \n"); postorder(bt); break; case 2: printf("\n exit"); exit(0); } getch(); free(bt); } tree* createtree() { char ch; t

Implementation of Singly Linked List

// PRO GRAM TO IMPLEMENT SINGLY LINKED LIST\\ #include<stdio.h> #include<conio.h> #include<alloc.h> #include<stdlib.h> struct node { int data; struct node *link; }; void append(struct node **,int); void add_at_begin(struct node **,int); void del(struct node **,int); void in_middle(struct node **,int,int); int count(struct node *); void display(struct node *); void main() { int num,loc; char choice; struct node *p; p=NULL; do { clrscr(); printf("PROGRAM TO IMPLEMENT SINGLY LINKED LIST\n"); printf("---------------------------------------\n"); printf("\n 1. Create/appending the list"); printf("\n 2. Insert node at begining"); printf("\n 3. Insert node in middle"); printf("\n 4. Deleting a node"); printf("\n 5. Counting the no. of nodes"); printf("\n 6. Displaying the list"); printf("\n 7. Exit"); oper: gotox

Queue implementation using C

The readers are requested to check for any errors in the program (as the program is typed and copied from MS Word) QUEUE IMPLEMENTATION USING ARRAYS #include<stdio.h> #include<conio.h> void create(void); void display(void); void queue_in(void); void queue_out(void); void front_rear(void); int front,rear; int q[25]; void create() { int n; printf("Enter the number of elements in the queue \n"); scanf("%d",&n); printf("Enter the elements \n"); for(rear=0;rear<n;rear++) { scanf("%d",&q[rear]); } front=0; } void display() { if(rear!=0) { printf("The elements in queue \n"); for(front=0;front<rear;front++) { printf("%d",q[front]); } front=0; } else if(rear==0) printf("The queue is empty \n"); else if(rear==25) printf("The queue is full \n"); } void front_rear() { if(rear!=0) { printf("the front elem

Stack Implementation using C

The following two programs for the stack implementation using Array and Linked List, the readers are requested to report if there are any errors (syntax or semantic) //STACK IMPLEMENTATION USING ARRAYS\\ #include<stdio.h> #include<conio.h> void create(void); void push(0void); void pop(void); void display(void); void topelement(void); int a[25]; int top; void create() { int i; printf("Enter the number of elements in the stack \n"); scanf("%d",&top); printf("Enter the elements \n"); for(i=0;i<top;++i) { scanf("%d",&a[i]); } return; } void display() { int i; if((top!=0) && (top!=25)) { printf("The elements in the stack are \n"); for(i=top-1;i>=0;--i) printf("%d",a[i]); getch(); } } void push() { if(top==25) { printf("The stack is full \n"); } else { printf("Enter the element \n"); scanf("