hi, can anyone give me the different stack functions...our teacher just gave us the bare bones, what the different functions do...but no sample code...thank you
3 1577
hi, can anyone give me the different stack functions...our teacher just gave us the bare bones, what the different functions do...but no sample code...thank you
hi..
do you need the functions those can be done on stack or else the implementation of stack??
any way :-
Functions on stack are:
1. Push - to add element into stack
2. Pop - to remove TOP element from stack (FILO order)
3. IsFull -to check whether stack is full
4. IsEmpty - to check whether stack is empty.
(i think 3,4 are proper stack functions)
Implementation of stack:
(place where we can implement stack)
1. When function calll occurs (operands and controls are stored to stack)
2. for infix ,postfix notations..
3. all the places when you need to serve the last come first serve basis..
hi, can anyone give me the different stack functions...our teacher just gave us the bare bones, what the different functions do...but no sample code...thank you
Stacks are pretty simple and most only have 3 or 4 functions. -
-
// These functions assume a stack that stores values of type int
-
-
int empty(); // Tests if the stack is empty
-
-
int peek(); // Returns the value on the top of the stack, but doesn't removei it.
-
-
int pop(); // Removes the value on the top of the stack and returns it
-
-
void push(int value); // Pushes a value onto the top of the stack
-
-
ok thanks for the replies but that's not what i needed, our teacher gave us the functions but not what's in those functions, and it should be for char not int
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Vanessa T. |
last post by:
Hello All!
Is there a place where I can learn stacks, (push and pop) etc.
Thanks,
|
by: Ice |
last post by:
Hi there,
I'm not sure if this is the right group for this- If it isn't, could
anyone point me in the right direction?
For our data structures exam, we are usually asked to implement the
structures we've studied (ofcourse in c++). For e.g. implementations of
a stack could be paranthesis matching/evaluating polish notation etc.
Can anyone suggest implementations/usage of the above mentioned data
|
by: Sathyaish |
last post by:
I've searched Google and found a few, but I am not so satisfied. Any
good reading on "stacks and heaps" about how and when memory is
allocated from the heap?
|
by: pmm |
last post by:
Hi all,
Plz dont fire at me if this is a silly question
Is there any way to know in which direction stack grows
pmm
|
by: LedZep |
last post by:
This program has to use a stack to determine whether a
string is a palindrome (a string that is spelled identically backward
and forward). The program has to ignore spaces, case sensitivity and
punctuation. I have to somehow take the input from the txtbox, stack
it letter by letter onto a stack, then display it written forward and
below it written backwards. I understand the concept of stacks -- I
just need a little push in the right...
| |
by: Rich Kucera |
last post by:
Holding all versions at 5.0.4, Multiple stacks with multiple-version
configurations inevitable
Will have to wait to see what the impact of problems such as
http://bugs.php.net/bug.php?id=33643 to the application world. We may
wait for a suitable popular resolution and jump to that version in the
future. There's already a rift between PHP4 and PHP5, and then further
developments such as these create another, splitting the camp into 4....
|
by: Daniel |
last post by:
Hi,
I have a question regarding the memory managment in stl stacks. I want
to use stacks to store a very large amount of numbers (some millions),
thus I'm interested in how the stack behaves when it has to increase
its memory.
http://www.sgi.com/tech/stl/stack.html, the stacks default underlying
container is a deque that has amortized constant time insertion and
removal of elements.
|
by: chubbykelly |
last post by:
hi, i got a prob with the new topic my teacher in data struct taught us
this afternoon. he introduced the concept of stacks. simulated how 5
elements will be pushed and popped out to the array elements and arrange
them in ascending order. but he did not show the c program for it. i
want to learn how to program it. can u help me with this please?
thanks,
kelly
|
by: raghuveer |
last post by:
i want to implement multiple stacks using arrays..I am able to create ,insert and print them but not poping an element form any of the stack..This is what i have
#include<stdio.h>
#include<conio.h>
int top;
int bot;
void main()
{
|
by: cerise |
last post by:
I can't figure out how to make and handle multiple stacks and use them so I could create four linked list stacks representing each suit of cards, one stack each for diamonds, hearts, spades, and clubs. I use objects as my cards. I don't know how to make more than one stack.
Can anyone help me out? If I'm not being clear, I'll be happy to clarify the problem I have.
here is the class I used to make the Objects for cards,
public class...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| |