{"componentChunkName":"component---src-templates-blog-post-jsx","path":"/blogs/stackUsingLinkedLists","result":{"data":{"blog":{"frontmatter":{"title":"STACK USING LINKED LISTS","thumbnail":"blog27","date":"December 14, 2020","dsaCppCodeFile":"https://drive.google.com/file/d/1awrRIYxrYx3sND-tKXFRBfN7c2v2Sjpr/view?usp=sharing"},"excerpt":"<div class=\"my-2\">\n              <p>\n                In this blog post, will study how a singly linked list can be\n                used to implement stacks.\n              </p>\n              <h4>Introduction</h4>\n              <div class=\"m-2\">\n                <p>\n                  The other way of implementing stacks is by using Linked lists.\n                  Push operation is implemented by inserting element at the\n                  beginning of the list. Pop operation is implemented by\n                  deleting the node from the beginning (the header/top node).\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Standard Operations</h4>\n              <p class=\"text-muted\">\n                Do refer the code available the end of this section to\n                understand the following theory.\n              </p>\n              <ol class=\"pl-4\">\n                <li>\n                  <strong>Push:</strong> Insert an item at the top of the stack.\n                  If there is no place then stack is in overflow state. This\n                  operation is done by inserting a new node at front of the\n                  list.\n                </li>\n                <li>\n                  <strong>Pop:</strong> Remove the top item from the stack. If\n                  there are no elements then the stack is in underflow state.\n                  This operation is done by removing the front node.\n                </li>\n                <li>\n                  <strong>isEmpty:</strong> To check whether stack is empty or\n                  not. If top(head) is null then list is empty.\n                </li>\n                <li>\n                  <strong>Peek</strong> Access the top item of the stack. Return\n                  the data of top node.\n                </li>\n                <li>\n                  <strong>Display</strong> Display the items in the stack.\n                  Traverse the list and print data in each node.\n                </li>\n              </ol>\n            </div>\n            <div class=\"my-2 p-2\">\n              <strong>Similar posts:</strong>\n              <a href=\"/blogs/stack\">Stacks</a>\n              |\n              <a href=\"/blogs/infixPrefixPostfixExpressions\"\n                >Infix, Postfix, Prefix Expressions</a\n              >\n            </div>\n","html":"<div class=\"my-2\">\n              <p>\n                In this blog post, will study how a singly linked list can be\n                used to implement stacks.\n              </p>\n              <h4>Introduction</h4>\n              <div class=\"m-2\">\n                <p>\n                  The other way of implementing stacks is by using Linked lists.\n                  Push operation is implemented by inserting element at the\n                  beginning of the list. Pop operation is implemented by\n                  deleting the node from the beginning (the header/top node).\n                </p>\n              </div>\n            </div>\n            <div class=\"my-2 p-2\">\n              <h4>Standard Operations</h4>\n              <p class=\"text-muted\">\n                Do refer the code available the end of this section to\n                understand the following theory.\n              </p>\n              <ol class=\"pl-4\">\n                <li>\n                  <strong>Push:</strong> Insert an item at the top of the stack.\n                  If there is no place then stack is in overflow state. This\n                  operation is done by inserting a new node at front of the\n                  list.\n                </li>\n                <li>\n                  <strong>Pop:</strong> Remove the top item from the stack. If\n                  there are no elements then the stack is in underflow state.\n                  This operation is done by removing the front node.\n                </li>\n                <li>\n                  <strong>isEmpty:</strong> To check whether stack is empty or\n                  not. If top(head) is null then list is empty.\n                </li>\n                <li>\n                  <strong>Peek</strong> Access the top item of the stack. Return\n                  the data of top node.\n                </li>\n                <li>\n                  <strong>Display</strong> Display the items in the stack.\n                  Traverse the list and print data in each node.\n                </li>\n              </ol>\n            </div>\n            <div class=\"my-2 p-2\">\n              <strong>Similar posts:</strong>\n              <a href=\"/blogs/stack\">Stacks</a>\n              |\n              <a href=\"/blogs/infixPrefixPostfixExpressions\"\n                >Infix, Postfix, Prefix Expressions</a\n              >\n            </div>"},"thumbnail":{"childImageSharp":{"fluid":{"tracedSVG":"data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20width='400'%20height='225'%20viewBox='0%200%20400%20225'%20preserveAspectRatio='none'%3e%3cpath%20d='M41%2091l-6%201h-1c0-2-8-1-9%201-3%203-2%206%201%208%204%204%204%205%200%205-4-1-5%202-1%203%203%201%206%201%208-1%203-3%202-6-1-8l-3-4h1c1%202%204%202%205%201l3-1c2%200%202%200%202%207%200%206%200%207%202%207s3-4%203-12c0-2%200-3%202-3l2-2c0-2-1-3-2-3l-6%201m16%200l-4%209c-4%209-4%2010%200%2010l2-1%201-2%202-1c2%200%202%200%202%202%200%201%201%202%203%202s2-1%201-10c-1-7-4-10-7-9m13%202c-6%205-5%2017%202%2017%203%200%207-4%207-6s-2-2-4%200l-2%201c-2%200-1-7%200-10%202-1%202-1%202%201%200%203%200%203%203%203s3-5%200-7c-3-3-4-2-8%201m12-2l-1%2010c0%209%200%209%202%209s3-1%203-3l1-3%201%203c3%203%204%203%205%201%201-1%201-3-1-5l-2-3%203-4c2-3%202-3%201-5-2-1-2-1-5%201-2%204-3%204-3%201s-3-4-4-2m49%201l-1%2010v8h11v-4l1-4%201%204c1%203%202%204%204%204s2-1%202-9l1-10c-2-1-5%200-5%203l-1%204-1-4c-1-3-6-5-6-1l-1-1c-1-2-4-3-5%200m26-1c-5%202-6%205-6%2010-1%207%201%209%205%209%206%200%2010-10%204-11-2%200-4%203-3%206l-1%201V96h2c0%201%201%202%203%202s2%200%202-3c-1-4-3-5-6-4m-53%202v16c2%202%207%201%2010-1%203-4%203-17%200-17-2%200-3%202-3%2010l-2%204-1-7c0-6%200-7-2-7l-2%202m16%200c-3%202-2%207%201%209%204%203%204%204%200%204-3-1-5%201-2%203%204%203%2010%200%2010-5l-3-5-3-4%202%201c2%203%204%201%204-2-1-3-7-4-9-1m148%209c-3%203-5%2013-3%2017%201%202%204%203%205%201%201-1-1-9-3-10-4-1%202-9%208-9%207%200%209%205%206%2011-2%205-2%208%200%209%204%201%207-8%204-9l-1-4c0-8-10-12-16-6m31%204l-1%208v7h17l-5%205a66%2066%200%2000-19%2037l-2%2010v1l6-7c7-9%2017-15%2017-10%200%202%201%203%203%203s3-1%201-2l-1-3h4c3%200%202%201%200%204l-2%204v3h-17v7c0%206%200%207-2%208-3%202-3%203%200%203%202%200%203%204%201%206l-6%201c-9%200-11-4-7-9l2-5c0-3-8%206-8%2010-1%203-1%203-10%204-8%200-8%200-8%202s1%203%205%203c5%200%206%200%204%205-1%202%201%202%2048%202h49l1-4c1-2%202-3%205-3%205-1%205-4%200-5h-3v-14c0-14-1-21-4-21l-2-2-1-2c-7-1-7-4-3-12%207-13%207-17%200-22-4-3-5-4-5-8l-1-4c-1-1-1%201-1%204%200%205%200%205-2%204l-23%201-3%201v-10l-14-1-13%201m2%208v6h22v-13h-22v7M23%20132l-1%2010h23v-4c0-5%201-5%203%200%201%203%202%204%204%204s2%200%202-7l1-10c0-2%200-2-2-2-3%200-3%200-3%204v4l-2-4c-1-3-2-3-4-3s-3%200-3%207l-1%208v-8c0-8%200-8-3-8-2%200-2%200-1%201v1l-1%207v5h-7v-7c0-7%200-7-2-7-3%200-3%200-3%209m33-4c-2%2011-1%2014%202%2014%202%200%202%200%202-3s0-3%202-1l2%203h5l7%201c6%200%206%200%206-2%200-3%200-3-4-3l-4-1%202-1c3%200%205-2%205-3l-4-2c-4%200-3-2%202-2%203%200%204-1%204-3s0-2-6-2h-7v4l-1%208v4l-2-3-3-3%203-4c2-3%202-3%201-5-2-1-2-1-4%201l-3%202v-2l-2-2c-2%200-3%201-3%205m29-4l-1%2010v9l2-1c8-1%2010-4%2010-11l-1-7H85m20%208v10h22c9%200%2011-5%205-10l-2-4h1c0%202%203%202%207%200%202%200%202%201%202%207%200%207%200%207%203%207%202%200%202%200%202-7%200-6%200-7%202-7s3-1%203-3%200-2-7-2c-6%200-7%200-7%202h-2c-2-3-6-2-8%200-3%203-3%207%201%209%204%203%204%204%200%204-1-1-3%200-4%201v-7c0-9%200-9-2-9s-3%200-3%204c0%209-1%2010-5%2010h-3l1-7c0-7%200-7-2-7-3%200-3%200-4%209m48-6c-3%203-3%205%201%208s4%204%200%204c-3-1-5%201-3%203s8%201%2010-1c3-2%202-5-1-8l-2-2h2c2%200%203%200%203-2%200-5-6-7-10-2m117%2015l1%209h12v-18h-13v9m55%2016c0%201-1%202-3%202s-2%201-2%204v3h6c9%200%209%200%208%207l1%208v2l-1%203c0%204%200%204%205%204%207%201%2010-1%207-7v-5l-1-3-3-5-1-3h-1v-2l-3-5c-1-2-3-3-7-4l-5-2v3m-52%207l-1%205c0%203%200%204-1%203%200-4-2-3-3%200l2%204%202%203%203%201c2%200%202%200%202-3%200-2%200-3%202-3s2-1%202-4l-1-4-1%203c0%204-2%203-2-2-1-3-1-4-4-3'%20fill='%23d3d3d3'%20fill-rule='evenodd'/%3e%3c/svg%3e","aspectRatio":1.7699115044247788,"src":"/static/fa947f7c15add777fbb7b6996fbb7bfe/ee604/blog27.png","srcSet":"/static/fa947f7c15add777fbb7b6996fbb7bfe/69585/blog27.png 200w,\n/static/fa947f7c15add777fbb7b6996fbb7bfe/497c6/blog27.png 400w,\n/static/fa947f7c15add777fbb7b6996fbb7bfe/ee604/blog27.png 800w,\n/static/fa947f7c15add777fbb7b6996fbb7bfe/f3583/blog27.png 1200w,\n/static/fa947f7c15add777fbb7b6996fbb7bfe/e4d72/blog27.png 1280w","sizes":"(max-width: 800px) 100vw, 800px"}}}},"pageContext":{"blog":"stackUsingLinkedLists","thumbnail":"thumbnails/blog27.png"}},"staticQueryHashes":["2987289216","63159454"]}