<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
  <channel>
    <title>devkuma – Stack</title>
    <link>https://www.devkuma.com/en/tags/stack/</link>
    <image>
      <url>https://www.devkuma.com/en/tags/stack/logo/180x180.jpg</url>
      <title>Stack</title>
      <link>https://www.devkuma.com/en/tags/stack/</link>
    </image>
    <description>Recent content in Stack on devkuma</description>
    <generator>Hugo -- gohugo.io</generator>
    <language>en</language>
    <managingEditor>kc@example.com (kc kim)</managingEditor>
    <webMaster>kc@example.com (kc kim)</webMaster>
    <copyright>The devkuma</copyright>
    
	  <atom:link href="https://www.devkuma.com/en/tags/stack/index.xml" rel="self" type="application/rss+xml" />
    
    
      
        
      
    
    
    <item>
      <title>Explanation of the Stack Data Structure</title>
      <link>https://www.devkuma.com/en/docs/data-structure/stack/</link>
      <pubDate>Sun, 10 Apr 2022 01:49:00 +0900</pubDate>
      <author>kc@example.com (kc kim)</author>
      <guid>https://www.devkuma.com/en/docs/data-structure/stack/</guid>
      <description>
        
        
        &lt;h2 id=&#34;concept-of-a-stack&#34;&gt;Concept of a Stack&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;A stack means a pile of things.&lt;/li&gt;
&lt;li&gt;It is a LIFO(Last In First Out) data structure where data can be inserted and removed only from one end.
&lt;ul&gt;
&lt;li&gt;The most recently added data is removed first.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;structure-of-a-stack&#34;&gt;Structure of a Stack&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Top of stack: top&lt;/li&gt;
&lt;li&gt;Bottom of stack: not needed&lt;/li&gt;
&lt;li&gt;Element, item&lt;/li&gt;
&lt;li&gt;Insert/delete operations&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/data-structure/stack-1.png&#34; alt=&#34;Stack&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;stack-operations&#34;&gt;Stack Operations&lt;/h2&gt;
&lt;p&gt;A stack follows LIFO(Last In First Out). In other words, the item most recently added to the stack is the first item to be removed.&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;push(x): adds the given element x to the top of the stack.&lt;/li&gt;
&lt;li&gt;pop(): if the stack is not empty, removes and returns the top element.&lt;/li&gt;
&lt;li&gt;isEmpty(): returns true if the stack is empty, otherwise false.&lt;/li&gt;
&lt;li&gt;peek(): if the stack is not empty, returns the top element without removing it.&lt;/li&gt;
&lt;li&gt;isFull(): returns true if the stack is full, otherwise false.&lt;/li&gt;
&lt;li&gt;size(): returns the number of all elements in the stack.&lt;/li&gt;
&lt;li&gt;display(): outputs all elements in the stack.&lt;/li&gt;
&lt;/ul&gt;
&lt;h2 id=&#34;uses-of-a-stack&#34;&gt;Uses of a Stack&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;Function calls&lt;/li&gt;
&lt;li&gt;Stacks are useful when using recursive algorithms.
&lt;ul&gt;
&lt;li&gt;Recursive algorithms
&lt;ul&gt;
&lt;li&gt;When functions must be called recursively, temporary data is pushed onto the stack.&lt;/li&gt;
&lt;li&gt;When returning from recursive functions and performing backtracking, the temporary data pushed onto the stack must be popped.&lt;/li&gt;
&lt;li&gt;A stack makes this sequence of actions intuitive.&lt;/li&gt;
&lt;li&gt;A stack also makes it possible to implement recursive algorithms in an iterative form.&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Web browser history(back button)&lt;/li&gt;
&lt;li&gt;Undo&lt;/li&gt;
&lt;li&gt;Creating reversed strings&lt;/li&gt;
&lt;li&gt;Checking parentheses in expressions(parentheses checks for operator precedence)
&lt;ul&gt;
&lt;li&gt;Example: determining a Valid Parenthesis String(VPS)&lt;/li&gt;
&lt;/ul&gt;
&lt;/li&gt;
&lt;li&gt;Calculators(postfix notation calculation)&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;img src=&#34;https://www.devkuma.com/docs/data-structure/stack-2.png&#34; alt=&#34;Stack use cases&#34;&gt;&lt;/p&gt;
&lt;h2 id=&#34;references&#34;&gt;References&lt;/h2&gt;
&lt;ul&gt;
&lt;li&gt;&lt;a href=&#34;https://gmlwjd9405.github.io/2018/08/03/data-structure-stack.html&#34; target=&#34;_blank&#34; rel=&#34;noopener&#34;&gt;Data Structure | What Is a Stack?&lt;i class=&#34;fas fa-external-link-alt&#34;&gt;&lt;/i&gt;&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

      </description>
      
      <category>Data Structure</category>
      
      <category>Stack</category>
      
    </item>
    
  </channel>
</rss>
