...::: Recent Updates :::...

Monday, May 16, 2011

Mergesort And Quicksort

----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com

Sunday, May 15, 2011

QUICK SORT IN C


Quick sort

Quick sort sorts a list based on the divide and conquer strategy.
In quick sort algorithm we divide the list into two sub-list, sort these sub-lists and recursively until the list is sorted,
The basic steps of quick sort algorithm are as follows;
Step 1:          Choose a key element in the list which is called a key.
Step 2:          Reorder the list with the rule that all elements which are less than the key comes before the pivot and so that all elements greater than the key come after it, after the partitioning the key in its final position
Step 3:          Recursively re,order two sub-lists the sub-list of lesser elements and the sub-list of greater elements.

Quick Sort Code in C
#include<stdio.h>
#include<conio.h>
#include<stdlib.h>
#define size 10
int arr[size];
void create()
{
      int i;
      for(i=0;i<size;i++)
      {
            arr[i]=random(1000);
      }

}
void display()
{
      int i;
      for(i=0;i<size;i++)
      {
            printf("%d\t",arr[i]);
      }
}
void quick(int lb,int ub)
{
      int i,j,key,temp;
      int flag=0;
      i=lb+1;
      j=ub;
      key=arr[lb];

      while(flag==0)
      {
            if(lb<ub)
            {
                        while(arr[i]<key)
                        {
                              i=i+1;
                        }
                        while(arr[j]>key)
                        {
                              j=j-1;
                        }
                        if(i<j)
                        {
                              temp=arr[i];
                              arr[i]=arr[j];
                              arr[j]=temp;
                        }
                        else
                        {
                              flag=1;
                              temp=arr[lb];
                              arr[lb]=arr[j];
                              arr[j]=temp;
                        }
            }
            else
            {
                  return;
            }
      }
      quick(lb,j-1);
      quick(j+1,ub);
}
void main()
{
      int lb=0;
      int ub=size-1;
      create();
      display();
      quick(lb,ub);
      display();
}

 
* Special Thanks to Maulin &  Naresh & Also  Using Reference Book Data Structures by Tremblay


----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com

Tuesday, May 10, 2011

quick sort

/*
Taking help from the jean paul trembley book
Authore:- Maulin Desai
GNU/GPL :) :) */

