Popular Posts

Monday, 30 April 2012

Program to perform deletion from simple link list


#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<alloc.h>
void create();
void delbeg();
void delend();
void delkpos();
void delel();
void display();

struct node
{
int info;
struct node *link;
}*start=NULL;
void main()
{
char ans;
int ch;
clrscr();
do
{
printf("\nSelect any one");
printf("\n1. Create list");
printf("\n2. Deletion from beginning");
printf("\n3. Deletion from end");
printf("\n4. Deletion from 'Kth' position");
printf("\n5. Deletion of a particular element");
printf("\n6. Display list");
printf("\n7. Exit");
scanf("%d",&ch);
    switch(ch)
    {
        case 1: create();
            break;
        case 2: delbeg();
            break;
        case 3: delend();
            break;
        case 4: delkpos();
            break;
        case 5: delel();
            break;
        case 6:display();
            break;
        case 7: exit(-1);

    }
printf("\nDo you wish to continue?");
flushall();
scanf("%c",&ans);
}while(ans=='y' || ans=='Y');
getch();
}

void create()
{
struct node *temp;
temp=(struct node *)malloc(sizeof(struct node));
printf("\nEnter info");
scanf("%d",&temp->info);
temp->link=NULL;
    if(start==NULL)
    {
    start=temp;
    }
    else
    {
    struct node *ptr=start;
        while(ptr->link!=NULL)
        {
        ptr=ptr->link;
        }
    ptr->link=temp;
    }
}

void delbeg()
{
struct node *ptr=start;
    if(start==NULL)
    {
    printf("\nEmpty list,can't delete");
    return;
    }

printf("\n%d element is being deleted",start->info);
start=start->link;
free(ptr);
}

void delend()
{
struct node *ptr=start;
    if(start==NULL)
    {
    printf("\nEmpty list,can't delete");
    return;
    }
    while(ptr->link->link!=NULL)
    ptr=ptr->link;
printf("\n%d element is being deleted",ptr->link->info);
free(ptr->link);
ptr->link=NULL;
}

void delkpos()
{
int k;
printf("\nEnter position");
scanf("%d",&k);
    if(start==NULL)
    {
    printf("\nEmpty list,can't delete");
    return;
    }
        else if(k==1)
        {
        struct node *ptr=start;
        printf("\n%d element is being deleted",start->info);
        start=start->link;
        free(ptr);
        }
            else
            {
            int i;
            struct node *ptr=start,*temp;
                for(i=1;i<=k-2;i++)
                {
                ptr=ptr->link;
                    if(ptr->link==NULL)
                    {
                    printf("\nList is short,can't delete");
                    return;
                    }
                }
            printf("\n%d element is being deleted",ptr->link->info);
            temp=ptr->link;
            ptr->link=ptr->link->link;
            free(temp);
            }
}

void delel()
{
int item;
struct node *ptr,*prev;
printf("\nEnter info to be deleted");
scanf("%d",&item);
ptr=start;
    while((ptr!=NULL)&&(ptr->info!=item))
    {
    prev=ptr;
    ptr=ptr->link;
    }
        if(ptr->info==item)
        {
        printf("\n%d element is being deleted",ptr->info);
        prev->link=ptr->link;
        free(ptr);
        }
        else
        {
        printf("\nElement not found");
        }
}

void display()
{
struct node *ptr=start;
while(ptr!=NULL)
{
printf("\n%d",ptr->info);
ptr=ptr->link;
}
}

Thursday, 12 April 2012

program to apply insertion,searching,sorting operations on Simple Link List


