Tag: stack
Evaluate Reverse Polish Notation
Date: 3/1/2024Tags:algorithmsleetcodestackSummarized: The "Evaluate Reverse Polish Notation" problem involves calculating arithmetic expressions in reverse Polish notation using a stack-based approach, focusing on round-towards-zero division, correct operand ordering, and a provided code implementation utilizing an `ArithQueue` class for operations.
Min Stack
Date: 2/26/2024Tags:algorithmsleetcodestackThe journal entry discusses the Min Stack problem, outlining a solution with a MinStack class in JavaScript that efficiently tracks the minimum value using a private variable `curMin` and an additional array `minVals` to push and pop minimum values when necessary in O(1) time, optimizing space by only storing unique min values.
Print Immutable Linked List in Reverse
Date: 1/22/2024Tags:algorithmsleetcodestackThis journal entry explains the process to print an immutable linked list in reverse using recursion, and provides a code example to demonstrate the solution.
Amortize method when increasing array size on stack implementation
Date: 1/22/2024Tags:algorithmsstackThe journal entry discusses the implementation of an array-based stack, where the array's size is increased each time an item is added to the stack, leading to an amortized cost of N^2/2 times due to the need to copy N items from the old array to the new array; however, the entry suggests improving the implementation by doubling the array's size each time it is filled, leading to a running time of O(N) instead of N squared.