Success Has No Fixed Formula You Need To Find Your Own

Phone Was Always A Dream,Until and Unless Someone Developed It.

Success Has Its Own Algorithm

Computer Is Not a Tool,But someone's Desire which has grown Bigger

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Labels

Saturday 17 November 2012

Want Any Lab Code

If U Want any lab code::::::



mail me :   adityadua1992@gmail.com

feedback are always welcome

LRU Page Replacement Algo in C

/* program to implement page replacement using LRU algorithm*/
#include<stdio.h>
int i,j=1,k,l,re[30],p[10],ch,no,nr,c,al=0,a,line=6;
struct re
{
          int st,l,ps;
}opr;
main()
{
          clrscr();
          printf("enter the length of the reference string:");
          scanf("%d",&nr);
          printf("enter the reference string:");
          for(i=1;i<=nr;i++)
          scanf("%d",&re[i]);
          printf("\n enter the number of frames:");
          scanf("%d",&no);
          clrscr();
          for(i=1;i<=no;i++)
          p[i]=-1;
          opr.st=0;
          for(i=1;i<=nr;i++)
          {
                   al=0;
                   opr.st=100;
                   for(c=1;c<=no;c++)
                   if(re[i]==p[c])
                   al++;
                   if(al==0)
                   {
                             if(j<=no)
                             {
                                      p[j]=re[i];
                                      j++;
                             }
                             else
                             {
                                      for(k=1;k<=no;k++)
                                      {
                                                for(ch=i-1;ch>=1;ch--)
                                                {
                                                          a=0;
                                                          if(p[k]==re[ch])
                                                          {
                                                                   a++;
                                                                   break;
                                                          }
                                                }
                                                if(a!=0)
                                                {
                                                          if(opr.st>ch)
                                                          {
                                                                   opr.st=ch;
                                                                   opr.l=re[ch];
                                                                   opr.ps=k;
                                                          }
                                                }
                                                else if(a==0)
                                                {
                                                          opr.ps=k;
                                                          break;
                                                }
                                      }
                                      p[(opr.ps)]=re[i];
                             }
                   }
                   display(no,p,i);
          }
          printf("\n");
          getch();
}

display(int no,int p[],int i)
{
          int k;
          if(i==1)
          {
                   printf("\t\t\t");
                   for(k=1;k<=no;k++)
                   printf("__");
          }
          printf("\n%d",re[i]);
          gotoxy(25,line++);
          for(k=1;k<=no;k++)
          {
                   printf("|");
                   printf("_");
                   if(p[k]!=-1)
                   printf("%d",p[k]);
                   else
                   printf(" ");
                   printf("_");
          }
          printf("|");
}

FCFS Disk Scheduling Algo implementation in C++

#include<iostream.h>
#include<conio.h>
#include<stdlib.h>
//#include<time.h>
int request[100],st,cylinders,n;
//time_t t;
void random(void )
{
  
    for(int i=0;i<n;i++)
    {
       //srand(request[(rand()%n)]);
       request[i]=rand()%cylinders+1;
    }
}  

void display(void )
{
     cout<<"\nThe requests are : \n";
     for(int i=0;i<n;i++)
        cout<<" "<<request[i]<<" ";
}
  
          
  
int main()
{
   int choice;
   void fcfs(void );
   void scan(void );
   cout<<"\nEnter no. of cylinders in hard disk and starting cylinder : ";
   cin>>cylinders>>st;
 
 
   cout<<"\npress 0 to generate random disk requests and any other no. to give your own requests : ";
   cin>>choice;
   if(choice==0)
   {
       cout<<"\nEnter no. of requests to generate randomly : ";
       cin>>n;
       random();
   }
   else
   {
       cout<<"\nEnter the cylinders requested (0 to break): \n";
       while(1)
       {
          cin>>request[n++];
          if(request[n-1]==0||n==100)
          {
              n--;
              break;
          
          }
      
       }    
   }
 
   cout<<"\nEnter the scheduling algo that you want to implement(0:FCFS,1:Scan) : ";              
   cin>>choice;
   switch(choice)
   {
      case 0:
           fcfs();
           break;    
      case 1:
           scan();
           break;  
      default:
         break;
   }
 
   getch();
   return 0;
}      
          
void fcfs(void )
{
     int total=0,i;              //no of cylinders traversed
     display();
     cout<<"\n\n The traversal is shown below : \n\n"<<st;
     for(i=0;i<n;i++)
     {
         cout<<"-->"<<request[i];
         total=total+abs(request[i]-st);
         st=request[i];  
     }
     cout<<"\n\nNo. of cylinders traversed : "<<total;
}                    

void scan(void )
{
     int total=0,i,j,temp;
     display();
     for(i=0;i<n;i++)
        for(j=0;j<n-1-i;j++)
        {
            if(request[j]>request[j+1])
            {
               temp=request[j];
               request[j]=request[j+1];
               request[j+1]=temp;
            }
        }
     display();
  
     cout<<" \nThe traversal is shown below : \n\n"<<st;
  
     if(st<request[0])
     {
        for(i=0;i<n;i++)
        {
           cout<<"-->"<<request[i];
           total+=abs(request[i]-st);
           st=request[i];
        }
     }
     else
     {
      
         i=0;
         temp=0;
         while(st>request[i++])
            temp++;
         for(i=temp;i<n;i++)
         {
          
                  
        
               cout<<"-->"<<request[i];
               total+=abs(request[i]-st);
               st=request[i];
  
               if(i==n-1)
               {
                
                  total=total+2*cylinders-request[i];
                  st=0;
                  i=0;
                  n=temp;
                  if(st!=cylinders)
                  {
                     cout<<"-->"<<cylinders;
                     cout<<"-->"<<1;
                  }
               }
          }    
                  
       }              
      
       cout<<"\nTotal cylinders traversed : "<<total;
  
}    

Saturday 3 November 2012

What Is A Leader????

WHAT IS A LEADER?
Yes what is a leader.
Some might think as a strange question but my question is correct.

Leader : A term which in our dictionary refers to 40+ old aged person who carries with himself his experience and knowledge who can tackle difficulties.

But Is he actually worthy of being called a Leader I doubt ?

We often see such characteristics in leader but the reverse is just true.

All those 40+ old mangers who are being talked of are just the power in position.A leader is one who inspire and motivates !!!!! Ya a bit bookish.
Lets simplfy In terms of Aditya Dua you are not a leader :

1.If you take the credit of your win.
2.If you fail you blame your team
3.If you believe you should head the team
4.If you believe you can get the work done by anger.

A person who heads the team is actually just a power head he may or may not be a good leader.
A leader is one who takes responsibility of all the failures that happens but forwards his teammates when it comes to collecting laurels.Even a junior level person in a team may be a leader because it requires skills of composure and able to tackle problems.

Dont worry I am not a leader I am doing just what I wish to convey