Tuesday, 18 October 2011

Student Linked List

C program to construct a singly linked list consisting of following instructions in each node : 1.Student ID(int) 2.Student name(string) 3.Semester(int) The operations supported are 1.Insertion operation at any position 2.deleting a node based on ID

#include<stdio.h>
#include<stdlib.h>

typedef struct node
{
 char name[25];
 int id,sem;
 struct node *link;
}NODE,*NODEPTR;

NODEPTR insertp(NODEPTR start,int pos, int *count)
{
 NODEPTR temp,prev,cur;
 int i;
 temp=(NODEPTR)malloc(sizeof(NODE));
 if(temp==NULL)
  printf("Memory allocation not possible\n");
 printf("Enter the name, ID and semester of the student\n");
 scanf("%s%d%d",temp->name,&temp->id,&temp->sem);
 temp->link=NULL;
 for(cur=start;cur!=NULL;cur=cur->link)
  if(cur->id==temp->id)
  {
    printf("ID already exists\n");
    free(temp);
    return start;
   }
 (*count++);
 if(pos==1)
 {
   temp->link=start;
   start=temp;
   return start;
 }
 cur=start;
 for(i=1;i<pos;i++)
 {
   prev=cur;
   cur=cur->link;
  }
 prev->link=temp;
 temp->link=cur;
 return start;
}

NODEPTR deleteid(NODEPTR start, int did, int *count)
{
  NODEPTR prev,cur;
  for(cur=start;cur!=NULL;prev=cur,cur=cur->link)
  {
    if(cur->link==did)
      break;
  }
  if(cur==NULL)
  {
    printf("Record not found\n");
    return start;
  }
 if(cur==start)
  start=start->link;
 else
  prev->link=cur->link;
 free(cur);
 (*count)- -;
 return start;
}

int search (NODEPTR start, int sid)
{
  NODEPTR cur,t;
  int mid;
  for(cur=start;cur!=NULL;cur=cur->link)
    if(cur->id==sid)
      break;
  if(cur==NULL)
   printf("Record not found\n");
 else
 {
   while(1)
   {
     printf("Enter the ID of the student to be searched\n");
     scanf("%d",&nid);
     for(t=start;t!=NULL;t=t->link)
     {
       if(nid=t->id && (nid!= cur->id))
       {
         printf("ID already exists, enter again\n");
         break;
        }
     }
     if(t==NULL)
     {
       cur->id=nid;
       printf("Enter the name and semester\n");
       scanf("%s%d",cur->name,&cur->sem);
       return;
     }
    }//end of while
   }//end of else
 }//end of function

void display(NODEPTR start)
{
  NODEPTR cur;
  if(start==NULL)
   printf("The list is empty\n");
 else
 {
   printf("List content is shown below\n");
   for(cur=start;cur!=NULL;cur=cur->link)
     printf("%s\t%d\t%d\n",cur->name,cur->id,cur->sem);
  }
}

int main()
{
  NODEPTR start=NULL;
  int ch, id, pos, count=0;
  while(1)
  {
    display(start);
    printf("Enter your choice of operation 1.Insert 2.Delete 3.Search OTHER:Exit\n");
    scanf("%d",&ch);
    switch(ch)
    {
      case 1 : printf("Enter the position (1 to %d) to insert the node\n", count+1);
                   scanf("%d",&pos);
                   if(pos < 1 || pos>count+1)
                      printf("Invalid position\n");
                   else
                      start=insertp(start,pos,&count);
                  break;
     case 2 : printf("Enter the ID to be deleted\n");
                  scanf("%d",&id);
                  start=deleteid(start,id,&count);
                  break;
    case 3 : printf("Enter the ID to be searched\n");
                 scanf("%d",&id);
                 search(start,id);
                 break;
   default : return;
  }
 }
}


Saturday, 8 October 2011

Nokia Symbian Belle 600 700 701

First of all, I would like to say R.I.P Steve Jobs.Since Apple lost its Leader as well as Market (due to its iphone 4S), I think its time for us to check out other releases (although these released before iphone 4S).


Nokia has released 3 new Symbain Belle products- Nokia 600(loudest),700(smallest) and 701(brightest)
All have the latest Symbian Belle and a new technology called NFC- Near Field Technology.





Lets take a look at them


1.Nokia  600 - Its the loudest phone (106 Phons)- With built-in FM radio antenna for listening to radio without headphones and FM transmitter that makes it possible to broadcast music from your phone to any FM radio. Lowest price Rs. 12,999,when compared to 700 and 701. 1 GHz processor; 5 MP full focus camera with LED flash and HD video capture, and 2 GB of internal memory with ability to increase to 34 GB using a 32 GB microSD card.A powerful loudspeaker and the ability to also stream music wirelessly to NFC-enabled accessories.















2.Nokia 700 - Its the smallest smartphone of Nokia.Weighing 96gm and at 110 x 50.7 x 9.7 mm. 1Ghz processor, 3.2 inch AMOLED screen ClearBlack display, 2GB of internal memory (with the option of using a 32GB microSD card for a total of 34GB), HD video capture and 5MP full focus camera with LED flash. Obviously, it features the new single tap NFC pairing and sharing capabilities.The price is Rs. 18,099.





3.Nokia 701 - Its the slimmest and the brightest phone ever made, claims Nokia, based on a 3.5 inch ClearBlack display that makes it perfect for indoor and outdoor use. 1 GHz processor, 8 MP full focus camera with dual LED flash and 2X digital zoom, second front-facing camera and HD video capture. It comes with 8 GB internal memory and the possibility to increase to 40 GB by installing a 32 GB microSD card. The most catch feature of this phone is that it provides single-tap NFC pairing and sharing capabilities, allowing content to be shared and sound to be streamed wirelessly to headphones and NFC-enabled speakers.









I think this NFC is gonna work . Since it has been launched in India through entertainment , all teens are going to try their hands on this "single-tap" techno! 
FTW Nokia !! :D 




Check out this NDTV gadget guru video : http://www.ndtv.com/video/player/news/why-srk-likes-the-new-nokia-smartphones/212484