Complete IIT AIEEE ICSE ISC PMT help forum
This is a free help Forum for Indian Students.
Complete IIT AIEEE ICSE ISC PMT help forum

Complete help forum for students preparing for icse iit aieee cbse pmt and other related exams.Stay updated about all 2011 exams.
 
HomeHome  PortalPortal  FAQFAQ  SearchSearch  RegisterRegister  MemberlistMemberlist  UsergroupsUsergroups  Log in  India NewsIndia News  
Keywords
YEAR CLASS RESULT physics papers prelim 2010 question 2006
Latest topics
Top posters
abhas
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
Anu..i luv icse...:)
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
G-7
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
siya
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
Candy
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
jOhNy
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
Apurva
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
WinRrule
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
ambili
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 
saif
algorithms in simple data structures..?? - Page 2 Vote_lcapalgorithms in simple data structures..?? - Page 2 Voting_baralgorithms in simple data structures..?? - Page 2 Vote_rcap 



Search if you can't find it here

algorithms in simple data structures..??

View previous topic View next topic Go down
Go to page : Previous  1, 2
AuthorMessage
diptojit
Active member
Active member



algorithms in simple data structures..?? - Page 2 Vide
PostSubject: Re: algorithms in simple data structures..?? algorithms in simple data structures..?? - Page 2 EmptyFri Mar 19, 2010 12:24 am

don't know.....this is the program from the sample paper....I don't think the sample question is exactly on a deque....
Back to top Go down
View user profile
diptojit
Active member
Active member



algorithms in simple data structures..?? - Page 2 Vide
PostSubject: Re: algorithms in simple data structures..?? algorithms in simple data structures..?? - Page 2 EmptyFri Mar 19, 2010 12:26 am

anyways... i checked it out and it's working fine now.....I created a main method to check it....have a look...

here's the newer version of the program....along with the main method

import java.io.*;
class chain
{ int ele[];
int cap,front,rear;
chain(int max)
{ cap=max;
front=0;rear=0;
ele=new int[cap];
}
void pushfront(int v)
{ if(front>0)
{ ele[front-1]=v;
front--;
}
else if(front==0&&rear==0)
{ ele[0]=v;}
else
{ System.out.println("Full from front");
}
}
int popfront()
{ if(front==0&&rear==0)
{ return 999;
}
else
{ front=front+1;
return(ele[front-1]);
}
}
void pushrear(int v)
{ if(rear==cap-1)
{ System.out.println("Full from rear");
}
else
{ ele[rear+1]=v;
rear++;
}
}
int poprear()
{ if(front==0&&rear==0)
{ return 999;}
else
{ rear=rear-1;
return(ele[rear+1]);
}
}
void display()
{ int i;
for(i=front;i<=rear;i++)
{ if(ele[i]!=0)
{ System.out.print(ele[i]+" ");
}
}
}
}
test class :-
import java.io.*;
class test
{ void main()throws IOException
{
chain obj=new chain(10);
obj.pushfront(5);
obj.pushrear(Cool;
obj.pushrear(13);
obj.display();
System.out.println();
obj.popfront();
obj.display();
System.out.println();
obj.pushrear(1);
obj.display();
System.out.println();
obj.poprear();
obj.display();
System.out.println();
}
}
Back to top Go down
View user profile
G-7
Active member
Active member
G-7


algorithms in simple data structures..?? - Page 2 Vide
PostSubject: Re: algorithms in simple data structures..?? algorithms in simple data structures..?? - Page 2 EmptyFri Mar 19, 2010 12:27 am

yea..there is no application for deque for us to study... jus the theory... jus superficial...! but i like to do it cuz itz challenging... maybe we can do a code during the holidays.!
Back to top Go down
View user profile
G-7
Active member
Active member
G-7


algorithms in simple data structures..?? - Page 2 Vide
PostSubject: Re: algorithms in simple data structures..?? algorithms in simple data structures..?? - Page 2 EmptyFri Mar 19, 2010 12:30 am

nay.. a small bug still there...try poppin from the front...after pushing front...!
Back to top Go down
View user profile
G-7
Active member
Active member
G-7


algorithms in simple data structures..?? - Page 2 Vide
PostSubject: Re: algorithms in simple data structures..?? algorithms in simple data structures..?? - Page 2 EmptyFri Mar 19, 2010 12:42 am

All the best everyone....may God help u and also me.. Very Happy

I'll pray thay every one of us can get good marks and w can do the xam very well..!!

G0od night everyone..!

ALL IZZ WELL...!!!
Back to top Go down
View user profile
Sponsored content




algorithms in simple data structures..?? - Page 2 Vide
PostSubject: Re: algorithms in simple data structures..?? algorithms in simple data structures..?? - Page 2 Empty

Back to top Go down

algorithms in simple data structures..??

View previous topic View next topic Back to top
Page 2 of 2Go to page : Previous  1, 2

Permissions in this forum:You cannot reply to topics in this forum
Complete IIT AIEEE ICSE ISC PMT help forum :: ISC :: ISC 2010 [Class xii] :: Computer-