Questions tagged as 'stack'

1
answer

What's Faster: Stack or Heap Allocation? [duplicate]

This question may sound elementary but it has generated a good debate with a co-worker. I can whenever I do allocations in Stack because for me the Stack growth is constant in time. And already the allocation performance in...
asked by 09.08.2017 / 09:18
1
answer

Can not evaluate expression because the current thread is in stack overflow state

You're giving this error:    Can not evaluate expression because the current thread is in stack overflow state in the qtde variable by adding it in the desci list. class descricaoo : IInstrucao { private string...
asked by 29.10.2015 / 17:43
1
answer

Battery Exercise - String with garbage

   Write an algorithm, using a Stack, that inverts the letters of each word of a finished text by period (.) preserving the order   of words. Per   example, given the text: THIS EXERCISE IS VERY EASY. The output should be: ETSE OICICREXE AND OTI...
asked by 18.10.2018 / 03:38
1
answer

How to use a class array as a pointer?

How do I use a class array as a pointer? I tried in several ways, but C ++ would not let me compile errors. An example of the class (Just an example, the class I need to use is thousands of times larger than this) class Pessoas { private:...
asked by 11.12.2017 / 15:47
1
answer

Stack, pop function, she has to withdraw at the end

#include <stdio.h> #include <stdlib.h> typedef struct pilhaElement{ int data; struct pilhaElement *next; }PilhaElment; typedef struct pilha{ PilhaElment *head; PilhaElment *tail; int size; }Pilha; Pilha *iniciarpil...
asked by 30.05.2017 / 03:28
1
answer

What is the Java stack class growth policy?

I'm doing work on different stacks and what I'm studying, increases its size to double when we introduce the (2 ^ n +) 1 element. But what is the growth policy of java.util.Stack and java.util.Array?     
asked by 14.04.2017 / 17:24
2
answers

Remove specific data in a stack

I have not the slightest idea how to remove a specific data from a stack. I tried to minhaPilha.remove(); and it did not work. Console.WriteLine("<Pilha>"); Stack<string> minhaPilha = new Stack<string>(); Console.Write...
asked by 03.09.2015 / 13:18
1
answer

Stack in Java interleaving values [closed]

I have two stacks I have to create the third one interleaving the values of the two stacks I created the stack and all I'm having a lock to implement is the code to interleave follow the code: public class Pilha { private Stack p;...
asked by 12.09.2014 / 22:53
2
answers

Error removing stack item

What is the error of the function pop ?? void pop(Pilha *pilha){ if(pilha->size == 0){ puts("pilha vazia"); } else { printf("item removido: %d\n\n", pilha->itens[--pilha->size]); free(pilha->itens[--pilha->...
asked by 27.02.2014 / 03:00
1
answer

Remove odd numbers from a stack

In C, how do you remove only odd numbers from a stack? I was thinking of removing item from item and passing to a vector, however the stack size is not given.     
asked by 05.07.2015 / 03:39