Posts

Showing posts from August, 2015

c program to implement queue operations using array

#include<stdio.h> //#include<conio.h> #define MAX 10 int queue[MAX]; int front =-1,rear=-1; void insert(void); int delete_element(void); int peep(void); void display(void); main() {     int option,val;     do{         printf("\n *******MAIN MENU**********");         printf("\n 1.Insert an element");         printf("\n 2.Delete an element");         printf("\n 3.peep");         printf("\n 4.display");         printf("\n 5.Exit");         printf("\n********************************");     printf("\n Enter your option\n");     scanf("%d",&option);     switch(option)     {         case 1:             insert();             break;             case 2:             val=delete_element();             printf("\n The number that was deleted is :%d",val);             break;             case 3:                 val=peep();                 printf("\n

stack application infix to postfix

#include<stdio.h> //#include<conio.h> #include<ctype.h> #define MAX 100 typedef struct stack {  int data[MAX];  int top; }stack; int priority(char); void init(stack *); int empty(stack *); int full(stack *); char pop(stack *); void push(stack *,char); char top(stack *); void main() { stack s; char x; int token; init(&s); //clrscr(); printf("nEnter infix expression:");   while((token=getchar())!='n')   {     if(isalnum(token))        printf("%c",token);     else        if(token == '(')            push(&s,'(');        else        {          if(token == ')')              while((x=pop(&s))!='(')              printf("%c",x);          else          {          while(priority(token)<=priority(top(&s)) && !empty(&s))              {              x=pop(&s);              printf("%c",x);              }          push(&s,token);          }        }   }   while(!emp

Stack implementation using linked list

#include <stdio.h> #include <stdlib.h> struct Node {     int Data;     struct Node *next; }*top; void popStack() {     struct Node *temp, *var=top;     if(var==top)     {         top = top->next;         free(var);     }     else     printf("\nStack Empty"); } void push(int value) {     struct Node *temp;     temp=(struct Node *)malloc(sizeof(struct Node));     temp->Data=value;     if (top == NULL)     {          top=temp;          top->next=NULL;     }     else     {         temp->next=top;         top=temp;     } } void display() {      struct Node *var=top;      if(var!=NULL)      {           printf("\nElements are as:\n");           while(var!=NULL)           {                printf("\t%d\n",var->Data);                var=var->next;           }      printf("\n");      }      else      printf("\nStack is Empty"); } int main(int argc, char *argv[]) {      int i=0;      top=NULL;      printf(" \n1.

stack,queue and linked list

Stack implementation using 1.Array 2.structure 3.linked list Application 1.Decimal to binary 2.infix to postfix 3.infix to prefix same applies to the queue,queue can be implemented using 1.Array 2.structure 3.linked list

How to run graphics program or Run "graphics.h" in Ubuntu

Image
if you want to run graphics.h in ubuntu and make some programs using graphs.h in ubuntu do the needfull steps below- Steps: 1. Make sure that you have basic compilers installed. For this run the command: sudo apt-get update sudo apt-get upgrade sudo apt-get install build-essential 2. Install few packages that required. Run the command: sudo apt-get install libsdl-image1.2 libsdl-image1.2-dev guile-1.8 guile-1.8-dev libsdl1.2debian libart-2.0-dev libaudiofile-dev libesd0-dev libdirectfb-dev libdirectfb-extra libfreetype6-dev libxext-dev x11proto-xext-dev libfreetype6 libaa1 libaa1-dev libslang2-dev libasound2 libasound2-dev 3. Now download  libgraph . Copy libgraph-1.0.2.tar.gz to your home folder. Right click on it and select "Extract Here". Then run following commands one by one. cd libgraph-1.0.2 ./configure sudo make sudo make install sudo cp /usr/local/lib/libgraph.* /usr/lib 4 Now Ubuntu is ready to run graphics program. T

mouse setting not appearing in ubuntu or change wireless mouse setting in ubuntu

