CSC148H1 Lecture Notes - Lecture 8: Delimiter, Docstring

54 views5 pages
School
Course
Professor
katrinasavvy and 38715 others unlocked
CSC148H1 Full Course Notes
1
CSC148H1 Full Course Notes
Verified Note
1 document

Document Summary

Csc148: lecture 8: stack api and sack api. References: code seen in the pictures can be found on the csc148 website: http://www. teach. cs. toronto. edu/~csc148h/winter/ Computer scans and encounters left bracket and keeps track of it for later reference. If what it encounters is not a left or right bracket, the computer ignore it: use stack to keep track of brackets. Write a function using class stack that: string with no parentheses is balanced, string that beings with a left parenthesis ( ends with a right parenthesis, also applies for brackets and braces [], {} If the left delimiter is found, add it to the stack. If it"s not empty -> stack has some left brackets added to it. Elif left_delim[c] != st. remove: remove delimiter at top and compare it with its match, match with left return st. is_empty. If it"s not empty, there means that there"s a left delimiter left in the stack: no closing right delimiter.

Get access

Grade+20% off
$8 USD/m$10 USD/m
Billed $96 USD annually
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
40 Verified Answers
Class+
$8 USD/m
Billed $96 USD annually
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
30 Verified Answers

Related Documents