My experience with Naukri.com :
After 6 months in my first job I learned some new skills and I thought I should update them on linkedin or Naukri.com, not because I was looking to change my job just because I fuc***g acquired some new skills.
After
a few days of my update my manager calls me to his office and asks me
why do I want to change job? I was shocked at first I did not understand
why he was saying that. I just assured him that I was very much
satisfied with my job and have no reason to look for another,which was
100% truth at that point of time .
Thinking
about the incident later it became very clear that the only reason for
him to think that I am looking for a change is my naukri profile.
Later
when I talked with some of my senior colleagues things became crystal
clear. HR of my company takes employee attrition very seriously and they
have premium consultant accounts at all major job search websites and continuously monitor employee activities.
This can happen to you too, so do not post anything on these fu****g sites unless you are very sure of leaving the company.
Anyways these site are pretty much useless and only shows useless job openings.
Saturday, June 1, 2013
Saturday, May 18, 2013
Quick sort c++ code
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
int count=0;
int partition(int a[],int p,int r)
{
int x,j;
x=a[r];
int i=p-1;
for(j=p;j<r-1;j++)
{
if(a[j]<=x)
{
i=i+1;
int t=a[i];
a[i]=a[j];
a[j]=t;
}
}
int g=a[i+1];
a[i+1]=a[r];
a[r]=g;
return(i+1);
}
int quicksort( int A[],int p,int r)
{
int q;
if(p<r)
{
q=partition(A,p,r);
quicksort(A,p,q-1);
quicksort(A,q+1,r);
}
}
void main()
{
int a[20],n;
cout<<"Enter the size of the array: " ;
cin>>n;
cout<<"ENTER ARRAY ELEMENTS: \n";
for(int i=0; i<n; i++)
cin>>a[i];
quicksort(a,0,n-1);
cout<<"YOUR SORTED ARRAY IS: \n";
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
getch();
}
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
int count=0;
int partition(int a[],int p,int r)
{
int x,j;
x=a[r];
int i=p-1;
for(j=p;j<r-1;j++)
{
if(a[j]<=x)
{
i=i+1;
int t=a[i];
a[i]=a[j];
a[j]=t;
}
}
int g=a[i+1];
a[i+1]=a[r];
a[r]=g;
return(i+1);
}
int quicksort( int A[],int p,int r)
{
int q;
if(p<r)
{
q=partition(A,p,r);
quicksort(A,p,q-1);
quicksort(A,q+1,r);
}
}
void main()
{
int a[20],n;
cout<<"Enter the size of the array: " ;
cin>>n;
cout<<"ENTER ARRAY ELEMENTS: \n";
for(int i=0; i<n; i++)
cin>>a[i];
quicksort(a,0,n-1);
cout<<"YOUR SORTED ARRAY IS: \n";
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
getch();
}
Bucket sort C++ code
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<stdio.h>
#include<conio.h>
class node
{
public:
float info;
node *next,*prev;
node(){next=prev=0;}
node(int n, node *ptr=0, node *ptr1=0)
{
info=n;
next=ptr;
prev=ptr1;
}
};
/* sort the link list of elements*/
void isort(node *head)
{
if (head == 0)
return;
float key;
node *j,*i, *q=0;
for(i=head->next;i!=0;i=i->next)
{
q=0;
key = i->info;
j=i->prev;
while(j!=0 && key < (j->info) )
{
j->next->info=j->info;
q = j;
j=j->prev;
}
if(q!=0)
q->info = key;
}
}
void bucket_sort(float *a,int n)
{
/* create buckets */
node* *b = new node* [n];
for(int i=0; i<n;i++)
b[i]=0;
/* step 2 begins - insert a[i] into buckets */
for(int i=0;i<n;i++)
{
int index=n*a[i];
node *temp=new node(sizeof(node));
temp->info=a[i];
if(b[index]==NULL)
{
b[index]=temp;
}
else
{
temp->next=b[index];
b[index]->prev=temp;
b[index]=temp;
}
} // end of for
/* step 2 ends */
/* step 3 begins - sort each bucket */
for(int i=0; i<n;i++)
{
isort(b[i]);
}
/* step 3 ends */
/* step 4 begins - concatenate all the buckets */
node *trav=0;
cout<<"\n\nSorted array is: \n";
for(int i=0; i<n;i++)
{
trav = b[i];
while(trav != 0)
{
cout<<trav->info<<" ";
trav = trav->next;
}
}
/* step 4 ends */
}
void main()
{
clrscr();
int n;
float *a;
cout<<"\n\t Enter the size of array : ";
cin>>n;
cout<<"\n\t Enter the elements of an array :\n";
a=new float[n];
for(int l=0;l<n;l++)
cin>>a[l];
cout<<"\n\t Unsorted array is..\n";
for(l=0;l<n;l++)
cout<<a[l]<<" ";
cout<<"\n" ;
/* sort lements using buckt sort */
bucket_sort(a,n);
getch();
}
Radix sort c++ code
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
#include<string.h>
void countingsort(char s[][20],int a[],char b[][20],int n,int k)
{ int c[100];
int l,j,i;
for( l=0;l<=k;l++)
c[l]=0;
for(j=0;j<n;j++)
c[a[j]]=c[a[j]]+1;
for(i=1;i<=k;i++)
c[i]=c[i]+c[i-1];
for(j=n-1;j>=0;j--)
{
strcpy(b[c[a[j]]-1],s[j]);
c[a[j]]=c[a[j]]-1;
}
for(i=0;i<n;i++)
{
strcpy(s[i],b[i]);
}
}
void radixsort(char s[][20],int d,int n)
{ int z[20];
char b[20][20];
int i,j,k;
j=d-1;
for(i=1;i<=d;i++)
{
for(k=0;k<n;k++)
{
z[k]=s[k][j]-48;
}
--j;
countingsort(s,z,b,n,9);
}
cout<<"Output"<<endl;
for(i=0;i<n;i++)
cout<<b[i]<<endl;
}
void main()
{
int n,i,d;
char a[20][20];
cout<<"Entr the size of the array"<<endl;
cin>>n;
cout<<"Enter the no. of digits"<<endl;
cin>>d;
cout<<"Enter its element"<<endl;
for(i=0;i<n;i++)
cin>>a[i];
radixsort(a,d,n);
getch();
}
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
#include<string.h>
void countingsort(char s[][20],int a[],char b[][20],int n,int k)
{ int c[100];
int l,j,i;
for( l=0;l<=k;l++)
c[l]=0;
for(j=0;j<n;j++)
c[a[j]]=c[a[j]]+1;
for(i=1;i<=k;i++)
c[i]=c[i]+c[i-1];
for(j=n-1;j>=0;j--)
{
strcpy(b[c[a[j]]-1],s[j]);
c[a[j]]=c[a[j]]-1;
}
for(i=0;i<n;i++)
{
strcpy(s[i],b[i]);
}
}
void radixsort(char s[][20],int d,int n)
{ int z[20];
char b[20][20];
int i,j,k;
j=d-1;
for(i=1;i<=d;i++)
{
for(k=0;k<n;k++)
{
z[k]=s[k][j]-48;
}
--j;
countingsort(s,z,b,n,9);
}
cout<<"Output"<<endl;
for(i=0;i<n;i++)
cout<<b[i]<<endl;
}
void main()
{
int n,i,d;
char a[20][20];
cout<<"Entr the size of the array"<<endl;
cin>>n;
cout<<"Enter the no. of digits"<<endl;
cin>>d;
cout<<"Enter its element"<<endl;
for(i=0;i<n;i++)
cin>>a[i];
radixsort(a,d,n);
getch();
}
priority queue c++ code
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
#include<process.h>
int n;
void maxheapinsert(int [],int key);
void heapincreasekey(int a[],int i,int key);
int heapextractmax(int a[]);
int prioritymaximum(int a[]);
void max_heapify(int a[20],int n1);
int heapsize;
int left(int i)
{
return(2*i);
}
int right(int i)
{
return((2*i)+1);
}
void max_heapify(int A[20],int i)
{
int l,r,largest,s;
l=left(i);
r=right(i);
if(l<=heapsize && A[l]>A[i])
largest=l;
else
largest=i;
if(r<=heapsize && A[r]>A[largest])
largest=r;
if(largest!=i)
{
s=A[i];
A[i]=A[largest];
A[largest]=s;
max_heapify(A,largest);
}
}
int prioritymaximum(int a[])
{
return a[1];
}
int heapextractmax(int a[])
{
if(n<0)
cout<<"Underflow"<<endl;
int max=a[1];
a[1]=a[n];
n--;
max_heapify(a,1);
return max;
}
void heapincreasekey(int a[],int i,int k)
{
if(k<a[i])
cout<<"New key is smaller than current key"<<endl;
a[i]=k;
while(i>1&&a[i/2]<a[i])
{
int t=a[i];
a[i]=a[i/2];
a[i/2]=t;
i=i/2;
}
}
void maxheapinsert(int a[],int k)
{
n=n+1;
a[n]=-999;
heapincreasekey(a,n,k);
}
void main()
{
int x,i2,c,key,a[20];
a[0]=-999;
int m;
for( ; ; )
{
cout<<"Menu:"<<endl;
cout<<"1:To get the maximum value"<<endl;
cout<<"2:To extract maximum value"<<endl;
cout<<"3:To increase key value"<<endl;
cout<<"4:To insert new value"<<endl;
cout<<"5:Exit:"<<endl;
cout<<"Enter your choice"<<endl;
cin>>c;
switch(c)
{
case 1:
x=prioritymaximum(a);
cout<<x<<endl;
break;
case 2:
m=heapextractmax(a);cout<<"process with priority "<<m<<" is being processed";
break;
case 3:
cout<<"Enter the index value that is to modified "<<endl;
cin>>i2;
cout<<"Enter the new value"<<endl;
cin>>key;
heapincreasekey(a,i2,key);
cout<<"Value modified"<<endl;
break;
case 4:
cout<<"Enter the new value"<<endl;
cin>>key;
maxheapinsert(a,key);
break;
case 5:
exit(0);
default:
cout<<"Wrong code"<<endl;
}
}
getch();
}
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
#include<process.h>
int n;
void maxheapinsert(int [],int key);
void heapincreasekey(int a[],int i,int key);
int heapextractmax(int a[]);
int prioritymaximum(int a[]);
void max_heapify(int a[20],int n1);
int heapsize;
int left(int i)
{
return(2*i);
}
int right(int i)
{
return((2*i)+1);
}
void max_heapify(int A[20],int i)
{
int l,r,largest,s;
l=left(i);
r=right(i);
if(l<=heapsize && A[l]>A[i])
largest=l;
else
largest=i;
if(r<=heapsize && A[r]>A[largest])
largest=r;
if(largest!=i)
{
s=A[i];
A[i]=A[largest];
A[largest]=s;
max_heapify(A,largest);
}
}
int prioritymaximum(int a[])
{
return a[1];
}
int heapextractmax(int a[])
{
if(n<0)
cout<<"Underflow"<<endl;
int max=a[1];
a[1]=a[n];
n--;
max_heapify(a,1);
return max;
}
void heapincreasekey(int a[],int i,int k)
{
if(k<a[i])
cout<<"New key is smaller than current key"<<endl;
a[i]=k;
while(i>1&&a[i/2]<a[i])
{
int t=a[i];
a[i]=a[i/2];
a[i/2]=t;
i=i/2;
}
}
void maxheapinsert(int a[],int k)
{
n=n+1;
a[n]=-999;
heapincreasekey(a,n,k);
}
void main()
{
int x,i2,c,key,a[20];
a[0]=-999;
int m;
for( ; ; )
{
cout<<"Menu:"<<endl;
cout<<"1:To get the maximum value"<<endl;
cout<<"2:To extract maximum value"<<endl;
cout<<"3:To increase key value"<<endl;
cout<<"4:To insert new value"<<endl;
cout<<"5:Exit:"<<endl;
cout<<"Enter your choice"<<endl;
cin>>c;
switch(c)
{
case 1:
x=prioritymaximum(a);
cout<<x<<endl;
break;
case 2:
m=heapextractmax(a);cout<<"process with priority "<<m<<" is being processed";
break;
case 3:
cout<<"Enter the index value that is to modified "<<endl;
cin>>i2;
cout<<"Enter the new value"<<endl;
cin>>key;
heapincreasekey(a,i2,key);
cout<<"Value modified"<<endl;
break;
case 4:
cout<<"Enter the new value"<<endl;
cin>>key;
maxheapinsert(a,key);
break;
case 5:
exit(0);
default:
cout<<"Wrong code"<<endl;
}
}
getch();
}
Merge sort C++ code
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
void merge(int a[], int p, int q, int r)
{
int i,j;
int n1, n2;
n1=q-p+1;
n2=r-q;
int L[21], R[21];
for(int i=0; i<n1; i++)
L[i]=a[p+i];
for(int j=0; j<n2; j++)
R[j]=a[q+j+1];
L[n1]=999;
R[n2]=999;
i=0; j=0;
for(int k=p; k<=r; k++)
{
if(L[i]<=R[j])
{
a[k]=L[i];
i++;
}
else
{
a[k]=R[j];
j++;
}
}
}
void merge_sort(int a[], int p,int r)
{
int q;
if(p<r)
{
q=(p+r)/2;
merge_sort(a, p, q);
merge_sort(a, q+1, r);
merge(a, p, q, r);
}
}
void main()
{
int a[20],n;
cout<<"Enter the size of the array: " ;
cin>>n;
cout<<"ENTER ARRAY ELEMENTS: \n";
for(int i=0; i<n; i++)
cin>>a[i];
merge_sort(a,0,n-1);
cout<<"YOUR SORTED ARRAY IS: \n";
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
getch();}
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
void merge(int a[], int p, int q, int r)
{
int i,j;
int n1, n2;
n1=q-p+1;
n2=r-q;
int L[21], R[21];
for(int i=0; i<n1; i++)
L[i]=a[p+i];
for(int j=0; j<n2; j++)
R[j]=a[q+j+1];
L[n1]=999;
R[n2]=999;
i=0; j=0;
for(int k=p; k<=r; k++)
{
if(L[i]<=R[j])
{
a[k]=L[i];
i++;
}
else
{
a[k]=R[j];
j++;
}
}
}
void merge_sort(int a[], int p,int r)
{
int q;
if(p<r)
{
q=(p+r)/2;
merge_sort(a, p, q);
merge_sort(a, q+1, r);
merge(a, p, q, r);
}
}
void main()
{
int a[20],n;
cout<<"Enter the size of the array: " ;
cin>>n;
cout<<"ENTER ARRAY ELEMENTS: \n";
for(int i=0; i<n; i++)
cin>>a[i];
merge_sort(a,0,n-1);
cout<<"YOUR SORTED ARRAY IS: \n";
for(int i=0;i<n;i++)
cout<<a[i]<<endl;
getch();}
Insertion sort C++ code
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
void insertion_sort(int a[10],int n)
{
int j,key,i;
for( j=1;j<n;j++)
{
key=a[j];
i=j-1;
while(i>=0&&a[i]>key)
{
a[i+1]=a[i];
i=i-1;
}
a[i+1]=key;
}
}
void main()
{
int a[20],n;
cout<<"enter the size of array\n";
cin>>n;
cout<<"enter the elements\n";
for(int i=0;i<n;i++)
cin>>a[i];
insertion_sort(a,n);
cout<<"sorted array is\n";
for(int i=0;i<n;i++)
cout<<a[i]<<",";
getch();
}
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
#include<iostream.h>
#include<conio.h>
void insertion_sort(int a[10],int n)
{
int j,key,i;
for( j=1;j<n;j++)
{
key=a[j];
i=j-1;
while(i>=0&&a[i]>key)
{
a[i+1]=a[i];
i=i-1;
}
a[i+1]=key;
}
}
void main()
{
int a[20],n;
cout<<"enter the size of array\n";
cin>>n;
cout<<"enter the elements\n";
for(int i=0;i<n;i++)
cin>>a[i];
insertion_sort(a,n);
cout<<"sorted array is\n";
for(int i=0;i<n;i++)
cout<<a[i]<<",";
getch();
}
Tuesday, May 14, 2013
Time/Space complexity of sorting algorithms
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
Sorting
Algorithm | Data Structure | Time Complexity | Worst Case Auxiliary Space Complexity | ||||
---|---|---|---|---|---|---|---|
Best | Average | Worst | Worst | ||||
Quicksort | Array | O(n log(n)) |
O(n log(n)) |
O(n^2) |
O(log(n)) |
||
Mergesort | Array | O(n log(n)) |
O(n log(n)) |
O(n log(n)) |
O(n) |
||
Heapsort | Array | O(n log(n)) |
O(n log(n)) |
O(n log(n)) |
O(1) |
||
Bubble Sort | Array | O(n) |
O(n^2) |
O(n^2) |
O(1) |
||
Insertion Sort | Array | O(n) |
O(n^2) |
O(n^2) |
O(1) |
||
Select Sort | Array | O(n^2) |
O(n^2) |
O(n^2) |
O(1) |
||
Bucket Sort | Array | O(n+k) |
O(n+k) |
O(n^2) |
O(nk) |
||
Radix Sort | Array | O(nk) |
O(nk) |
O(nk) |
O(n+k) |
Six Interesting Facebook Tricks That You Might Not Know
Almost everyone of us have
now been using Facebook since years, but there are a lot of things that
we still are unaware of. Here are 6 interesting tricks that you might
not know about Facebook.
1.Trick to update blank status:
Simply enter @[3:3: ] in your status update box. To update your blank status as a long statement, paste the code one below another as showed below:
@[3:3: ]
@[3:3: ]
@[3:3: ]
2. Download Full Facebook Album in a single click:
Now you can download a full Facebook album in a single click. Just visit this app called Facebook2zip. Facebook2zip.com
3. Go offline for a particular person:
Instead of going offline for all of your friends, now you can go OFFLINE for a particular person. Just open that person's chat pane and click on the settings button. You'll find a button saying 'Turn off chat for xyz', just click and you are done.
4. Facebook status update from Desired Device (via iPhone without an iPhone):
Login to your Facebook account and update your status, just visit and search for your desired device on top right corner of the page: http://statusvia.org/apps/Facebook/
5. Update Facebook status with symbols:
Facebook status symbols do not have to use the inbuilt facility. But we're cool with the status message through the use of symbols is a Facebook trick. Just visit: http://fsymbols.com/all/
Then double click copy and paste the desired symbol in your status.
6. Post Facebook update in blue
Paste the below mentioned code in your status update box and write your text in place of 'your text':
@@[1:[0:1: your text]]
Source - http://www.efytimes.com/e1/fullnews.asp?edid=106004&ntype=mor&edate=5/14/2013
1.Trick to update blank status:
Simply enter @[3:3: ] in your status update box. To update your blank status as a long statement, paste the code one below another as showed below:
@[3:3: ]
@[3:3: ]
@[3:3: ]
2. Download Full Facebook Album in a single click:
Now you can download a full Facebook album in a single click. Just visit this app called Facebook2zip. Facebook2zip.com
3. Go offline for a particular person:
Instead of going offline for all of your friends, now you can go OFFLINE for a particular person. Just open that person's chat pane and click on the settings button. You'll find a button saying 'Turn off chat for xyz', just click and you are done.
4. Facebook status update from Desired Device (via iPhone without an iPhone):
Login to your Facebook account and update your status, just visit and search for your desired device on top right corner of the page: http://statusvia.org/apps/Facebook/
5. Update Facebook status with symbols:
Facebook status symbols do not have to use the inbuilt facility. But we're cool with the status message through the use of symbols is a Facebook trick. Just visit: http://fsymbols.com/all/
Then double click copy and paste the desired symbol in your status.
6. Post Facebook update in blue
Paste the below mentioned code in your status update box and write your text in place of 'your text':
@@[1:[0:1: your text]]
Source - http://www.efytimes.com/e1/fullnews.asp?edid=106004&ntype=mor&edate=5/14/2013
Tuesday, May 7, 2013
Search algorithms time complexity table
For in-depth understanding of Data Structure and Algorithm concepts refer :
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
1) INTRODUCTION TO ALGORITHMS by Coremen Introduction to Algorithms, 3rd Edition From flipkart.com
Introduction to Algorithms, 3rd Edition From amazon.com
Introduction to Algorithms from amazon.in
2) DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron - DATA STRUCTURES USING C AND C++ by Tenenbaum M Aaron from flipkart.com
Data Structures Using C and C++ (2nd Edition) from amazon.com
Data Structures Using C and C++ from amazon.in
Searching
Algorithm | Data Structure | Time Complexity | Space Complexity | |||
---|---|---|---|---|---|---|
Average | Worst | Worst | ||||
Depth First Search (DFS) | Graph of |V| vertices and |E| edges | - |
O(|E| + |V|) |
O(|V|) |
||
Breadth First Search (BFS) | Graph of |V| vertices and |E| edges | - |
O(|E| + |V|) |
O(|V|) |
||
Binary search | Sorted array of n elements | O(log(n))
|
O(log(n))
|
O(1)
|
||
Linear (Brute Force) | Array | O(n) |
O(n) |
O(1) |
||
Shortest path by Dijkstra, using a Min-heap as priority queue |
Graph with |V| vertices and |E| edges | O((|V| + |E|) log |V|) |
O((|V| + |E|) log |V|) |
O(|V|) |
||
Shortest path by Dijkstra, using an unsorted array as priority queue |
Graph with |V| vertices and |E| edges | O(|V|^2) |
O(|V|^2) |
O(|V|) |
||
Shortest path by Bellman-Ford | Graph with |V| vertices and |E| edges | O(|V||E|) |
O(|V||E|) |
O(|V|) |
Thursday, April 18, 2013
C/C++ interview question --- question 3
Why we define pointer with a type in C?
A pointer only contains an address then why do we need different data types for it ? why not a single data type for all pointers?
ANS:
Pointer data type is used in pointer arithmetic.
e.g. :
int * p1;
char * p2;
p1 = p1 + 1;
p2 = p2 +1;
value of p1 increases by sizeof(int) which is 2 bytes and p2 increases by sizeof(char) which is 1 bytes.
A pointer only contains an address then why do we need different data types for it ? why not a single data type for all pointers?
ANS:
Pointer data type is used in pointer arithmetic.
e.g. :
int * p1;
char * p2;
p1 = p1 + 1;
p2 = p2 +1;
value of p1 increases by sizeof(int) which is 2 bytes and p2 increases by sizeof(char) which is 1 bytes.
Saturday, April 13, 2013
C/C++ interview question --- question 2
What are the disadvantages of inlining all functions in C?
few reasons why it would be a bad idea:
- Code size increases greatly especially when inlining large functions
- Instruction
caches become much less effective because you are always fetching new
instructions from higher up in the memory hierarchy and never re-using
instructions.
- Register spilling would increase the stack usage
but then, if you just had normal functions, you would have to pop/push
activation records onto the stack instead of spilling. So, this last
tradeoff is highly dependent on the code and the compiler.
HOW TO START PREPARATION FOR IAS
HOW TO START PREPARATION
As per your sugestions.......m discussing this query again.....
I WILL DISCUSS IT SECTION WISE........lets start wid INDIAN POLITY
Start with DD Basu nd then Subhash Kashyap by NBT.
Then “Perspectives On Indian Constitution” edited by Subhash Kashyap.
Indian Constitution At Work (NCERT Class XI textbook in political science, newer syllabus)
Politics in India since Independence( NCERT Class XII textbook in political science, newer syllabus)
Democracy in India: Issues and Challenges (NCERT Class XIIth textbook in Political science, older syllabus)
Democratic politics (NCERT Class Xth, newer syllabus)
**Modern History-
Began with ‘Modern India’ by Bipin Chandra, supplemented by ‘India’s struggle for Independence’ by Bipin Chandra, Mukherjee, Panikkar. Spectrum’s book on Modern India
For Ancient India, :::-- ‘Ancient India’ by R.S. Sharma (a wonderfully concise book where every single word is important) and supplemented sparsely by
‘TheWonder that was India’ by A.L. Basham.
For Medieval India, Satish Chandra’s two volumes on Medieval India quite sufficient.
Apart from this, another famous standard text is ‘An Advanced History of India’ by Majumdar, Raychaudhuri and Dutta.
--Geography
Mapping has come out to be a real challenge in recent years. The strategy to handle India map question is again practice. What one should do is to practice map everyday for one hour. Start from mountains first day, then rivers, then waterfalls and then important cities and so on. Also mark important places which are in news from news paper. Regular practice of mapping will make you more confidant. Go through atlas also
Magzine 'Geography and you' is must read, ‘Geography And You’ is available in printed as well as PDF format.
For general geography and world geography the same wizard book on geography will be more than sufficient. Special editions on these topics are published in Competition Wizard magazine which can be helpful for quick revision (only for prelims)
Indian Economy Special Issue by Pratiyogita Darpan especially for prelims.
For reference- Indian Economy by Mishra and Puri.
International affairs/ Bilateral Issues-
Contemporary World Politics( Class XIIth NCERT)
International relations chapters in the book
Democracy in India: Issues and Challenges (NCERT Class XIIth textbook in Political Science, older syllabus)
Science and technology
Science and technology section is very vast and unpredictable. . Whatever can be covered from newspapers should be done. Defence, environment, nuclear and space science are some important sections which need special emphasis.
Monthly Magzines
Pritiyogita Darpan (PD), Competition wizard and Civil services times
As far as newspaper is concerned, HINDU is ultimate
As per your sugestions.......m discussing this query again.....
I WILL DISCUSS IT SECTION WISE........lets start wid INDIAN POLITY
Start with DD Basu nd then Subhash Kashyap by NBT.
Then “Perspectives On Indian Constitution” edited by Subhash Kashyap.
Indian Constitution At Work (NCERT Class XI textbook in political science, newer syllabus)
Politics in India since Independence( NCERT Class XII textbook in political science, newer syllabus)
Democracy in India: Issues and Challenges (NCERT Class XIIth textbook in Political science, older syllabus)
Democratic politics (NCERT Class Xth, newer syllabus)
**Modern History-
Began with ‘Modern India’ by Bipin Chandra, supplemented by ‘India’s struggle for Independence’ by Bipin Chandra, Mukherjee, Panikkar. Spectrum’s book on Modern India
For Ancient India, :::-- ‘Ancient India’ by R.S. Sharma (a wonderfully concise book where every single word is important) and supplemented sparsely by
‘TheWonder that was India’ by A.L. Basham.
For Medieval India, Satish Chandra’s two volumes on Medieval India quite sufficient.
Apart from this, another famous standard text is ‘An Advanced History of India’ by Majumdar, Raychaudhuri and Dutta.
--Geography
Mapping has come out to be a real challenge in recent years. The strategy to handle India map question is again practice. What one should do is to practice map everyday for one hour. Start from mountains first day, then rivers, then waterfalls and then important cities and so on. Also mark important places which are in news from news paper. Regular practice of mapping will make you more confidant. Go through atlas also
Magzine 'Geography and you' is must read, ‘Geography And You’ is available in printed as well as PDF format.
For general geography and world geography the same wizard book on geography will be more than sufficient. Special editions on these topics are published in Competition Wizard magazine which can be helpful for quick revision (only for prelims)
Indian Economy Special Issue by Pratiyogita Darpan especially for prelims.
For reference- Indian Economy by Mishra and Puri.
International affairs/ Bilateral Issues-
Contemporary World Politics( Class XIIth NCERT)
International relations chapters in the book
Democracy in India: Issues and Challenges (NCERT Class XIIth textbook in Political Science, older syllabus)
Science and technology
Science and technology section is very vast and unpredictable. . Whatever can be covered from newspapers should be done. Defence, environment, nuclear and space science are some important sections which need special emphasis.
Monthly Magzines
Pritiyogita Darpan (PD), Competition wizard and Civil services times
As far as newspaper is concerned, HINDU is ultimate
Best way to do calculations on linux console
I always used shell to do all calculation stuff but using it can be sometimes can be a little tricky.
Then I came across python doing calculations on python is very very simple.
Example :
console[1] python
Python 2.4.3 (#1, Dec 22 2011, 12:12:01)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-50)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> t1 = 32*60 +8.1
>>> t2 = 33 *60 +35.1
>>> (t2-t1)/t2
0.043174036027988687
>>>
Friday, April 12, 2013
command to view memory and processor details in linux
To view cpu info and memory info in linux you can simply cat the related proc files.
cat /proc/cpuinfo -- for cpuinfo
cat /proc/meminfo -- for memory info
For example :
the command :
cat /proc/cpuinfo
will give output :
cat /proc/cpuinfo
cat /proc/cpuinfo -- for cpuinfo
cat /proc/meminfo -- for memory info
For example :
the command :
cat /proc/cpuinfo
will give output :
cat /proc/cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 0
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6004.26
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 4
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6000.25
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 2
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6043.37
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 6
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6000.28
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 1
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6000.17
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 5
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6000.25
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 0
siblings : 4
core id : 3
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6000.20
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 7
model name : Intel(R) Xeon(R) CPU E5450 @ 3.00GHz
stepping : 10
cpu MHz : 3000.114
cache size : 6144 KB
physical id : 1
siblings : 4
core id : 7
cpu cores : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall lm pni monitor ds_cpl est tm2 cx16 xtpr lahf_lm
bogomips : 6000.24
clflush size : 64
cache_alignment : 64
address sizes : 38 bits physical, 48 bits virtual
power management:
Hard Disk Drive (HDD) not working on windows 7 after formatting it on Ubuntu ?
I formatted my Western Digital 500 Gb hard disk on Ubuntu 10.4 and now I want to use it on Windows 7 but it cannot detect it.
I formatted it with FAT(applicable to all) option. I tried to Google this problem a bit and as suggested by one of the site i tried to format this drive with NTFS. Still windows cannot detect it. Drives in windows 7 is not a problem because I tried a different usb drive on it and it works. I can see the led of the drive glow when I connect it and I can also see remove drive safely option in lower right corner, but i cannot see any option in "my computer" to access the hard disk. Solution:
I tried to format my HDD using "diskpart" utility available on widows7. It is working now.
Just run "diskpart" on command-promt on diskpart select your HDD and run following commands:
|
Sunday, April 7, 2013
CODE : ALU Arithmatic Logic Unit VHDL
This code is just an example for more detailed understanding of VHDL concepts I would recommend these two books :
1) A VHDL PRIMER by J. Bhasker - A VHDL PRIMER from flipkart.com
A VHDL PRIMER from amazon.com
A VHDL PRIMER from amazon.in
2)VHDL:PROGRAMMING BY EXAMPLES by PERRY - VHDL:PROGRAMMING BY EXAMPLES by PERRY from flipkart.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.in
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 23:35:34 11/01/2006
-- Design Name:
-- Module Name: alu_code - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity alu_code is
Port ( A : in STD_LOGIC_VECTOR (3 downto 0);
B : in STD_LOGIC_VECTOR (3 downto 0);
rst : in STD_LOGIC;
sel : in STD_LOGIC_VECTOR (2 downto 0);
carry : out STD_LOGIC;
o : out STD_LOGIC_VECTOR (3 downto 0);
en : in STD_LOGIC);
end alu_code;
architecture Behavioral of alu_code is
begin
process(sel)
begin
if rst='1' then
o<="0000";
elsif (en='1') then
case sel is
when "000"=> o<=(A or B);
when "001"=> o<=(A and B);
when "010"=> o<=(not A);
when "011"=> o<=(A xor B);
when "100"=> o<=(A+B);
if (A+B = "1111") then
carry<='1';
else
carry<='0';
end if;
when "101"=> o<=(A-B);
if (A<B) then
carry<='1';
else
carry<='0';
end if;
when "110"=> o<=(A+1);
if(A="1111") then
carry<='1';
else
carry<='0';
end if;
when "111"=> o<=A;
when others => o<=A;
carry<='0';
end case;
end if;
end process;
end Behavioral;
1) A VHDL PRIMER by J. Bhasker - A VHDL PRIMER from flipkart.com
A VHDL PRIMER from amazon.com
A VHDL PRIMER from amazon.in
2)VHDL:PROGRAMMING BY EXAMPLES by PERRY - VHDL:PROGRAMMING BY EXAMPLES by PERRY from flipkart.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.in
CODE : ALU
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 23:35:34 11/01/2006
-- Design Name:
-- Module Name: alu_code - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity alu_code is
Port ( A : in STD_LOGIC_VECTOR (3 downto 0);
B : in STD_LOGIC_VECTOR (3 downto 0);
rst : in STD_LOGIC;
sel : in STD_LOGIC_VECTOR (2 downto 0);
carry : out STD_LOGIC;
o : out STD_LOGIC_VECTOR (3 downto 0);
en : in STD_LOGIC);
end alu_code;
architecture Behavioral of alu_code is
begin
process(sel)
begin
if rst='1' then
o<="0000";
elsif (en='1') then
case sel is
when "000"=> o<=(A or B);
when "001"=> o<=(A and B);
when "010"=> o<=(not A);
when "011"=> o<=(A xor B);
when "100"=> o<=(A+B);
if (A+B = "1111") then
carry<='1';
else
carry<='0';
end if;
when "101"=> o<=(A-B);
if (A<B) then
carry<='1';
else
carry<='0';
end if;
when "110"=> o<=(A+1);
if(A="1111") then
carry<='1';
else
carry<='0';
end if;
when "111"=> o<=A;
when others => o<=A;
carry<='0';
end case;
end if;
end process;
end Behavioral;
CODE : SIPO Serial In Parallel out register VHDL
CODE : SIPO
This code is just an example for more detailed understanding of VHDL concepts I would recommend these two books :
1) A VHDL PRIMER by J. Bhasker - A VHDL PRIMER from flipkart.com
A VHDL PRIMER from amazon.com
A VHDL PRIMER from amazon.in
2)VHDL:PROGRAMMING BY EXAMPLES by PERRY - VHDL:PROGRAMMING BY EXAMPLES by PERRY from flipkart.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.in
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 00:06:03 11/02/2006
-- Design Name:
-- Module Name: SIPO_code - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity SIPO_code is
Port ( Din : in STD_LOGIC;
o : out STD_LOGIC_VECTOR (3 downto 0);
clk : in STD_LOGIC);
end SIPO_code;
architecture Behavioral of SIPO_code is
begin
process(clk)
variable temp: std_logic_vector(3 downto 0):="0000";
begin
if(clk'event and clk='1') then
temp(3):= temp(2);
temp(2):= temp(1);
temp(1):= temp(0);
temp(0):=Din;
o<=temp;
end if;
end process;
end Behavioral;
This code is just an example for more detailed understanding of VHDL concepts I would recommend these two books :
1) A VHDL PRIMER by J. Bhasker - A VHDL PRIMER from flipkart.com
A VHDL PRIMER from amazon.com
A VHDL PRIMER from amazon.in
2)VHDL:PROGRAMMING BY EXAMPLES by PERRY - VHDL:PROGRAMMING BY EXAMPLES by PERRY from flipkart.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.com
VHDL:PROGRAMMING BY EXAMPLES by PERRY from amazon.in
----------------------------------------------------------------------------------
-- Company:
-- Engineer:
--
-- Create Date: 00:06:03 11/02/2006
-- Design Name:
-- Module Name: SIPO_code - Behavioral
-- Project Name:
-- Target Devices:
-- Tool versions:
-- Description:
--
-- Dependencies:
--
-- Revision:
-- Revision 0.01 - File Created
-- Additional Comments:
--
----------------------------------------------------------------------------------
library IEEE;
use IEEE.STD_LOGIC_1164.ALL;
use IEEE.STD_LOGIC_ARITH.ALL;
use IEEE.STD_LOGIC_UNSIGNED.ALL;
---- Uncomment the following library declaration if instantiating
---- any Xilinx primitives in this code.
--library UNISIM;
--use UNISIM.VComponents.all;
entity SIPO_code is
Port ( Din : in STD_LOGIC;
o : out STD_LOGIC_VECTOR (3 downto 0);
clk : in STD_LOGIC);
end SIPO_code;
architecture Behavioral of SIPO_code is
begin
process(clk)
variable temp: std_logic_vector(3 downto 0):="0000";
begin
if(clk'event and clk='1') then
temp(3):= temp(2);
temp(2):= temp(1);
temp(1):= temp(0);
temp(0):=Din;
o<=temp;
end if;
end process;
end Behavioral;
Labels:
CODING,
Programming,
VHDL
Subscribe to:
Posts (Atom)