Skip to main content
Code Review

Return to Answer

Commonmark migration
Source Link

#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

replaced http://stackoverflow.com/ with https://stackoverflow.com/
Source Link

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.

added footnote
Source Link
forsvarir
  • 11.8k
  • 7
  • 39
  • 72

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.

Source Link
forsvarir
  • 11.8k
  • 7
  • 39
  • 72
Loading
lang-cs

AltStyle によって変換されたページ (->オリジナル) /