An alternative approach + a correction (#23845)
This commit is contained in:
committed by
Randell Dawson
parent
aeb8ca4d3a
commit
ac3e66b0a4
@ -135,7 +135,10 @@ int main ()
|
|||||||
#### Empty
|
#### Empty
|
||||||
|
|
||||||
Returns whether the `stack` is empty ,i.e. whether your stack size is zero.
|
Returns whether the `stack` is empty ,i.e. whether your stack size is zero.
|
||||||
It returns `true` if stack's size 0 else returns `false`
|
It returns `true` if the size of the stack is 0 else returns `false`. An alternative to using this is
|
||||||
|
```cpp
|
||||||
|
if (stackname.size()==0)
|
||||||
|
```
|
||||||
|
|
||||||
```cpp
|
```cpp
|
||||||
//Empty operation in Stack
|
//Empty operation in Stack
|
||||||
@ -167,8 +170,7 @@ int main ()
|
|||||||
## Uses of Stack
|
## Uses of Stack
|
||||||
|
|
||||||
1. Expression Evaluation and Conversion.
|
1. Expression Evaluation and Conversion.
|
||||||
stacks are used to evaluate and convert expressions like prefx, postfix and infix expression.
|
Stacks are used to evaluate and convert expressions like prefix, postfix and infix expression.
|
||||||
2. In Recursive functions to keep information about the active functions or subroutines.
|
2. In Recursive functions to keep information about the active functions or subroutines.
|
||||||
3. In Backtracking, as in DFS algorithm.
|
3. In Backtracking, as in DFS algorithm.
|
||||||
4. Memory management, run-time environment for nested language features. etc
|
4. Memory management, run-time environment for nested language features. etc
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user