Questions tagged as 'stack'

1
answer

How to allocate a dynamic, user-supplied stack?

I want to allocate a dynamic stack with the size provided by the user, then treat it as a "vector" would be more or less what I did in the function ALOCA ? #include <stdio.h> #include <stdlib.h> #include <ctype.h> #incl...
asked by 10.12.2017 / 15:23
1
answer

Is it incorrect to state that in a data structure of the stack type, the element that will be removed from the structure is the one that is stored in the header?

In a data structure test I had the following question:    In a data structure of type stack, the element that will be removed   of the structure is the one that is stored       a) there is more time.       b) There is less time.       c) a...
asked by 27.04.2017 / 00:25
1
answer

Stack of characters

Good night people, okay? I'm with my program here from RPN Calculator and apparently everything is working normal despite great difficulties to work with char stack. I'm missing implementing the power function on my calculator only, but nothing w...
asked by 20.10.2016 / 02:43
1
answer

Reverse a stack using an additional stack and some variables

I need to invert a stack A using another stack B and some variables in pseudo-code. So that stack A is inverted at the end of the algorithm. Can anyone help?     
asked by 10.05.2016 / 15:22
1
answer

AttributeError: 'list' object has no attribute 'apend'

Why does this error occur?    "AttributeError: 'list' object has no attribute 'append'" with this code? class Stack : def __init__(self) : self.items = [] def push(self, item) : self.items.apend(item) def pop(self) : re...
asked by 24.02.2017 / 16:48
1
answer

Error in my data structure [PILE]

My code is displaying two errors. As I'm learning, I've tried several ways to fix it. Can someone please help me? I need to insert a number and a string in my stack. But you're making a mistake in my structure. #include <stdio.h> #inc...
asked by 22.03.2018 / 17:00
1
answer

Unpacking dynamic stack

I have a dynamic stack algorithm. Only if I insert 10 elements into the stack and it is unstackable without removing the first element it from the segmentation fault. And if I remove the first element from the top left over 9 8 7 6 5 4 3 2 1 and...
asked by 13.01.2018 / 16:45
1
answer

Stacks with vectors in C, is showing elements that have already been removed

How do I show my vector without the numbers that were removed? Because when I show him, even removing a number in the function, it still appears inside. #include <stdio.h> #include <stdlib.h> #define MAX 10 int pilha[MAX]; int ini...
asked by 16.08.2018 / 03:23
1
answer

stack insertion vector returning all zero

Now, I posted the algorithm for this address below here because I had problems with unpacking and removing was solved until then. Deploying Dynamic Stack But as I was reviewing the code and therefore leaving them better I decided to put a...
asked by 19.01.2018 / 22:14
2
answers

How to use argc and argv in a windows terminal?

I'm creating a stack for valid expression checking, but it should be used in this int main( int argc, char **argv ) for input. I compiled and did not give any error, however I can not create an executable file through the prompt. And I al...
asked by 13.07.2017 / 14:46