STACK AND QUEUE..

5 views
Skip to first unread message

swadhin jaiswal

unread,
Oct 24, 2011, 5:11:03 AM10/24/11
to bbswork...@googlegroups.com
dear friends..
       on saturday we have discussed algorithm of 3 imp. questions related to stack and queue..i am gonna attach for these codes..

1)reversal of stack..go to following link..
http://www.geeksforgeeks.org/archives/6921

2)sort a stack..
void sort(stack)
{
    type x;

    if (!isEmpty(stack)) {
        x = pop(stack);
        sort(stack);
        sorted_insert(x, stack);
    }           
}

void sorted_insert(x, stack)
{
    type y;

    if (!isEmpty(stack) && top(stack) < x) {
        y = pop(stack);
        insert(x, stack);
        push(y, stack);
    } else {
        push(x, stack);
    }
}

3)queue using 2 stack..
http://www.geeksforgeeks.org/archives/5009



we have already discussed the implementations of these functions..just go thru link for code...

CHANDRA BHANU SHUKLA

unread,
Oct 25, 2011, 12:28:23 AM10/25/11
to bbswork...@googlegroups.com
Thanks swadhin

On 10/24/11, swadhin jaiswal <jaiswal....@gmail.com> wrote:
> dear friends..
> on saturday we have discussed algorithm of 3 imp. questions related
> to stack and queue..i am gonna attach for these codes..
>
> 1)reversal of stack..go to following link..
> http://www.geeksforgeeks.org/archives/6921
>
> 2)sort a stack..
> void sort(stack)
> {
> type x;
>
> if (!isEmpty(stack)) {
> x = pop(stack);
> sort(stack);
> sorted_insert(x, stack);
> }
> }
>
> void sorted_insert(x, stack)
> {
> type y;
>
> if (!isEmpty(stack) && top(stack) < x) {
> y = pop(stack);
> insert(x, stack);
> push(y, stack);
> } else {
> push(x, stack);
> }
> }
>
> 3)queue using 2 stack..
> http://www.geeksforgeeks.org/archives/5009
>
>
>

> *we have already discussed the implementations of these functions..just go
> thru link for code...
>
> *
>

--
Sent from my mobile device

Rupali Kesarwani

unread,
Oct 26, 2011, 1:26:33 AM10/26/11
to bbswork...@googlegroups.com
Thank u sir !!

--
With regards
.
.
.
Rupali Kesarwani

shalini Tiwari

unread,
Oct 27, 2011, 12:01:09 AM10/27/11
to bbswork...@googlegroups.com
thanx sir!!!!!

niraj sahu

unread,
Oct 30, 2011, 3:31:53 AM10/30/11
to bbswork...@googlegroups.com
plz again send me format of cv.............

swadhin jaiswal

unread,
Nov 1, 2011, 3:56:34 AM11/1/11
to bbswork...@googlegroups.com


format of resume is been attached..plz change college name..and mention projects and technical achievements..these are must...

ALL D BEST..
Resume Format.docx
Reply all
Reply to author
Forward
0 new messages