In algorithms, if you get any variation of the balanced brackets (i.e. balanced round brackets, sqaured brackets, all brackets) problem, then the data structure to use is [...]
Answer
stack
^^ push to stack when you get a opening bracket (only opening brackets get pushed), and pop the opening brackets when you get a closing bracket (and check if it is right type of bracket, square vs round vs etc), and check for empty stack at end.
Question
In algorithms, if you get any variation of the balanced brackets (i.e. balanced round brackets, sqaured brackets, all brackets) problem, then the data structure to use is [...]
Answer
?
Question
In algorithms, if you get any variation of the balanced brackets (i.e. balanced round brackets, sqaured brackets, all brackets) problem, then the data structure to use is [...]
Answer
stack
^^ push to stack when you get a opening bracket (only opening brackets get pushed), and pop the opening brackets when you get a closing bracket (and check if it is right type of bracket, square vs round vs etc), and check for empty stack at end.
If you want to change selection, open document below and click on "Move attachment"
pdf
owner: kkhosravi - (no access) - PYTHON_DATA_STRUCTURES_AND_ALGORITHMS.pdf, p130
Summary
status
not learned
measured difficulty
37% [default]
last interval [days]
repetition number in this series
0
memorised on
scheduled repetition
scheduled repetition interval
last repetition or drill
Details
No repetitions
Discussion
Do you want to join discussion? Click here to log in or create user.