#include<stdio.h>
#include<conio.h>
#include<process.h>
#include<alloc.h>
void insbeg();
void insend();
void inskpos();
void display();
struct node * search();
void sort();
struct node
{
int info;
struct node *link;
}*start=NULL;
void main()
{
int ch;
char ans;
struct node *l;
clrscr();
do
{
printf("Select any one");
printf("\n1. Insertion at beginning");
printf("\n2. Insertion at end");
printf("\n3. Insertion at 'Kth' position");
printf("\n4. Search location of an element in the list");
printf("\n5. Sort list");
printf("\n6. Display list");
printf("\nEnter your choice");
scanf("%d",&ch);

switch(ch)
    {
    case 1: insbeg();
        break;
    case 2: insend();
        break;
    case 3: inskpos();
        break;
    case 4: l=search();
        printf("\nAddress of element is %d",l);
        break;
    case 5: sort();
        break;
    case 6: display();
        break;
    default:printf("\nInvalid input");
    }
printf("\nDo you wish to continue?");
flushall();
scanf("%c",&ans);
}while(ans=='Y'|| ans=='y');
getch();
}
//------------------------------------------------------------------------------------------------------------
void insbeg()
{
struct node *temp;
temp=(struct node *)malloc (sizeof(struct node));
    printf("\nEnter info");
    scanf("%d",&temp->info);
        temp->link=start;
        start=temp;
}
//------------------------------------------------------------------------------------------------------------
void insend()
{
struct node *ptr;
ptr=start;
    if(start==NULL)
    {
    start=(struct node *)malloc(sizeof(struct node));
    printf("\nEnter info");
    scanf("%d",&start->info);
    start->link=NULL;
    }
    else
    {
        while(ptr->link!=NULL)
        ptr=ptr->link;
    ptr->link=(struct node *)malloc(sizeof(struct node));
    ptr=ptr->link;
    printf("\nEnter info");
    scanf("%d",&ptr->info);
    ptr->link=NULL;
    }
}
//-----------------------------------------------------------------------------------------------------------
void inskpos()
{
int k,i;
struct node *temp,*ptr;
temp=(struct node *)malloc(sizeof(struct node));
ptr=start;

printf("\nEnter position");
scanf("%d",&k);
    if(k==1)
    {
    printf("\nEnter info");
    scanf("%d",&temp->info);
    temp->link=start;
    start=temp;
    }
        else
        {
            for(i=1;i<=k-2;i++)
            {
                if(ptr==NULL)
                {
                printf("\nList is short,can't insert");
                return;
                }
            ptr=ptr->link;
            }
        printf("\nEnter info");
        scanf("%d",&temp->info);
        temp->link=ptr->link;
        ptr->link=temp;
        }
}
//------------------------------------------------------------------------------------------------------------
void display()
{
struct node *ptr=start;
    while(ptr!=NULL)
    {
    printf("\n%d",ptr->info);
    ptr=ptr->link;
    }
}
//------------------------------------------------------------------------------------------------------------
struct node * search()
{
int item;
struct node *ptr=start,*loc;
printf("\nEnter item");
scanf("%d",&item);
    while(ptr!=NULL && ptr->info!=item)
    ptr=ptr->link;
        if(ptr->info==item)
        loc=ptr;
            else
            loc=NULL;
            return loc;
}
//------------------------------------------------------------------------------------------------------------
void sort()
{
int temp;
struct node *ptr=start,*ptr1;
    while(ptr->link!=NULL)
    {
    ptr1=ptr->link;
        while(ptr1!=NULL)
        {
            if(ptr->info>ptr1->info)
            {
            temp=ptr->info;
            ptr->info=ptr1->info;
            ptr1->info=temp;
            }
        ptr1=ptr1->link;
        }
    ptr=ptr->link;
    }
}

Friday, 5 August 2011

quotation

"EXCELLENCE" has always been achieved by those who dared to believe that something inside them is superior to circumstances  !!

Wednesday, 1 June 2011

Poster created using Photoshop



Steps to create poster :
  • Firstly,watch this video to create an abstract background. http://www.youtube.com/watch?v=56-oLmrv1xw .I used different colours on brushes and created shapes of my own choice with brush and applied the effect as directed in video.
  • Download some images of fashion show from internet and open the images in new files in photoshop. Crop and move these images to the main file.
  • Change the opacity of the images as per your chioce.
  • Click on text "T" button in the toolbar, a new text layer is created.In the text options bar set size:66.37 px, font: Arial, Color: white. Write "Glow Fashion Show" on the top of the layer.
  • Click on "warped text" tool in the tool options bar and select "arc" in 'style' drop-down menu. Set the following properties of arc:
        Bend: +50
        Horizontal distortion: 0%
        Vertical distortion: 0%                   Click OK.
  • Click at the bottom of the page and write the details about fashion show.
  • Click on the "f" (blending effects) button in layers palette and apply       various effects on the text: Drop Shadow,Inner Shadow,Outer Shadow,Outer  Glow,Inner Glow,Bevel and Emboss,Color Overlay,Gradient Overlay. Click OK. 
  • Select the Background layer in layers palette, Click Filter>Render>Lens Flare. Locate the 'Flare center'. Click OK. Poster is complete!!!   
Here's another one by me. Frontpage of 3DS Max File.