Questions tagged [stack]

A stack is a last in, first out (LIFO) abstract data type and data structure. For questions about the call stack, use [callstack] or [stack-pointer] instead. For questions about the Haskell build tool, use [haskell-stack] instead.

0
votes
0answers
10 views

can't deploy mean stack on azure

I'm trying to run my mean stack app on azure but it's running the default page instead of my app. How can I run my app on azure after pushing it into azure? I tried to run my app on azure but it didn'...
0
votes
0answers
27 views

Understanding this stack push operation

Is my understanding the working of push operation of this stack.Please review my explanation so that i can know what i have understood is correct or not.I am doing this for writing a blog on this ...
1
vote
0answers
12 views

Rule system using Tree

I have rules represented as a Tree root provider airline flightCode action ---- -------- ------- ---------- ------ ├────── A │       └─────── QG │       ├────── QG-123 x=1 │       ...
0
votes
2answers
32 views

How to remove previous stack of UIView after adding a new one?

I want to add a new subview every time I swipe right, but then it will stack many times if I do not destroy the previous subview. I know how to remove it, but I am struggling with the logic of how to ...
1
vote
4answers
79 views

Checking a string is palindromic using stacks

I want to check a string is palindromic using stacks implement in java. I have tried many ways but its not getting me the correct answer. Can someone help me with it? I have implemented a Stack in ...
0
votes
0answers
38 views

Passing stack to a function without allocating the stack [duplicate]

I shouldn't suppose to change the main function. I allocate and fill the stack in another function and when I try to reach in main function, it gave me segmentation fault. I try to allocate the ...
1
vote
0answers
45 views

R: C stack error when using recursive function - optimizing the code

I am trying to make a simple "model" of loss of an initial value based on a number of criteria, as seen in my code below: mtDNAlen = 16299 copies = 10 mito = 50 fraction = copies*mtDNAlen*0.75 Rounds ...
0
votes
0answers
28 views

What is the order for each of the following tasks in the worst case?

this is a homework problem and I was wondering if anyone would be able to help me figure it out and let me know if I'm correct because I'm still confused with worst case and Big-O notation. Thank you ...
0
votes
1answer
11 views

Trying to position Flutter List to bottom of screen

I'm trying to position a List (puzzlePieces) at the bottom of the container on the screen. I've tried various alignment and position options, but most widget children do not accept a List. I would ...
0
votes
0answers
27 views

Changing a value in a matrix then adding to a stack but two values added are the same in stack?

So I'm trying to load up my Stack which is just the regular implementation used for a Stack as in it's a list and when I add I use the append function. I'm trying to add two matrices each differs by ...
0
votes
0answers
20 views

Stack Allocation using g++ [duplicate]

https://people.eecs.ku.edu/~jrmiller/Courses/JavaToC++/StackAllocatedArrays.html It says here that you can stack allocate using g++ even when the size of the array is not known at compile time... How ...
-2
votes
0answers
35 views

Why my printStack() function prints garbage value? [closed]

My printStack() function prints stack members and also garbage value. How to stop it? Here temp = temp->next; runs 1 more time than it should run. #include<iostream> using namespace std; ...
0
votes
1answer
20 views

Are function argument variables popped off of the stack when the argument is an object?

So I've read about the stack and heap recently and how are they managed in runtime, but there's a case that's been bothering me, since I have a specific usecase in my test suites. For example, ...
0
votes
1answer
16 views

Change the soft limit on Stack using ulimit command

I am studying Stack Memory and I am trying to increase the Soft Limit. The commands that I found to do so are: Show the Stack size in KBs: ulimit -s I can vary it using: ulimit -s value The O.S....
-2
votes
1answer
26 views

How do you determine (code) if the stack is empty?

