•<br />
•<br />
•<br />
<br />
Value: push onto the value stack.<br />
Operator: push onto the operator stack.<br />
<br />
Right parenthesis: pop operator and two values; push the result of<br />
DATA STRUCTURE AND ALGORITHM<br />
applying that operator to those values onto the operand stack.<br />
<br />
•<br />
<br />
Dijkstra’s Stack<br />
<br />
Left parenthesis: ignore.<br />
<br />
CẤU TRÚC DỮ LIỆU VÀ GIẢI THUẬT<br />
Thuật toán 2 ngăn xếp của Dijkstra<br />
<br />
operator<br />
value stack<br />
Dr. Dao Nam Anh stack<br />
<br />
Data Structure and Algorithm<br />
<br />
1<br />
<br />
Resource - Reference<br />
•<br />
•<br />
•<br />
<br />
Value: push onto the value stack.<br />
<br />
Slides push onto the operator stack.<br />
Operator: of Robert Sedgewick, and<br />
<br />
Kevin Wayne,<br />
edit by Dao pop Anh. Major Reference:<br />
Right parenthesis:Nam operator and two values; push the result of<br />
<br />
applying that operator to those values onto the operand stack.<br />
<br />
•<br />
<br />
Robert Sedgewick, and Kevin Wayne, “Algorithms”<br />
• Left parenthesis: University, 2011, Addison Wesley<br />
Princeton ignore.<br />
<br />
•<br />
<br />
Algorithm in C (Parts 1-5 Bundle)- Third Edition by<br />
Robert Sedgewick, Addison-Wesley<br />
<br />
value stack<br />
<br />
operator stack<br />
<br />
Data Structure and Algorithm<br />
<br />
2<br />
<br />
Thuật toán 2 ngăn xếp của Dijkstra<br />
•<br />
•<br />
•<br />
<br />
Value: push onto the value stack.<br />
<br />
•<br />
<br />
Left parenthesis: ignore.<br />
<br />
Operator: push onto the operator stack.<br />
<br />
Right parenthesis: pop operator and two values; push the result of<br />
applying that operator to those values onto the operand stack.<br />
<br />
(<br />
<br />
1<br />
<br />
+<br />
<br />
operator stack<br />
<br />
value stack<br />
<br />
infix expression<br />
(fully parenthesized)<br />
<br />
(<br />
<br />
(<br />
<br />
2<br />
<br />
operand<br />
<br />
+<br />
<br />
3<br />
<br />
)<br />
<br />
*<br />
<br />
(<br />
<br />
4<br />
<br />
*<br />
<br />
5<br />
<br />
operator<br />
Data Structure and Algorithm<br />
<br />
)<br />
<br />
)<br />
<br />
)<br />
<br />
3<br />
<br />
Thuật toán 2 ngăn xếp của Dijkstra<br />
•<br />
•<br />
•<br />
<br />
Value: push onto the value stack.<br />
<br />
•<br />
<br />
Left parenthesis: ignore.<br />
<br />
Operator: push onto the operator stack.<br />
<br />
Right parenthesis: pop operator and two values; push the result of<br />
applying that operator to those values onto the operand stack.<br />
<br />
operator stack<br />
<br />
value stack<br />
(<br />
<br />
1<br />
<br />
+<br />
<br />
(<br />
<br />
(<br />
<br />
2<br />
<br />
+<br />
<br />
3<br />
<br />
)<br />
<br />
*<br />
<br />
(<br />
<br />
4<br />
<br />
*<br />
<br />
5<br />
<br />
Data Structure and Algorithm<br />
<br />
)<br />
<br />
)<br />
<br />
)<br />
<br />
4<br />
<br />
Thuật toán 2 ngăn xếp của Dijkstra<br />
•<br />
•<br />
•<br />
<br />
Value: push onto the value stack.<br />
<br />
•<br />
<br />
Left parenthesis: ignore.<br />
<br />
Operator: push onto the operator stack.<br />
<br />
Right parenthesis: pop operator and two values; push the result of<br />
applying that operator to those values onto the operand stack.<br />
<br />
operator stack<br />
<br />
value stack<br />
(<br />
<br />
1<br />
<br />
+<br />
<br />
(<br />
<br />
(<br />
<br />
2<br />
<br />
+<br />
<br />
3<br />
<br />
)<br />
<br />
*<br />
<br />
(<br />
<br />
4<br />
<br />
*<br />
<br />
5<br />
<br />
Data Structure and Algorithm<br />
<br />
)<br />
<br />
)<br />
<br />
)<br />
<br />
5<br />
<br />