#Which Side is the Top?
Which Side is the Top?
#What Makes a Stack Empty?
What Makes a Stack Empty?
#Test Naming
Test Naming
#Reduce Test Noise
Reduce Test Noise
#Test Granularity
Test Granularity
#Which Side is the Top?
#What Makes a Stack Empty?
#Test Naming
#Reduce Test Noise
#Test Granularity
Which Side is the Top?
What Makes a Stack Empty?
Test Naming
Reduce Test Noise
Test Granularity
In my experience1, stacks have tended to grow down stacks have tended to grow down, rather than up. As a consequence, your use of the variable name 'top
' is a little confusing. For linked list stacks, like this, I tend to prefer 'current / head / items ' to represent the last pushed item. However as with all things name related it's somewhat subjective.
In my experience1, stacks have tended to grow down, rather than up. As a consequence, your use of the variable name 'top
' is a little confusing. For linked list stacks, like this, I tend to prefer 'current / head / items ' to represent the last pushed item. However as with all things name related it's somewhat subjective.
In my experience1, stacks have tended to grow down, rather than up. As a consequence, your use of the variable name 'top
' is a little confusing. For linked list stacks, like this, I tend to prefer 'current / head / items ' to represent the last pushed item. However as with all things name related it's somewhat subjective.
In my experience1, stacks have tended to grow down, rather than up. As a consequence, your use of the variable name 'top
' is a little confusing. For linked list stacks, like this, I tend to prefer 'current / head / items ' to represent the last pushed item. However as with all things name related it's somewhat subjective.
1: My experience is primarily with 8086 cpus, where the push instruction decrements the stack pointer (the stack grows down). In the real world on the other hand, stacks or piles tend to grow up. However this discrepancy can create confusion, which is why I've suggested avoiding the name.
In my experience, stacks have tended to grow down, rather than up. As a consequence, your use of the variable name 'top
' is a little confusing.
In my experience1, stacks have tended to grow down, rather than up. As a consequence, your use of the variable name 'top
' is a little confusing. For linked list stacks, like this, I tend to prefer 'current / head / items ' to represent the last pushed item. However as with all things name related it's somewhat subjective.
1: My experience is primarily with 8086 cpus, where the push instruction decrements the stack pointer (the stack grows down). In the real world on the other hand, stacks or piles tend to grow up. However this discrepancy can create confusion, which is why I've suggested avoiding the name.