{"id":669,"date":"2020-05-27T07:25:57","date_gmt":"2020-05-27T07:25:57","guid":{"rendered":"http:\/\/learnlearn.uk\/alevelcs\/?page_id=669"},"modified":"2020-05-27T07:36:49","modified_gmt":"2020-05-27T07:36:49","slug":"1-dimensional-arrays","status":"publish","type":"page","link":"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/","title":{"rendered":"1 Dimensional Arrays"},"content":{"rendered":"<div class=\"responsive-tabs\">\n<h2 class=\"tabtitle\">Introduction<\/h2>\n<div class=\"tabcontent\">\n\n<h3>What are 1 dimensional arrays and what are they used for?<\/h3>\n<p>1 dimensional arrays are a form of compound data type that are used to store a list of items <strong>in order.\u00a0<\/strong>Sometimes the ordering of items may not be important (such as a shopping list) but sometimes it can be crucial (Names of runners collected as the finish a race).<\/p>\n<p>They are highly useful if you need to:<\/p>\n<ul>\n<li>Search through multiple items to see if a particular example exists\/fits certain criteria.<\/li>\n<li>Perform the same action for each item in the list<\/li>\n<li>Need to find out the relative position of various items in the list (for instance find out the difference between the finishing positions or runners in a race)<\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n\n<\/div><h2 class=\"tabtitle\">Arrays vs Lists<\/h2>\n<div class=\"tabcontent\">\n\n<p><strong>Arrays vs lists in Python<\/strong><\/p>\n<ul>\n<li>Python natively uses lists instead of arrays (you can use Numpy arrays if you need to)<\/li>\n<li>Python lists are very simple to use and highly flexible<\/li>\n<li>They can contain heterogeneous data(lots of different types of data)<\/li>\n<li>They make less efficient use of memory than arrays<\/li>\n<li>Certain maths\/data science uses require the use of arrays instead of lists, but this is rare in general programming)<\/li>\n<\/ul>\n\n<\/div><h2 class=\"tabtitle\">Array Terminology<\/h2>\n<div class=\"tabcontent\">\n\n<p><strong>Traversing \/ Iterating over arrays<\/strong><\/p>\n<p>The most common action to take on an array is to go through each item in an array and performing an action on the item (for instance printing the item out, or checking if it matches certain criteria). This is known is array traversal or Iterating over\/through an array.<\/p>\n<p><strong>Static vs Dynamic arrays<\/strong><\/p>\n<p>Some language implement static arrays, where the size or shape of the array cannot be changed once it has been declared. If you want to change an existing array you have to make a copy of it.<\/p>\n<p>Other language implement dynamic arrays, where you can change the size of the array after it has been declared.<\/p>\n<p><strong>Index \/ Indices<\/strong><\/p>\n<p>This can apply to the index of a particular item in an array (e.g.<em> The index of the element &#8220;dog&#8221; is 4<\/em>) or to can be used generally to describe the manner in which array items are counted (e.g. <em>Python lists index from 0<\/em>).<\/p>\n<p><strong>Upper and Lower Bounds<\/strong><\/p>\n<p>The lower bound is the index of left most item in a array, the upper bound is the index of the right most item in an array. A more detailed explanation can be found on the <a href=\"https:\/\/learnlearn.uk\/alevelcs\/array-lower-upper-bounds-slicing\/\">Upper\/Lower Bounds\/Slicing<\/a> page.<\/p>\n<p><strong>Slicing<\/strong><\/p>\n<p>Extracting a portion of an array using start and end indexing to determine the bounds of the extraction. In Python this works in a similar way to string slicing. More information can be found on the\u00a0<a href=\"https:\/\/learnlearn.uk\/alevelcs\/array-lower-upper-bounds-slicing\/\">Upper\/Lower Bounds\/Slicing<\/a> page.<\/p>\n<p><strong>Extent<\/strong><\/p>\n<p>The number of elements in a particular dimension. In single dimensional array it is the number of items in the array.<\/p>\n<p><strong>Append \/ Insert \/ Push<\/strong><\/p>\n<p>These are terms for the various ways in which you can add to an array or list. These are implemented different depending on the language that you are programming language.<\/p>\n\n<\/div><h2 class=\"tabtitle\">Pseudocode<\/h2>\n<div class=\"tabcontent\">\n\n<h3>CIE Array Pseudocode<\/h3>\n\n<\/div><h2 class=\"tabtitle\">Python<\/h2>\n<div class=\"tabcontent\">\n\n<h3>Python List Common Features<\/h3>\n<p>Create lists<\/p>\n<p>&nbsp;<\/p>\n<p>Appending to lists<\/p>\n<p>Removing items from lists<\/p>\n<p>Combining lists<\/p>\n<p>Deleting items<\/p>\n<p>Finding items in lists<\/p>\n<p>Traversing lists<\/p>\n<\/div><\/div>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>What are 1 dimensional arrays and what are they used for? 1 dimensional arrays are a form of compound data type that are used to store a list of items in order.\u00a0Sometimes the ordering of items may not be important (such as a shopping list) but sometimes it can be crucial (Names of runners collected&hellip;&nbsp;<a href=\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/\" class=\"\" rel=\"bookmark\">Read More &raquo;<span class=\"screen-reader-text\">1 Dimensional Arrays<\/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>1 Dimensional Arrays - 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\/1-dimensional-arrays\/\" \/>\n<meta property=\"og:locale\" content=\"en_GB\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"1 Dimensional Arrays - A Level Computer Science\" \/>\n<meta property=\"og:description\" content=\"What are 1 dimensional arrays and what are they used for? 1 dimensional arrays are a form of compound data type that are used to store a list of items in order.\u00a0Sometimes the ordering of items may not be important (such as a shopping list) but sometimes it can be crucial (Names of runners collected&hellip;&nbsp;Read More &raquo;1 Dimensional Arrays\" \/>\n<meta property=\"og:url\" content=\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/\" \/>\n<meta property=\"og:site_name\" content=\"A Level Computer Science\" \/>\n<meta property=\"article:modified_time\" content=\"2020-05-27T07:36:49+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=\"3 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebPage\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/\",\"url\":\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/\",\"name\":\"1 Dimensional Arrays - A Level Computer Science\",\"isPartOf\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/#website\"},\"datePublished\":\"2020-05-27T07:25:57+00:00\",\"dateModified\":\"2020-05-27T07:36:49+00:00\",\"breadcrumb\":{\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/#breadcrumb\"},\"inLanguage\":\"en-GB\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"A Level Computer Science Home\",\"item\":\"https:\/\/learnlearn.uk\/alevelcs\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"1 Dimensional Arrays\"}]},{\"@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":"1 Dimensional Arrays - 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\/1-dimensional-arrays\/","og_locale":"en_GB","og_type":"article","og_title":"1 Dimensional Arrays - A Level Computer Science","og_description":"What are 1 dimensional arrays and what are they used for? 1 dimensional arrays are a form of compound data type that are used to store a list of items in order.\u00a0Sometimes the ordering of items may not be important (such as a shopping list) but sometimes it can be crucial (Names of runners collected&hellip;&nbsp;Read More &raquo;1 Dimensional Arrays","og_url":"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/","og_site_name":"A Level Computer Science","article_modified_time":"2020-05-27T07:36:49+00:00","twitter_card":"summary_large_image","twitter_misc":{"Estimated reading time":"3 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebPage","@id":"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/","url":"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/","name":"1 Dimensional Arrays - A Level Computer Science","isPartOf":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/#website"},"datePublished":"2020-05-27T07:25:57+00:00","dateModified":"2020-05-27T07:36:49+00:00","breadcrumb":{"@id":"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/#breadcrumb"},"inLanguage":"en-GB","potentialAction":[{"@type":"ReadAction","target":["https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/learnlearn.uk\/alevelcs\/1-dimensional-arrays\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"A Level Computer Science Home","item":"https:\/\/learnlearn.uk\/alevelcs\/"},{"@type":"ListItem","position":2,"name":"1 Dimensional Arrays"}]},{"@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":"What are 1 dimensional arrays and what are they used for? 1 dimensional arrays are a form of compound data type that are used to store a list of items in order.\u00a0Sometimes the ordering of items may not be important (such as a shopping list) but sometimes it can be crucial (Names of runners collected&hellip;&nbsp;Read&hellip;","_links":{"self":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/669"}],"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=669"}],"version-history":[{"count":3,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/669\/revisions"}],"predecessor-version":[{"id":672,"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/pages\/669\/revisions\/672"}],"wp:attachment":[{"href":"https:\/\/learnlearn.uk\/alevelcs\/wp-json\/wp\/v2\/media?parent=669"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}