To change wireless mouse setting in ubuntu just plug a wired mouse then go to system settings and click on mouse and touchpad setting there will be mouse option available now from where you can change wirless mouse setting like fast or slow before plug in wired mouse there will be no option for mouse setting so you must plug a wired mouse to do so.

storage space running out or Insufficient Storage Available android solution

In android handset you will always get a message storage space running out or insufficient storage to get rid of this message just go to here settings-Apps- Manage apps now check which application is showing high usage MB and click on that now app now click clear data and press ok repeat the same steps for all the apps that show high MB usage this will solve your problem alternatively you can move some of the apps to memory card from there.

How to intergate xtreme download manager with flahgot

I'm using Ubuntu 14.4 and xtreme download manager . I know there is browser integration add on for it. but I want to integrate it with flashgot add on . I find xdm in flashgot options but it's useless no download starts only the main window pops up !  install flashgot then go to  Firefox > Tools > Flashgot > More options    1. General tap > Press Add button > XDM2 as name    2.Executable path -for this go to the folder where you have saved XDM and select java inside the folder jre/bin    3.Command line arguments template :-jar /usr/lib/xdman/xdm.jar [URL] Now goto Extentions and edit flashgot preferences. Under General Tab In Download Manager select "XDM2" and under Download tap Select "Intercept all Downloads". in next tab Flashgot Media select XDM2 and Click   OK.  

c program for linked list

#include<stdio.h> #include<stdlib.h> //for malloc.h for allocating memory dynamically struct node { int data; struct node *next; }; struct node *start=NULL; struct node *create_ll(struct node *); struct node *display(struct node *); main() { int option; do{ printf("\n\n******MAIN MENU******"); printf("\n1.create linked list"); printf("\n2.Display the linked list"); printf("\n3..Enter your option\n\n"); scanf("%d",&option); switch(option) { case 1: start=create_ll(start); printf("\n LINKED LIST CREATED"); break; case 2: start=display(start); break; } }while(option!=3); return 0; } struct node *create_ll(struct node *start) { struct node *new_node; // we always declare pointer in strructure using keyword struct folwed by the function name int num; printf("\n Enter -1 to end"); printf("\n Enter the data:"); scanf("%d",&num); while(num!=-1)

Call by value and call by reference in C

call by value- #include<stdio.h> void add(int n); //function declaration int main() { int num =2; printf("\n The value of num before the function is %d",num); add(num); //function call printf("\n The value of num after calling the function =%d",num); return 0; } // function difination void add(int n) //function header { n=n + 10; printf("\n The value of num in the called function =%d",n); } Output-  The value of num before the function is 2  The value of num in the called function =12  The value of num after calling the function =2 call by reference- #include<stdio.h> void add(int *n); // function declaration int main() { int num =2; printf("\n The value of num before calling the function =%d",num); add(&num); printf("\n The value after calling the function =%d",num); return 0; } //function defination void add(int *n) //function header { n=*n + 10; printf("\n The value of

c program to implement stack to perform push(insert) peep(display first element) and pop(delete).

#include<stdio.h> #define MAX 10 int st[MAX],top=-1; void push(int st[],int val); int pop(int st[]); int peep(int st[]); // peep display the topmost element from stack void display(int st[]); int main() { int val,option; do { printf("\n*****stack menu*****\n"); printf("\n1.push\n2.pop\n3.peep\n4.display\n5.exit\n"); printf("\nEnter your choice\n"); scanf("%d",&option); switch(option) { case 1: printf("\nEnter the number to be pushed on to the stack:"); scanf("%d",&val); push(st,val); //fn call break; case 2:val=pop(st); printf("\nThe value deleted from the stack is:%d",val); break; case 3: val=peep(st); printf("\n The value stored at the top of the stack is:%d",val); break; case 4:display(st); break; } }while (option!=5); return 0; } void push(int st[],int val) { if(top==MAX-1) { printf("\n Stack overflow"); } else { top++; st[top]=val;