Saturday 31 August 2013

Digital Logic and Computer Design Free Download

Download DLD book in PDF for Free.Just Click the Image.


Visual C# Easy Lectures in PDF and PPT

Download All Lectures of C# for Free.Just Click the Image below.


Numerical Computing Easy Lectures in PDF and PPT

Download All Lectures of Numerical Computing for Free.Just Click the Image Below.


Java Easy Lectures in PDF and PPT

Download All Lectures of Java for Free.Just Click the Image Below.


Theory of Autometa Easy Lectures in PDF and PPT

Download All Lectures for Free.Just Click the Image.


OOAD Easy Lectures in PDF and PPT

Dowmload All Lectures of Object Oriented Analysis and Design for Free.Just Click the Image.


Operating System Easy Lectures in PDF and PPT

Download All Operating Systems Lectures for Free..
Just click the Picture.

Saturday 16 February 2013

Valentine Day, A day of Love

Valentines day is one of the most popular celebrations across the world. The reason is fairly simple. This is an occasion that has gradually evolved into a day that observes one of the most beautiful of all human relationships, love. It asks us to discover all those universal feelings and emotions that are somewhere representative of love Today this occasion has come to be recognised and accepted for this very quality.







Valentine's Day under attack in Pakistan


Conservatives in Pakistan tacked up posters urging people to boycott Valentine's Day on Thursday, saying it's a western-inspired event that's spreading vulgarity in their country. Romantics fought back with an arsenal of flowers, pink teddy bears and heart-shaped balloons.

For them, Valentine's Day is nothing but an occasion to encourage illicit relations between the country's young — unmarried — males and females. It's a sign that Western culture and values are eating away the fabric of Pakistan's traditional, Islamic society.




Awake Pakistan !! why are you attacking this Day while you adopted all others western culture ??
Infact you have all a sick mentality. 
If you celebrate YOUM-e-HAYA  then i request you all that please stop taking education in universities.
Universities shall be closed making a SAWAT culture in whole pakistan.
Girls education shall be banned.
I am not criticizing only girls the boys  are too banned for getting education, coeducation shall be banned, advanced education consisting of medical shall be banned,
Conservatives Pakistanis ! you don't think so that making this pakistan a TALIBAN culture will be a good step ??

Valentine Day will teach a lesson to all of us if we try to understand LOVE,

"Some days are so special that we should not miss them !!"

Sunday 18 November 2012

Converting Infix expression to Prefix expression



#include<iostream>

#include<string>

#include<stack>

#include<cstdio>



using namespace std;



bool precedence(string a, string b);

void infixToPrefix(string s);



int main()
{

        string s;

        cin>>s;



        infixToPrefix(s);



        return 0;

}

void infixToPrefix(string s)

{

        stack<string> operator1;        //operator stack

        stack<string> op;               //operand stack



        for(int i=0; i<s.size(); i++){

                string s6="";

                s6+=s[i];



                if(s[i]!='+' && s[i]!='-' && s[i]!='*' && s[i]!='/' && s[i]!='(' && s                   [i]!=')' && s[i]!='$'){

                        string s5;

                        s5=s[i];

                        op.push(s5);

                }else if(s[i]==')'){  //if right parentheses

                 //continue to pop operator nd operand stack

                 //till left parentheses is found

                        while(operator1.top()!="("){

                                string a=operator1.top();

                                operator1.pop();
                                string b=op.top();

                                op.pop();

                                string c=op.top();

                                op.pop();

                                string s2;

                                s2=a+c+b;

                                op.push(s2);

                        }

                        //pop the left parentheses

                        operator1.pop();





                }else if(s[i]=='(' || operator1.empty() || (!operator1.empty() &&                 
      precedence(s6,operator1.top())) ){

                        string s5;

                        s5=s[i];

                        operator1.push(s5);

                }else{

                

                        while((!operator1.empty()) && !(precedence(s6, operator1.top                        ()))){

                                string a=operator1.top();

                                operator1.pop();

                                string b=op.top();

                                op.pop();

                                string c=op.top();

                                op.pop();

                                string s2;

                                s2=a+c+b;

                                op.push(s2);

                        }

                        string s5="";

                        s5+=s[i];

                        operator1.push(s5);

                }



        }

        /*If the stack is not empty,

        continue to pop operator and operand stacks building

        prefix expressions until the operator stack is empty.*/

        while(!operator1.empty()){

                string a=operator1.top();

                operator1.pop();

                string b=op.top();

                op.pop();

                string c=op.top();

                op.pop();

                string s2;

                s2=a+c+b;

                op.push(s2);

        }



        while(!op.empty()){

                cout<<op.top()<<" ";

                op.pop();

        }

        cout<<endl;



       }



// returns true if precedence of a is more than b

// else return false    

