Re: [algogeeks] Reverse Queue

2012-06-20 Thread Kirubakaran D
You could use recursion. def reverse_Q q if !q.isEmpty? el = q.dequeue nQ = reverse_Q(q) nQ.enqueue el return nQ end return q end On Wednesday, June 20, 2012 6:57:23 PM UTC+5:30, Navin Kumar wrote: Use only standard operation of Queue like: EnQueue, DeQueue, IsEmptyQueue etc On

[algogeeks] Re: infix

2010-06-11 Thread kirubakaran
Use stack to push '( initially. if ')' is found remove its pair '('.finally if the stack is empty then the expression is correct! On Jun 10, 9:45 pm, jalaj jaiswal jalaj.jaiswa...@gmail.com wrote: give an algo which reads an  paranthesised infix expression and check well-formdness of

[algogeeks] Re: c output

2010-06-11 Thread kirubakaran
Output will be 1,1 bcoz printf returns number of characters or integers printed On Jun 11, 12:26 am, divya sweetdivya@gmail.com wrote: #include stdio.h main() {  int a = 1;  char b='c';  int i,j;  printf(%d,%d,printf(%d\n,a),printf(%c\n,b)); wat shd b the o/p of this..plzz

[algogeeks] Re: hashing

2010-06-10 Thread kirubakaran
When it is a stream of data,counting is a best way to go ! On Jun 10, 7:54 am, Anurag Sharma anuragvic...@gmail.com wrote: Even if you use bucket sort, you will have to store the numbers arriving, or atleast 1..1 numbers along with their count. If you reduce the size of the bucket further