{"id":734,"date":"2020-06-08T06:24:48","date_gmt":"2020-06-08T06:24:48","guid":{"rendered":"http:\/\/learnlearn.uk\/alevelcs\/?page_id=734"},"modified":"2021-04-22T03:11:30","modified_gmt":"2021-04-22T03:11:30","slug":"stack","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/alevelcs\/stack\/","title":{"rendered":"Stack"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Introduction<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Introduction to Stacks<\/h3>\n<h4>What is a stack?<\/h4>\n<p>A stack is a First In Last Out (FILO) data structure that is commonly used for a variety of purposes in computer systems.<\/p>\n<p>Example usage:<\/p>\n<ul>\n<li>Recursion<\/li>\n<li>Expression Evaluation<\/li>\n<li>Parsers<\/li>\n<li>Backtracking Algorithms<\/li>\n<\/ul>\n<p>A common analogy of a stack is when you are washing dishes. As more dishes are brought in to wash they are added to the top of the stack of dishes. When you have finished washing a plate you take the next plate from the top of the pile<\/p>\n<p>&nbsp;<\/p>\n<div class=\"arconix-box arconix-box-lgreen\"><div class=\"arconix-box-content\">\n<p><strong>What do you need to know for AS Level?<\/strong><\/p>\n<p>You need to be able to:<\/p>\n<ul>\n<li>Describe the key features of a stack, queue and linked list and <strong>justify their use<\/strong> for a given situation<\/li>\n<li>Candidates will not be required to write pseudocode for these structures, but they should be able to <strong>add, edit and delete<\/strong> data from these structures.<\/li>\n<\/ul>\n<\/div><\/div>\n\n<\/div><h2 class=\"tabtitle\">Stack Methods<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Stack Methods<\/h3>\n<p>Stacks have three main methods:<\/p>\n<ul>\n<li>Push<\/li>\n<li>Pop<\/li>\n<li>Peak<\/li>\n<\/ul>\n<p><strong>Push<\/strong><\/p>\n<p>This is where an item is added to the top of the stack. If the stack is full and the item cannot be added then an error is raised.<\/p>\n<p><strong>Pop<\/strong><\/p>\n<p>This is where an item is removed from the top of the stack and returned to the program for further processing. If the stack is already empty then an error is raised.<\/p>\n<p><strong>Peek<\/strong><\/p>\n<p>This is where the value contained at the top of the stack is returned to the program without removing the item from the stack. If the stack is empty then an error is raised.<\/p>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">Python Stack<\/h2>\n<div class=\"tabcontent\">\n\n<p>Python Implementation<\/p>\n<p><strong>Python (Functional Programming)<\/strong><\/p>\n<p><iframe loading=\"lazy\" src=\"https:\/\/trinket.io\/embed\/python\/c0f3ea3d30\" width=\"100%\" height=\"600\" frameborder=\"0\" marginwidth=\"0\" marginheight=\"0\" allowfullscreen=\"allowfullscreen\"><\/iframe><\/p>\n<p><strong>Python (Object Orientated Programming)<\/strong><\/p>\n<p><a href=\"https:\/\/visualgo.net\/en\/list?slide=1\">Link List (can use to implement a stack)<\/a><\/p>\n\n<\/div><h2 class=\"tabtitle\">Resources<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Resources<\/h3>\n<p><a href=\"https:\/\/docs.google.com\/presentation\/d\/1EfZ8DWskKChmuqmyXf9mqgT4mRTVOxbVZaUQ-OL7lcQ\/edit?usp=sharing\">Stacks &#8211; Teacher Presentation<\/a><\/p>\n<h4>Past Paper Questions<\/h4>\n<p><strong>AS Level Questions<\/strong><\/p>\n<p>I couldn&#8217;t find any past paper questions at AS Level&#8230;<\/p>\n<p><strong>A Level Questions<\/strong><\/p>\n<p><a href=\"https:\/\/pastpapers.papacambridge.com\/view.php?id=Cambridge%20International%20Examinations%20%28CIE%29\/AS%20and%20A%20Level\/Computer%20Science%20-%209608\/2018-Oct-Nov\/9608_w18_qp_43.pdf\">W18 Paper 43 &#8211; Question 3<\/a><\/p>\n<p>&nbsp;<\/p>\n<p>example &#8211; browsing history app. (click link \/ press back button)<\/p>\n<\/div><\/div>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Introduction to Stacks What is a stack? A stack is a First In Last Out (FILO) data structure that is commonly used for a variety of purposes in computer systems. Example usage: Recursion Expression Evaluation Parsers Backtracking Algorithms A common analogy of a stack is when you are washing dishes. As more dishes are brought&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/alevelcs\/stack\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">Stack<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":70,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":""},"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v20.6 - https:\/\/yoast.com\/wordpress\/plugins\/seo\/ -->\n<title>Stack - A Level Computer Science<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/learnlearn.uk\/alevelcs\/stack\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Stack - A Level Computer Science\" \/>\n<meta property=\"og:description\" content=\"Introduction to Stacks What is a stack? A stack is a First In Last Out (FILO) data structure that is commonly used for a variety of purposes in computer systems. Example usage: Recursion Expression Evaluation Parsers Backtracking Algorithms A common analogy of a stack is when you are washing dishes. As more dishes are brought&hellip;&nbsp;Read More &raquo;Stack\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/alevelcs\/stack\/\" \/>\n<meta property=\"og:site_name\" content=\"A Level Computer Science\" \/>\n<meta property=\"article:modified_time\" content=\"2021-04-22T03:11:30+00:00\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Estimated reading time\" \/>\n\t<meta name=\"twitter:data1\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/stack\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/stack\/\",\"name\":\"Stack - A Level Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\"},\"datePublished\":\"2020-06-08T06:24:48+00:00\",\"dateModified\":\"2021-04-22T03:11:30+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/stack\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/alevelcs\/stack\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/stack\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"A Level Computer Science Home\",\"item\":\"https:\/\/learnlearn.uk\/alevelcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Stack\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/\",\"name\":\"A Level Computer Science\",\"description\":\"CIE Specification\",\"publisher\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/learnlearn.uk\/alevelcs\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"en-GB\"},{\"@type\":\"Organization\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#organization\",\"name\":\"A Level Computer Science\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-GB\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png\",\"contentUrl\":\"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png\",\"width\":710,\"height\":98,\"caption\":\"A Level Computer Science\"},\"image\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/\"}}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Stack - A Level Computer Science","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/learnlearn.uk\/alevelcs\/stack\/","og_locale":"en_GB","og_type":"article","og_title":"Stack - A Level Computer Science","og_description":"Introduction to Stacks What is a stack? A stack is a First In Last Out (FILO) data structure that is commonly used for a variety of purposes in computer systems. Example usage: Recursion Expression Evaluation Parsers Backtracking Algorithms A common analogy of a stack is when you are washing dishes. As more dishes are brought&hellip;&nbsp;Read More &raquo;Stack","og_url":"https:\/\/learnlearn.uk\/alevelcs\/stack\/","og_site_name":"A Level Computer Science","article_modified_time":"2021-04-22T03:11:30+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/alevelcs\/stack\/","url":"https:\/\/learnlearn.uk\/alevelcs\/stack\/","name":"Stack - A Level Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#website"},"datePublished":"2020-06-08T06:24:48+00:00","dateModified":"2021-04-22T03:11:30+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/stack\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/alevelcs\/stack\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/alevelcs\/stack\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"A Level Computer Science Home","item":"https:\/\/learnlearn.uk\/alevelcs\/"},{"@type":"ListItem","position":2,"name":"Stack"}]},{"@type":"WebSite","@id":"https:\/\/learnlearn.uk\/alevelcs\/#website","url":"https:\/\/learnlearn.uk\/alevelcs\/","name":"A Level Computer Science","description":"CIE Specification","publisher":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/learnlearn.uk\/alevelcs\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"en-GB"},{"@type":"Organization","@id":"https:\/\/learnlearn.uk\/alevelcs\/#organization","name":"A Level Computer Science","url":"https:\/\/learnlearn.uk\/alevelcs\/","logo":{"@type":"ImageObject","inLanguage":"en-GB","@id":"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/","url":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png","contentUrl":"https:\/\/learnlearn.uk\/alevelcs\/wp-content\/uploads\/sites\/20\/2019\/09\/LearnLearnLogowhite.png","width":710,"height":98,"caption":"A Level Computer Science"},"image":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#\/schema\/logo\/image\/"}}]}},"rttpg_featured_image_url":null,"rttpg_author":{"display_name":"learnlearnadmin","author_link":"https:\/\/learnlearn.uk\/alevelcs\/author\/learnlearnadmin\/"},"rttpg_comment":0,"rttpg_category":null,"rttpg_excerpt":"Introduction to Stacks What is a stack? A stack is a First In Last Out (FILO) data structure that is commonly used for a variety of purposes in computer systems. Example usage: Recursion Expression Evaluation Parsers Backtracking Algorithms A common analogy of a stack is when you are washing dishes. As more dishes are brought&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/734"}],"collection":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/comments?post=734"}],"version-history":[{"count":14,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/734\/revisions"}],"predecessor-version":[{"id":1963,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/734\/revisions\/1963"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/media?parent=734"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}