but question is how to implement using one stack not two S1 and S2
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to algoge...@googlegroups.com.
To unsubscribe from this group, send email to
Hi,
You can allocate memory for multiple of 16 bytes ( 16 * n, where is the
your desired size) + some extra memory to track which is allocated or freed,
and then use your mymalloc and get the memory from allocated block and use
it, this way it will be efficient I feel.
Thanks,
Sathaiah Dontula
I dont think its possible to implement a queue using a single stack.
Atul
On Mon, Feb 8, 2010 at 7:48 AM, MOHIT mohit...@gmail.com wrote:
but question is how to implement using one stack not two S1 and S2
--
You received this message because you are subscribed to the Google Groups
@atul : what u think about this method
suppose if we implemented in array
1. for insert push in stack
2.for pop use a variable nd reverse stack in array -pop element form stack
-again reverse ;
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
I guess you can do it using recursion(if allowed). Insert is any way
straight forward(just by pushing onto the stack) but for removal you can do
something like.
remove()
{
topVal = stack.pop();
if(stack.isEmpty())
{
//this is the only element
return topVal
}
// get the last element
On Mon, Feb 8, 2010 at 2:13 PM, MOHIT mohit...@gmail.com wrote:
@atul : what u think about this method
suppose if we implemented in array
1. for insert push in stack
2.for pop use a variable nd reverse stack in array -pop element form stack
-again reverse ;
--
You received this
This is code for queue using single stack
#includestdio.h
#includestdlib.h
#define MAX 30
int stack[MAX],top=-1;
void push(int num)
{
top++;
if(top==MAX-1)
{
printf(Queue overflow\n);
exit(0);
}
stack[top]=num;
}
int pop()
{
if(top==-1)
{
As we have the standard implementation for the Queue using two stacks, i
think we can use that logic here.
by using the Operating system stack as the second stack, i mean to say using
recursion we can achieve it.
Suppose we call the stack as S1 and it has two functions namely push and
pop, The
Hi all,
I have came across a problem and I am not aware if there is such a
thing in set theory and if so what is it called.
Mainly I have several sets that I am interested in their cartesian
product. But this cartesian product should not be a set of ordered
pairs but a set of sets. Basically
@Manisha can u pls elaborate, ith node index lies in a range ?
extending Bijlwan's solution,
node numbering on each new level begins by multiplying the index of the
leftmost node in previous level by 2^k and then in incrementing it by one.
and while one checks one shifts by k.
On Sat, Feb 6,
It would be greatly appreciated if this announcement could be
shared with individuals whose research interests include
computer graphics and virtual reality. Thanks.
---
CALL FOR PAPERS
CGVR'10
The 2010 International Conference on
11 matches
Mail list logo