Most voted "stack" questions
A stack is an optimized way to organize data in memory allocated in sequence and abandoned in reverse sequence to the input.
Learn more…116 questions
Sort by count of
-
2
votes1
answer284
viewsStack operations
I am trying to do operations using stack but at the time of allocating the results in the previous position in stack is that I am not getting, because the result of operation is not allocated in the…
-
1
votes2
answers93
viewsmysql organizing database entries
I wondered if it is possible to reorder the entries of a table in mysql, overwriting the deleted entries, and without breaking the other tables. If possible, which command would you use and show me…
-
1
votes1
answer1285
viewsFlip a stack using an additional stack and some variables
I’m needing to reverse an A stack using another additional stack B and some variables in pseudo code. For the stack A to be reversed at the end of the algorithm. Someone can help?
-
1
votes1
answer968
viewsAttributeerror: 'list' Object has no attribute 'apend'
Why does this errp occur? "Attributeerror: 'list' Object has no attribute 'apend'" with this code? class Stack : def __init__(self) : self.items = [] def push(self, item) : self.items.apend(item)…
-
1
votes1
answer149
viewsError in my C program
I need to create a program in C, which removes (or copies) the values of a queue, using the output rules of a stack and add them into a new structure. I rode as below but there are two errors:…
-
1
votes1
answer1337
viewsCharacter stack
Good night guys, all right? With my RPN calculator program here and apparently everything is working normal despite great difficulties to work with char stack.Missing implement the potentiation…
-
1
votes1
answer104
viewsIs it incorrect to state that in a stack-type data structure, the element that will be removed from the structure is the one that is stored in the header?
In a data structure proof I had the following question: In a stack type data structure, the element that will be removed of the structure is the one that is stored a) longer ago. b) less time ago.…
-
1
votes1
answer156
viewsAssociating stack with struct in C++
Construct the following program: #include <iostream> #include <stack> using namespace std; struct Register{ string name; int birth; char sex; void Insert(string st_name,int st_birth,…
-
1
votes1
answer70
viewsHow to print elements from a stack?
I have problem formatting output from this program. Below follows the code snippet making the stack impression, then follows the problem img def __repr__(self): r = "" pointer = self.top…
-
1
votes2
answers928
viewsSegmentation failure (recorded core image)
I’m making a program for a simple purpose: Take a sentence and turn it into a version of it with the characters of each word isolated to the contrary, as: "I’m in trouble" would become "uotsE moc…
-
1
votes1
answer329
viewsHow to allocate a dynamic stack with user-provided size?
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…
-
1
votes2
answers138
viewsAre variables declared within blocks or subprograms dynamically allocated?
I’m reading the book "Algorithms and Programming with Examples in Pascal and C" and in it there are two paragraphs that left me in doubt, are they: Two alternative forms are offered by some…
-
1
votes1
answer349
viewsCheck if an expression is well formed
I was trying to make a program that checks if an expression is well formed. Something like {[()()]} is well formed while something like {{())({] is not. I implemented a bilbioteca "cell. c" from…
-
1
votes0
answers47
viewsProblem with Pilha
Good night, you guys! I’m trying to do a 2011 OBI exercise. Here’s the link to it: Exercise OBI 2011- Expressions and found some problems to accomplish it. In short, the exercise provides you with a…
-
1
votes1
answer183
viewsCreating a Reverse Polish Rotation Calculator in C
need to do for an exercise an RPN calculator only for cases (+ - / * ), through batteries, it is necessary that the input is of type ABC+*, that the program understands this, the user of the values…
-
0
votes1
answer297
viewsStack Frame - Example
I’m developing a program to simulate a Stack, however I’m having some difficulties in understanding how it works, can I correct this example? main(int y) { int j; f(j+1); } f(int x) { int i; return…
-
0
votes1
answer3626
viewsInvert stack values
I’m trying to reverse the order of the stack elements using the loop while, but I’m not getting it. pilha* inverte(pilha **p) { pilha *outra = cria(); //aloca e seta a qnt com 0 while(vazia(&p))…
-
0
votes1
answer90
viewsStacks with sequential allocation
I’m having problems implementing the code of a stack using vectors: typedef struct pilha pilha; struct pilha { int *v; int topo; int tam_max; }; void Inicializar_Pilha (pilha pi, int tam_max) {…
-
0
votes1
answer70
viewsWarning on battery hands
I’m trying to make a simple stack implementation, however the message appears: Warning: initialization from incompatible Pointer type -Wincompatible-Pointer-types This Warning appears on both line…
-
0
votes0
answers297
viewsWhat are stack tracks and stack bursts?
The only thing I know is that it refers to the use of memory but define pile and why it happens so often ?
stackasked 7 years, 1 month ago Rafael Lemos 551 -
0
votes1
answer57
viewsHow to get Thread Stack?
I’m trying to create a program to get the thread stack, like the image, someone has some way to get it?…
-
0
votes0
answers983
viewsProgram C queue and stack
I created a program in C, to remove (or copy) the values of a queue, using the output rules of a stack and add them into a new structure. But it’s not working the way I’d like it to. You are adding…
-
0
votes1
answer76
viewsWhat logic do I use to write this program in C?
I’m solving a list of exercises on stacks and queues and stuck on a question where ask to write the program according to pseudo code of the question. I have very little experience with C, so I’m not…
-
0
votes1
answer160
viewsQuestion about row in C
Can someone analyze my code and see what might be wrong?. It’s a simulation exercise I got to do in college. Error: Code runs, but loops. Which while has a problem? Code: #include <stdio.h>…
-
0
votes1
answer319
viewsStore stack in txt file
I am starting in C and I have the following problem. I need to save strings in a txt file sorted in stack, so far so good, but I need that when I open the program again, it keeps stacking always at…
-
0
votes0
answers12
viewsWhat is the importance and what is the purpose of an execution stack?
I was looking into it, but I don’t quite understand, if anyone can help
stackasked 4 years, 1 month ago Igor Miyada 1 -
0
votes1
answer39
viewsGo function with parameters instead of name?
Hello, I would like to understand how functions work in the Go language, I made a code to assemble the data structure Stack and I came across two functions that in place of the name has a…
-
0
votes2
answers560
viewsHow to use argc and argv on a windows terminal?
I am creating a stack for valid expression check, but it should be used in this int main( int argc, char **argv ) for input. I compiled and did not make a mistake, but I cannot create an executable…
-
0
votes1
answer45
viewsParallel Computing - Communication between threads
This is a question that arose to me when I was trying to solve a problem in a client, the problem turned out to be something else but the doubt continued. Imagine a situation where there are two…
-
0
votes1
answer637
viewsDestamping Dynamic Stack
I have a dynamic stack algorithm. Only if I insert 10 elements into the stack and pop without removing the first element it from the segmentation failure. And if I remove the first element from the…
-
0
votes1
answer83
viewsStack insertion vector returning all zero
These days I posted the algorithm of this address below here because I was having problems to pop and remove was solved so far. Destamping Dynamic Stack But as I was reviewing the code and therefore…
-
0
votes1
answer1647
viewsHow to Insert a string into the data stack
I need to make a stack that does a push, pop and print. So I created the functions and this works. But I wanted to add a String to my stack. Possibly a number and time or just a string. But I can’t…
-
0
votes1
answer97
viewsError in my data structure [STACK]
My code is presenting two errors. As I am learning, I have tried several ways to fix it. Please someone can help me ? I need to insert a number and a string into my stack. But it’s giving error in…
-
0
votes0
answers177
viewsC - Stack Smashing Detected - How to correctly initialize a graph by adjacency list and insert edges?
I am receiving, sporadically and without having made any changes to the code or input, an error called Stack Smashing Detected. The only things I’m doing is initializing a graph and inserting an…
-
0
votes0
answers397
viewsInfixa to Pósfixa conversion - C STACK
Code that should be given an arithmetic expression in infix notation (common) for postsphere notation (reverse Polish). For example, when receiving (A+BC) he should print ABC+. The problem with my…
-
0
votes1
answer8098
viewsStack error Smashing Detected in C
Could someone help me on the following question: Create a program that fills a 6x4 matrix with integers, calculate and show how many elements of this matrix are greater than 30, and then assemble a…
-
0
votes1
answer452
viewsCells with vectors in C, is showing the elements that have already been removed
How do I show my vector without the numbers that have been removed? 'Cause when I show him, even if I take a number off the function, he still shows up inside. #include <stdio.h> #include…
-
0
votes1
answer523
viewsSearching in depth using a stack
I’m trying to do an in-depth search using a stack, but it’s making a mistake on a if and I don’t know why. package Grafos; import java.io.*; import java.util.*; public class Grafo {…
-
0
votes1
answer493
viewsReverse Dynamic Stack
Could someone help me with this pile? The goal is to create a function that reverses the values of the stack, I tried to do this using the Invert() function of the code below, but it is not working,…
-
0
votes1
answer97
viewsPress factorization using Stack
I made a stack with vector, with basic functions (push, pop, Peek) and with it I want to make a prime factorization of a value. I made the program, but when I compile it, it is in an infinite loop…
-
0
votes1
answer80
viewsCasting error
I have a program that works with the inverse Polish notation, which is, when we have an operation ((2+3)8), in Polish notation stands "23+8". I already managed to pass the operation to the Polish…
-
0
votes2
answers264
viewsProblem decreasing the size of a stack in c
This program is an exercise to work with stacks, it’s all right, but when I decrease the stack size to exclude the last term it appears in the penultimate element of the vector. #include…
-
0
votes1
answer169
viewsfree() in char dynamic stack does not work - C
Hello, I’m having trouble trying to release dynamically allocated memory. For small string there is time that works, but for large string the program tops. There’s a time when a 3-character or…
-
0
votes1
answer34
viewsTransform only ascii numbers 0-9 to int
I have the following code string t_postfix = getPostfix(); Stack<int> operandos; //pilha dos operandos for(int i=0;i<n;i++){ //loop para pegar operando e realizar operações…
-
0
votes1
answer259
viewsPython - stack - - balancing
I can’t find the error in this code: A sequence of parentheses "(" ")", brackets "[" "]" and keys "{" "}" is said to be balanced if each "open" symbol is "closed" at an appropriate time For example…
-
0
votes0
answers54
viewsWhy does it give this error when executing the code? java.lang.Arrayindexoutofboundsexception: 0
package PilhaEstatica; public class App { public static void main(String[] args) { int numero = Integer.parseInt(args[0]); Pilha p = new Pilha(); int…
-
0
votes0
answers54
viewsDifficulty with cell array
I have to create, in C, a program that receives a train of N wagons and rearranges these wagons in ascending order from 1 to N; To rearrange, K waiting rails are used (value informed by the user);…
-
0
votes1
answer97
viewsHow do I make a program to invert a password by ignoring the # and _?
I have an exercise to do with this theme but I can’t reverse the second part after a special character. Example: teste_baixo#123 would be traded for etset_oxiab#321. import java.util.Scanner; public…
-
0
votes1
answer216
viewsError: stack Smashing Detected
I’m having the mistake: * stack Smashing Detected *: terminated in my program Use the compiler g++ (Ubuntu 7.5.0-3ubuntu1~18.04) 7.5.0, here is the code: #include <iostream> using…
-
0
votes0
answers26
viewsProblems in a stack whose positions should be selected? ( Warning: implicit declaration and Warning: Pointer from integer)
Hello, today I bring here a question related to data structures that surely can add in the understanding of all envovilido. It is a matter of pile manipulation where through the act of traversing…