#include
int main()
{
int m[]={42,23,74,11,65,58,94,36,99,87};
int lb=0;
int ub=9,i;
void q_sort(int m[],int lb,int ub);
q_sort(m,lb,ub);
for(i=0;i<10;i++)
{
printf("%d\t\t",m[i]);
}
return 0;
}
void q_sort(int m[],int lb,int ub)
{
int i,j,key,temp;
int flag=0;
i=lb+1;
j=ub;
key=m[lb];
while(flag==0)
{
if(lb {
while(m[i] i=i+1;

while(m[j]>key)
j=j-1;
if(i {
temp=m[i];
m[i]=m[j];
m[j]=temp;
}
else
{
flag=1;
temp=m[lb];
m[lb]=m[j];
m[j]=temp;
}
}
else
{
return;
}
}
q_sort(m,lb,j-1);
q_sort(m,j+1,ub);
}

Monday, April 25, 2011

BST WITHOUT recursion

/*Binary search tree creation without recursion
LICENCE:-GNU/GPL :)
Authore:-Maulin Desai :)*/
#include

#include

struct maulin

{

int n;

struct maulin *left;

struct maulin *right;

};

int main()

{

void create(struct maulin **,int );

void preorder_disp(struct maulin *);

void postorder_disp(struct maulin *);

void inorder_disp(struct maulin *);

//void dele(struct maulin **,struct maulin **);

//void search(struct maulin **,struct maulin **,int no);
int no;
int ch;
char dec='y';

struct maulin *root=(struct maulin *)malloc(sizeof(struct maulin));

struct maulin *f=(struct maulin *)malloc(sizeof(struct maulin));
f=NULL;

root->n=0;
do

{

printf("\n1)create\n2)preorder Disp\n3)exit\n4)Postorder disp\n5)inorder display\n6)delete");

scanf("%d",&ch);

switch(ch)

{

case 1:

printf("\nEnter Number to insert in tree:-\t");

scanf("%d",&no);

create(&root,no);

break;

case 2:

preorder_disp(root);

break;

case 4:

postorder_disp(root);

break;

case 5:

inorder_disp(root);

break;

/*case 6:

dele(&root,&f);

break;*/

case 3:

exit(0);

}

printf("\nDo you want to continue:-\t");

scanf("%s",&dec);

}while(dec=='y'||dec=='Y');

return 0;

}

void inorder_disp(struct maulin *d)

{

if(d!=NULL)

{

inorder_disp(d->left);

printf("\n%d",d->n);

inorder_disp(d->right);

}

}

void postorder_disp(struct maulin *g)

{

if(g!=NULL)

{

postorder_disp(g->left);

postorder_disp(g->right);

printf("\n%d",g->n);

}

}

void preorder_disp(struct maulin *h)

{

// printf("\n\n\n\n The value of root node is:-\t%d",h->n);

if(h!=NULL)

{

printf("\n\t%d",h->n);

//printf("\nTraversing from Left sight:-:(");

preorder_disp(h->left);

//printf("\nNow Traversing From Right sight:0:-\t%d",h->right);

preorder_disp(h->right);

}



}

void create(struct maulin **h,int no)

{

int flag=0;

struct maulin *temp=(struct maulin *)malloc(sizeof(struct maulin));

struct maulin *new_node=(struct maulin *)malloc(sizeof(struct maulin));

//new_node=NULL;

//temp=NULL;

printf("\n value of head node:-\t%d",(*h));

if((*h)->n==0)

{

printf("\nRoot Node created:-\t");

(*h)->n=no;

(*h)->left=NULL;

(*h)->right=NULL;

return;

}

else if((*h)->n
{

temp=(*h);

printf("\nTraversing from right in subtree");

b:

while(temp->right!=0)

{

if(temp->n
{

flag=0;

temp=temp->right;

}

if(temp->n>no)

{

printf("\nMaulin :-\t%d %d",temp->n,no);

flag=1;

break;

}

}

if(flag==0)

{

printf("\n\n\t\t\t\t\t\t\t node inserted at right sight dude:-%d\t\t\t\n",no);

new_node->left=NULL;

new_node->n=no;

new_node->right=NULL;

temp->right=new_node;

// temp->left=NULL;

temp=(*h);

return;

}

else

{

printf("\nJump down word");

goto a;

}

}

else if((*h)->n>no)

{

a:

printf("\nTraversing from Left in subtree:-\t");

temp=(*h);

while(temp->left!=NULL)

{

if(temp->n>no)

{

temp=temp->left;

}

else if(temp->n
{

printf("\nGoto up like mario game:-\t");

goto b;

}

}

printf("\n\n\n\t\t\t\t\t\t\tInserting node at left sightv in tree:-%d\t\t\t\t\n",no);

new_node->left=NULL;

new_node->n=no;

new_node->right=NULL;

temp->left=new_node;

//temp->right=NULL;

}

else

{

printf("\nNo condition satisfy:-\t");

}

}

Friday, April 22, 2011

Data Structure Using C


Note : Due To Some Security Reasons all The Files Are Kept Password Protected So Those Who Want To Download These Files Just Comment (Reply) Ur Email Address With Ur Name and College Name. Ill Be Sending You Password In Mail ASAP!

...:::  Correct Expected Solution For D.S Question Set :::...


----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com

www.licamca.blogspot.com

Tuesday, April 12, 2011

MCA TIME TABLE 2011-2012

----------------------------------------------------------------------------------
MCA TIME TABLE 2011-2012
----------------------------------------------------------------------------------


SEM I Remedial

SEM II Regular / Remedial

SEM III Remedial

SEM IV Regular


----------------------------------------------------------------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com
----------------------------------------------------------------------------------

Saturday, April 9, 2011

Communication Skills (CS) (620008)

GUJARAT TECHNOLOGICAL UNIVERSITY
Master of Computer Application
Semester: II
Subject Name : Communication Skills (CS)
Subject Code : 620008
----------------------------------------------------------------------


Note : Due To Some Security Reasons all The Files Are Kept Password Protected So Those Who Want To Download These Files Just Comment (Reply) Ur Email Address With Ur Name and College Name. Ill Be Sending You Password In Mail ASAP!


----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com

Thursday, April 7, 2011

Maths Complete Material CONM


Note : Due To Some Security Reasons all The Files Are Kept Password Protected So Those Who Want To Download These Files Just Comment (Reply) Ur Email Address With Ur Name and College Name. Ill Be Sending You Password In Mail ASAP!



 ..:: Complete Material of CONM all PPT ::..
----------------------------
RAJ SOLUTION'S
www.rajsolution.com
www.sahinraj.blogspot.com