Files
leetcode/apps/docs/public/stack-plates-metaphor.svg
T

62 lines
7.1 KiB
XML
Raw Normal View History

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Pixodesk SVG (https://pixodesk.com) -->
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 800 400" text-rendering="geometricPrecision" shape-rendering="geometricPrecision">
<defs>
<marker id="arrowhead" refX="9" refY="3" markerHeight="10" markerWidth="10" orient="auto">
<path fill="#e74c3c" d="M0,0L10,3L0,6"/>
</marker>
<marker id="arrowhead-green" refX="9" refY="3" markerHeight="10" markerWidth="10" orient="auto">
<path fill="#27ae60" d="M0,0L10,3L0,6"/>
</marker>
</defs>
<rect fill="#f8f9fa" rx="10" ry="0" width="800" height="399.6807"/>
<text fill="#2c3e50" text-anchor="middle" font-family="Arial, sans-serif" font-size="22" font-weight="700" xml:space="preserve" x="400" y="35" data-gn-el-type="text" style="white-space:pre"><tspan>Stack of Plates - LIFO (Last In, First Out)</tspan></text>
<g id="push-operation" transform="translate(0, -105)">
<text fill="#27ae60" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="700" xml:space="preserve" transform="translate(0, 102)" x="200" y="80" data-gn-el-type="text" style="white-space:pre"><tspan>Adding Plates (Push)</tspan></text>
<rect fill="#7f8c8d" rx="3" ry="0" x="120" y="380" width="160" height="15" style="display:none"/>
<ellipse fill="#3498db" stroke="#2980b9" stroke-width="2" cx="200" cy="370" rx="70" ry="12"/>
<rect fill="#3498db" x="130" y="370" width="140" height="25"/>
<ellipse fill="#2980b9" stroke="#2471a3" stroke-width="2" cx="200" cy="395" rx="70" ry="12"/>
<text fill="#ffffff" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="200" y="387" data-gn-el-type="text" style="white-space:pre"><tspan>Plate 1</tspan></text>
<ellipse fill="#3498db" stroke="#2980b9" stroke-width="2" cx="200" cy="330" rx="70" ry="12"/>
<rect fill="#3498db" x="130" y="330" width="140" height="25"/>
<ellipse fill="#2980b9" stroke="#2471a3" stroke-width="2" cx="200" cy="355" rx="70" ry="12"/>
<text fill="#ffffff" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="200" y="347" data-gn-el-type="text" style="white-space:pre"><tspan>Plate 2</tspan></text>
<ellipse fill="#27ae60" stroke="#229954" stroke-width="2" cx="200" cy="290" rx="70" ry="12"/>
<rect fill="#27ae60" x="130" y="290" width="140" height="25"/>
<ellipse fill="#229954" stroke="#1e8449" stroke-width="2" cx="200" cy="315" rx="70" ry="12"/>
<text fill="#ffffff" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="200" y="307" data-gn-el-type="text" style="white-space:pre"><tspan>Plate 3</tspan></text>
<path fill="none" stroke="#27ae60" stroke-width="3" marker-end="url(#arrowhead-green)" d="M200,250L200,275"/>
<text fill="#27ae60" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="230" y="265" data-gn-el-type="text" style="white-space:pre"><tspan>Add on top</tspan></text>
<text fill="#e74c3c" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="85" y="307" data-gn-el-type="text" style="white-space:pre"><tspan>TOP ➜</tspan></text>
</g>
<g id="lifo-flow" transform="translate(0, -105)">
<path fill="none" stroke="#95a5a6" stroke-width="3" marker-end="url(#arrowhead)" d="M320,300L480,300"/>
<text fill="#e74c3c" text-anchor="middle" font-family="Arial, sans-serif" font-size="16" font-weight="700" xml:space="preserve" x="400" y="290" data-gn-el-type="text" style="white-space:pre"><tspan>LIFO</tspan></text>
<text fill="#7f8c8d" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" xml:space="preserve" x="400" y="330" data-gn-el-type="text" style="white-space:pre"><tspan>Last plate added</tspan></text>
<text fill="#7f8c8d" text-anchor="middle" font-family="Arial, sans-serif" font-size="13" xml:space="preserve" x="400" y="348" data-gn-el-type="text" style="white-space:pre"><tspan>is first removed</tspan></text>
</g>
<g id="pop-operation" transform="translate(0, -105)">
<text fill="#e74c3c" text-anchor="middle" font-family="Arial, sans-serif" font-size="18" font-weight="700" xml:space="preserve" transform="translate(0, 101)" x="600" y="80" data-gn-el-type="text" style="white-space:pre"><tspan>Removing Plates (Pop)</tspan></text>
<ellipse fill="#3498db" stroke="#2980b9" stroke-width="2" cx="600" cy="370" rx="70" ry="12"/>
<rect fill="#3498db" x="530" y="370" width="140" height="25"/>
<ellipse fill="#2980b9" stroke="#2471a3" stroke-width="2" cx="600" cy="395" rx="70" ry="12"/>
<text fill="#ffffff" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="600" y="387" data-gn-el-type="text" style="white-space:pre"><tspan>Plate 1</tspan></text>
<ellipse fill="#3498db" stroke="#2980b9" stroke-width="2" cx="600" cy="330" rx="70" ry="12"/>
<rect fill="#3498db" x="530" y="330" width="140" height="25"/>
<ellipse fill="#2980b9" stroke="#2471a3" stroke-width="2" cx="600" cy="355" rx="70" ry="12"/>
<text fill="#ffffff" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="600" y="347" data-gn-el-type="text" style="white-space:pre"><tspan>Plate 2</tspan></text>
<ellipse fill="#e74c3c" stroke="#c0392b" stroke-width="2" cx="600" cy="230" rx="70" ry="12"/>
<rect fill="#e74c3c" x="530" y="230" width="140" height="25"/>
<ellipse fill="#c0392b" stroke="#a93226" stroke-width="2" cx="600" cy="255" rx="70" ry="12"/>
<text fill="#ffffff" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="600" y="247" data-gn-el-type="text" style="white-space:pre"><tspan>Plate 3</tspan></text>
<path fill="none" stroke="#e74c3c" stroke-width="3" transform="translate(0, 63)" marker-end="url(#arrowhead)" d="M600,250.6757L600,207.2249"/>
<text fill="#e74c3c" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="670" y="245" data-gn-el-type="text" style="white-space:pre"><tspan>Remove from top</tspan></text>
<text fill="#e74c3c" font-family="Arial, sans-serif" font-size="14" font-weight="700" xml:space="preserve" x="485" y="347" data-gn-el-type="text" style="white-space:pre"><tspan>TOP ➜</tspan></text>
</g>
<g id="explanation" transform="translate(0, -105)">
<rect fill="#ffffff" stroke="#bdc3c7" stroke-width="2" rx="8" ry="0" x="50" y="430" width="700" height="55"/>
<text fill="#2c3e50" text-anchor="middle" font-family="Arial, sans-serif" font-size="15" font-weight="700" xml:space="preserve" x="400" y="453" data-gn-el-type="text" style="white-space:pre"><tspan>Stack Behavior: The last plate you add is the first plate you take.</tspan></text>
<text fill="#7f8c8d" text-anchor="middle" font-family="Arial, sans-serif" font-size="14" xml:space="preserve" x="400" y="473" data-gn-el-type="text" style="white-space:pre"><tspan>You can only add or remove plates from the TOP of the stack.</tspan></text>
</g>
</svg>