Lecture 03 - Stacks
Lecture 03 - Stacks
CSE 4303
Data Structure
Asaduzzaman Herok
Lecturer | CSE | IUT
[email protected]
Stacks
According to the Merriam webster dictionary:
Stack(noun): a large usually conical pile (as of hay, straw, or grain in the sheaf) left standing
in the field for storage
Stack(verb): to arrange in a pile or to pile in or on.
Stack(Data structure): A data structure where elements are arranged in pile and supports
last-in–first-out (LIFO) behavior.
Nesting indicates that any closing tag must match the most recent opening tag
Strategy for parsing XHTML:
➔ read though the XHTML linearly
➔ place the opening tags in a stack
➔ when a closing tag is encountered, check that it matches what is on top of the stack
<html>
<head><title>Hello</title></head>
<body><p>This appears in the <i>browser</i>.</p></body>
</html>
Asaduzzaman Herok, Lecturer
01 September, 2023 8
Department of Computer Science and Engineering, IUT
Application:
Matching
Parenthesis
Rafsanjany Kushol
PhD Student, Dept. of Computing Science,
University of Alberta
Sabbir Ahmed
Assistant Professor
Department of CSE, IUT