bool precedence(string a, string b)

{

        int aa=0;

        int bb=0;

        if(a=="("){

                return false;

        }else if(b=="("){

                return true;

        }else if(b==")"){

                return true;

        }else if(a==")"){

                printf("undefined operation\n");

                return 0;

        }



        if(a=="+" || a=="-") aa=1;

        if(a=="*" || a=="/") aa=2;

        if(b=="+" || b=="-") bb=1;

        if(b=="*" || b=="/") bb=2;
        if(a=="$") aa=3;

        if(b=="$") bb=3;

        if(aa > bb) return true;

        return false;

}

Searching in Link List


#include<iostream>
#include<process.h>
using namespace std;
class Chain;
class Node
{
private:
int info;
Node *link;
friend class Chain;
};

class Chain
{
private:
Node * first;
public:
Chain()
{
first = NULL;
}
void head_insert(int val)
{
Node *temp;
temp = new Node;
temp -> info = val ;
temp -> link = first;
first = temp;
}

void display()
{
Node *temp;
temp = first;
while(temp != NULL )
{
cout<<temp -> info<<endl;
temp = temp -> link;
}
}

Node *search(int key)
{
bool found = false;
if(first == NULL)
{
cout<<"there is nothing to search, searching is impossible. . "<<endl;
exit(1);;
}
Node * temp;
temp = new Node;
temp = first ;
while( temp != NULL)
{
if ( temp ->info == key )
return temp;
else
temp = temp ->link;
}
if(found == true)
cout<<"Key is found. . ."<<endl;
else
cout<<"Key is not Found. . ."<<endl;

}

};


void main()
{
Chain ch;
ch.head_insert(45);
ch.head_insert(15);
ch.head_insert(75);
ch.head_insert(5);
ch.display();
//ch.search(5);
//ch.display();
Node * t = search(t);
//ch.display();
}

Insertion in Singly Link List


#include<iostream>
using namespace std;
template<class T>
class Chain;
template<class T>
class Node
{
private:
T info;
Node *link;
friend class Chain<T>;

};

template<class T>
class Chain
{
private:
Node<T> *first;
public:
Chain()
{
first = NULL;
}
void head_insert(T val)
{
Node<T> *temp;
temp = new Node<T>;
temp -> info = val ;
temp -> link = first;
first = temp;
}

void display()
{
Node<T> *temp;
temp = first;
while(temp != NULL )
{
cout<<temp -> info<<endl;
temp = temp -> link;
}
}
};

void main()
{
Chain<int> ch;
ch.head_insert(5);
ch.head_insert(10);
ch.head_insert(12);
cout<<"the info part of the nodes are : "<<endl;
ch.display();
}

Insertion and Deletion in Arrays


#include <iostream.h>
const int SIZE = 10;
class Array
{
private:
int a[SIZE];
int n;
public:
Array()
{
for (int i=0;i<SIZE;i++)
a[i] = 0;
n = 0;
}
void read()
{
int num;
cout<<"how many values you want to enter ? "<<endl;
cin>>num;
for(int i = 0; i<num; i++)
{
cout<<"enter values "<<endl;
cin>>a[i];
}
n = num;
}
void display()
{
for (int i=0;i<n;i++)
cout << a[i];
cout << endl;
}
void del()
{
int index;
cout << "Enter index";
cin >> index;
for (int i=index;i<n-1;i++)
a[i] = a[i+1];
n--;
display();
}
void insert()
{
int index;
cout << "Enter index";
cin >> index;
for (int i=n;i>index;i--)
a[i] = a[i-1];
cout << "Enter Value";
cin >> a[i];
n++;
display();
}


};
void main()
{
Array itm, a2, a3;
itm.read();
itm.display();
a2.read();
a2.display();
itm.del();
itm.insert();
}

Merging Two Arrays in C++


#include <iostream.h>
const int SIZE = 10;
class Array
{
private:
int a[SIZE];
int n;
public:
Array()
{
for (int i=0;i<SIZE;i++)
a[i] = 0;
n = 0;
}
void read()
{
int num;
cout<<"how many values you want to enter ? "<<endl;
cin>>num;
for(int i = 0; i<num; i++)
{
cout<<"enter values: "<<endl;
cin>>a[i];
}
n = num;
}
void display()
{
for (int i=0;i<n;i++)
cout << a[i];
cout << endl;
}
void merge(Array a1, Array a2)
{
int i=0,j=0;

while (i < a1.n)
{
a[n] = a1.a[i];
i++; n++;
}
while (j < a2.n)
{
a[n] = a2.a[j];
j++; n++;
}
}
};
void main()
{
Array itm, a2, a3;
itm.read();
itm.display();
cout<<"for 2nd array ";
a2.read();
a2.display();
a3.merge(itm,a2);
a3.display();

}