I am learning data structures and am currently working on stacks. I was wondering how you determine if the stack is empty? from copy import deepcopy class Stack: def __init__(self): """ ...
-7
votes
1answer
52 views

How to read the following x86 Assembly Code? [closed]

I'm learning in security side, and few days age I found an exercise about it. It was about some x86 assembly code with anti-disassembly technique. I'm really new to the x86 assembly code. Currently I ...
0
votes
1answer
18 views

FATAL ERROR: Thread 1: EXC_BAD_ACCESS (code=EXC_I386_GPFLT). My code won't run

When I run my program with predetermined inputs, I get the error message. What could be causing it and how can I fix it? I don't know what to do. I've researched the topic on Google and none of the ...
2
votes
1answer
62 views

Why does my custom stack class use so much memory?

I made own stack based on single linked list, and it works fine, but when I took a look at the memory usage... A console application using a stack containing 100k integers took 6.5 MB. It's terrible, ...
-2
votes
0answers
29 views

What effect do non-null values have in Java memory manager (TextBook problem) [closed]

This question was in my textbook, I need some help! In the ArrayStack implementation, after the first call to remove(i), the backing array, a, contains n + 1 non-null values despite the fact that ...
-2
votes
1answer
55 views

Can't change return address of the function x64

I am trying to change the return address of some function in C for skipping one instruction. I am doing this on virtual machine with Ubuntu Server (because on Mac gcc doesn't let me turn off stack ...
0
votes
0answers
48 views

C++ stack of stacks [duplicate]

I'm trying to implement a stack using a set of stacks. Each stack has a maximum size (threshold), every time this size is reached (that is, the current stack is full), I pass to next one. This ...
0
votes
1answer
28 views

Is FIFO in a queue is equivalent to LILO?

I am a little confused here. The article said: A Queue is a linear structure which follows a particular order in which the operations are performed. The order is First In First Out (FIFO). A good ...
0
votes
0answers
22 views

My codes using 'pandas.dataframe.nlargest()' returns a memory error

I'm trying to find top n values from my pandas dataframe. (raw data is around 2000*2000 idx*column size) It is returning Memory Error. Not even sure what exactly my error means. Tried to google it ...
-1
votes
1answer
21 views

How to upload image along with some data and how to format date in mern stack

I am new in react I have to create a blog page in which admin can add blogs . In add form I need blog title image date and blog description. In backend I have to use nodejs mongo db express js. I have ...
0
votes
0answers
13 views

How to explain stack and the stack-overflow error in a easy way?

Im trying to explain the stack-overflow error in the simlplest way possible. I understand that the error itself its an error that often happens when a method keeps calling itself wish lead to a loss ...
2
votes
1answer
45 views

How to build stacks out of assembly code?

I am studying cybersecurity at the moment, and we learned how to build stacks out of an assembly code piece. But because of a lack of examples I am not sure about my idea of doing this. The question ...
0
votes
0answers
17 views

Queue Front/Back is displaying different numbers & Stack and Queues was not declared in the scope

I'm really noob at C++ programming and I really need some help guys. Our teacher doesn't explain how to program well so I rely to self studying the modules and lessons. Our tasks is to create a system ...
1
vote
0answers
23 views

How to fix 'Runtime Error '438' Object does not support this property or method' while trying to push a class into a collection within another class [duplicate]

As the title says, I am getting errors when trying to push an object onto a stack. I've attached the classes and tester code below: Tester: Sub stackTest() Dim stackTest As cStack Dim ...
-2
votes
1answer
65 views

How to prevent recursive function call (tail-recursion) from piling up in stack?

When a function calls itself in the last line or with return command, it seems to be unnecessary to keep caller in stack. I tested this theory with "gcc" and found out that caller function remains in ...
0
votes
1answer
46 views

How can it be possible that heap memory takes up more RAM than stack memory? [duplicate]

I'm taking an Operating Systems class in C for my Computer Science major. I am curious if whether or not this has to do with any wasted space when memory is allocated and if whether or not this ...
-1
votes
0answers
11 views

Creating and deleting stack spaces in MIPS procedure

#=========================================== # PrintStr - prints a string # arguments: # $a0 = arress of the string # return value: # n/a #=========================================== PrintStr: ...
-1
votes
0answers
17 views

Converting a string to a postfix and solving

Writing a c++ application that will take a string and solving using Postfix. I've tried converting the string to char and using a for loop, but the results are the same. #include <iostream> ...
-1
votes
1answer
41 views

Problem about implementation of a stack in C++

I've to solve an exercise about stacks in C++. I need to implement a Stack class, which support pop() and push() operations. My input is a file input.txt which contains 100 rows. Each row contain 2+N ...
0
votes
0answers
27 views

Stacks Pops the 0th Element

This program pops the 0th element of the stack. I am doing inorder traversal of a binary tree using a stack. I'm also trying to figure out the single parent nodes of the binary search tree. This is ...
0
votes
0answers
42 views

Flutter, Stack of buttons with Alignment makes only last button work

It seems that when I add alignment inside each container in Stack, the only button that would work is always the last one. What causes this behavior? child: Stack( children: <...
-1
votes
1answer
28 views

Cannot stack 2D arrays into 3D array

I am trying to stack some 2D arrays of the same size my code looks like this: import numpy as np a = np.random.randn(30_140_100) b = np.random.randn(30_140_100) c = np.random.randn(30_140_100) d = ...
0
votes
1answer
67 views

MIPS hermite stack example use

I'm stuck on a stack. I have to call to a function in mips-32 assembly code, in which I have to evaluate a Hermite polynomial just by giving the n and the x as parameters. It must be done using ...
-1
votes
0answers
21 views

How do i convert from infix to postfix in JavaScript

A postfix expression evaluator works on arithmetic expressions taking the following form: op1 op2 operator Using two stacks—one for the operands and one for the operators—design and implement a ...
-2
votes
1answer
29 views

How can I use a stack to validate if an expression or assignment with BNF in C++?

I have tokenized with a space delimiter into a vector and then I have made it into stack. I want to use the stack to validate whether the expression or assignment is correct. assignment shall have ...
0
votes
1answer
24 views

How can I make my image grid stack in VueJS?

I have pictures vertical and horizontal, I wanted to make waterfall/masonry/pinterest grid layout, I found out that it's possible to make a 'stack' grid, but I've tried many different codes and I ...
-1
votes
2answers
61 views

How to set dynamic uitablviewcell height according to a custom xib height with uistackview

I cannot set UITableViewcell to have dynamic height. I have a custom xib and the structure as below, and already add leading, trailing and top constraint to stack view to its superview class ...
-1
votes
1answer
50 views

What does stack.pop() return?

I was trying the below problem: Given a list of daily temperatures T, return a list such that, for each day in the input, tells you how many days you would have to wait until a warmer ...
1
vote
2answers
37 views

How to Pop all element in Stack using function

Hi i want to empty the full Stack by function not one by one i want to use a loop in a function which delete/Pop all the stack element you can see my code using System; using System.Collections; ...
0
votes
1answer
25 views

How can I get current depth of the Ruby interpreter stack?

I want to get stack depth, to know how deep it go in recursive function. I found How do I get the current depth of the Python interpreter stack? this, and this is what exactly I want, but it's python,...
0
votes
1answer
43 views

How to fix incorrect file output after reading characters from a stack

My program is writing incorrect data to my output file And I am not sure why this is happening. I am essentially trying to check if an equation is balanced by determining if there are any missing ...
0
votes
0answers
19 views

How do Ionic 4 pages work with circular navigation?

What happens in ionic 4 with circular navigation using the ionic back button <ion-back-button> if you have multiple pages that navigate in a circular way? For example... Page A: [routerLink]="[...
0
votes
1answer
40 views

C6262 stack exceeds warning in c++ when using ofstream in file

For practice purposes, I tried creating a console app that will store basic information of employees and store it in a text file called employee-info.txt. I was able to write data in the text file but ...
0
votes
1answer
25 views

Defining the datatype of array of stack struct defined on a header from the main program

I am learning C language - and currently studying the data-structures. I am implementing a basic Stack with an array, in a header file and I would like to be able to include this with different main ...
-1
votes
0answers
19 views

Swapping stacks

I'm trying to write swap function for 2 same sized stacks. So far I did this, but does not work properly void swap(stack<int> s1, Stack<int> s2) { // check for empty stack if (s1....
0
votes
1answer
34 views

How to check if a queue is empty when I need to use two stacks to form a queue?

My homework needs to use two stacks to create a queue. Now my queue can do what the question is asking but it's giving me an error when the test case use while loop to check if queue is empty. ''' ...

http://mssss.yulina-kosm.ru