[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-685721-105":3,"detail-sidebar-cat-0-en-105":81,"doc-detail-685721-en":130,"doc-similar-685721":158},{"code":4,"msg":5,"data":6},0,"ok",{"site_id":7,"language":8,"slug":9,"title":10,"keywords":11,"description":12,"schema_data":13,"social_meta":74,"head_meta":76,"extra_data":78,"updated_unix":80},105,"en","sequences-representing-sequences-by-arrays-and-linked-lists","Sequences - Representing Sequences by Arrays and Linked Lists","","Explains how sequences are represented using arrays and linked lists, contrasting linear element order with trees, graphs, and unordered tables. Introduces two access models: index-based access and relative access to successors, predecessors, or subsequences. Discusses static, bounded, unbounded, and amortized dynamic arrays, then focuses on linked lists, emphasizing flexibility for insertions and deletions, the lack of random access, and the organization of singly and doubly linked lists including invariants and pointer roles.",{"@graph":14,"@context":73},[15,34,56],{"@type":16,"itemListElement":17},"BreadcrumbList",[18,23,27,31],{"item":19,"name":20,"@type":21,"position":22},"https://docshare.wps.com","Home","ListItem",1,{"item":24,"name":25,"@type":21,"position":26},"https://docshare.wps.com/document/","Document",2,{"item":28,"name":29,"@type":21,"position":30},"https://docshare.wps.com/document/technology/","Technology",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/sequences-representing-sequences-by-arrays-and-linked-lists/685721/",4,{"url":32,"name":10,"@type":35,"image":36,"author":41,"headline":10,"publisher":44,"fileFormat":47,"inLanguage":8,"description":12,"dateModified":48,"datePublished":49,"encodingFormat":47,"isAccessibleForFree":50,"interactionStatistic":51},"DigitalDocument",{"url":37,"@type":38,"width":39,"height":40},"https://docshare.wps.com/thumbnails/sequences-representing-sequences-by-arrays-and-linked-lists/685721.png","ImageObject",300,407,{"name":42,"@type":43},"QWQ","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-18","2026-11-07",true,{"@type":52,"interactionType":53,"userInteractionCount":55},"InteractionCounter",{"@type":54},"ViewAction",5,{"@type":57,"mainEntity":58},"FAQPage",[59,65,69],{"name":60,"@type":61,"acceptedAnswer":62},"What is the abstract definition of a sequence in this chapter?","Question",{"text":63,"@type":64},"A sequence is a linear ordering of elements, where the elements s = ⟨e0,...,en−1⟩ have a fixed relative order independent of how it is represented in a computer.","Answer",{"name":66,"@type":61,"acceptedAnswer":67},"What are the two basic ways to refer to elements of a sequence?",{"text":68,"@type":64},"Elements can be accessed by specifying an index (as in arrays) or by referring to elements relative to others, such as requesting a successor, predecessor, or a subsequence between two elements.",{"name":70,"@type":61,"acceptedAnswer":71},"Why do linked lists provide more flexible updates than arrays?",{"text":72,"@type":64},"Linked lists support easier insertion and deletion of arbitrary pieces of a sequence, whereas arrays primarily rely on index-based access and face constraints when elements are added or removed.","https://schema.org",{"og:url":32,"og:type":75,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":77,"canonical":32},"index,follow",{"doc_id":79,"site_id":7},685721,1794016978,{"code":4,"msg":82,"data":83},"success",[84,88,92,96,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":85,"show_sort_weight":86,"slug":87},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":89,"show_sort_weight":90,"slug":91},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":93,"show_sort_weight":94,"slug":95},"Exam",70,"exam",{"id":55,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},"Comic",60,"comic",{"id":101,"doc_module":4,"doc_module_name":25,"category_name":29,"show_sort_weight":102,"slug":103},6,50,"technology",{"id":105,"doc_module":4,"doc_module_name":25,"category_name":106,"show_sort_weight":107,"slug":108},7,"Healthcare",40,"healthcare",{"id":110,"doc_module":4,"doc_module_name":25,"category_name":111,"show_sort_weight":112,"slug":113},8,"Research & Report",30,"research-report",{"id":115,"doc_module":4,"doc_module_name":25,"category_name":116,"show_sort_weight":117,"slug":118},9,"Religion & Spirituality",20,"religion-spirituality",{"id":117,"doc_module":4,"doc_module_name":25,"category_name":120,"show_sort_weight":117,"slug":121},"World Cup","world-cup",{"id":123,"doc_module":4,"doc_module_name":25,"category_name":124,"show_sort_weight":123,"slug":125},10,"Lifestyle","lifestyle",{"id":127,"doc_module":4,"doc_module_name":25,"category_name":128,"show_sort_weight":55,"slug":129},19,"General","general",{"code":4,"msg":82,"data":131},{"doc_id":79,"user_id":132,"nickname":42,"user_avatar":133,"doc_module":4,"category_id":101,"category_name":29,"doc_title":10,"doc_description":12,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":55,"is_deleted":4,"is_public":22,"is_downloadable":22,"audit_status":22,"page_count":139,"language":140,"language_code":8,"site_id":7,"html_lang":8,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":12,"update_tm":80,"read_time":144,"preview_page_count":30,"preview_urls":145},962094510011,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","3  \nRepresenting Sequences by Arrays and Linked Lists  \nPerhaps the world’s oldest data structures were the tablets in cuneiform script 1 used more than 5 000 years ago by custodians in Sumerian temples. These custodians kept lists of goods, and their quantities, owners, and buyers. The picture on the left shows an example. This was possibly the ﬁrst application of written language. The operations performed on such lists have remained the same – adding entries, storing them for later, searching entries and changing them, going through a list to compile summaries, etc. The Peruvian quipu [137] that you see in the picture on the right served a similar purpose in the Inca empire, using knots in colored strings arranged sequentially on a master string. It is probably easier to maintain and use data on tablets than to use knotted string, but one would not want to haul stone tablets over Andean mountain trails. It is apparent that different representations make sense for the same kind of data.  \nThe abstract notion of a sequence, list, or table is very simple and is independent of its representation in a computer. Mathematically, the only important property is that the elements of a sequence s = he0 ,..., en−1i are arranged in a linear order – in contrast to the trees and graphs discussed in Chaps. 7 and 8, or the unordered hash tables discussed in Chap. 4. There are two basic ways of referring to the elements of a sequence.  \nOne is to specify the index of an element. This is the way we usually think about arrays, where s[i] returns the i-th element of a sequence s. Our pseudocode supports static arrays. In a static data structure, the size is known in advance, and the data structure is not modiﬁable by insertions and deletions. In a bounded data structure, the maximal size is known in advance. In Sect. 3.2, we introduce dynamic or un-  \n1 The 4 600 year old tablet at the top left is a list of gifts to the high priestess of Adab (see [commons.wikimedia.org/wiki/Image:Sumerian_26th_c_Adab.jpg](commons.wikimedia.org/wiki/Image:Sumerian_26th_c_Adab.jpg)).  \n60 3 Representing Sequences by Arrays and Linked Lists  \nbounded arrays, which can grow and shrink as elements are inserted and removed. The analysis of unbounded arrays introduces the concept of amortized analysis.  \nThe second way of referring to the elements of a sequence is relative to other elements. For example, one could ask for the successor of an element e, the predecessor of an element e′, or for the subsequence he,..., e′ i of elements between e ande′. Although relative access can be simulated using array indexing, we shall see in Sect. 3.1 that a list-based representation of sequences is more ﬂexible. In particular, it becomes easier to insert or remove arbitrary pieces of a sequence.  \nMany algorithms use sequences in a quite limited way. Only the front and/or the rear of the sequence are read and modiﬁed. Sequences that are used in this restricted way are called stacks, queues, and deques. We discuss them in Sect. 3.4. In Sect. 3.5, we summarize the ﬁndings ofthe chapter.  \n3.1 Linked Lists  \nIn this section, we study the representation of sequences by linked lists. In a doubly linked list, each item points to its successor and to its predecessor. In a singly linked list, each item points to its successor. We shall see that linked lists are easily modiﬁed in many ways: we may insert or delete items or sublists, and we may concatenate lists. The drawback is that random access (the operator [·]) is not supported. We study doubly linked lists in Sect. 3.1.1, and singly linked lists in Sect. 3.1.2. Singly linked lists are more space-efﬁcient, and somewhat faster, and should therefore be preferred whenever their functionality sufﬁces. A good way to think of a linked list is to imagine a chain, where one element is written on each link. Once we get hold of one link of the chain, we can retrieve all elements.  \n3.1.1 Doubly Linked Lists  \nFigure 3.1 shows the basic building ","cbCaityZ4EkvRh9K","https://ap.wps.com/l/cbCaityZ4EkvRh9K","pdf",281987,22,"English","# Representing Sequences by Arrays and Linked Lists\n## Abstract notion of sequences and access methods\n## 3.1 Linked Lists\n### 3.1.1 Doubly Linked Lists\n### 3.1.2 Singly Linked Lists","[{\"question\":\"What is the abstract definition of a sequence in this chapter?\",\"answer\":\"A sequence is a linear ordering of elements, where the elements s = ⟨e0,...,en−1⟩ have a fixed relative order independent of how it is represented in a computer.\"},{\"question\":\"What are the two basic ways to refer to elements of a sequence?\",\"answer\":\"Elements can be accessed by specifying an index (as in arrays) or by referring to elements relative to others, such as requesting a successor, predecessor, or a subsequence between two elements.\"},{\"question\":\"Why do linked lists provide more flexible updates than arrays?\",\"answer\":\"Linked lists support easier insertion and deletion of arbitrary pieces of a sequence, whereas arrays primarily rely on index-based access and face constraints when elements are added or removed.\"}]","Sequences - Representing Sequences by Arrays and Linked Lists | PDF",55,[146,150,154],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/94e573aa8be4e6c32aa6cd2c996368d3.webp",983,1391,{"page_no":26,"url":151,"width":152,"height":153},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/b14006165ead174f0313ca0830f8dd8b.webp",982,1389,{"page_no":30,"url":155,"width":156,"height":157},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-09/e43ce28047b9dc8d4b3e362de00e6be6.webp",981,1388,{"list":159,"token":11},[160,166,172,178,184,190,196,201,207,213],{"doc_id":161,"doc_title":162,"file_type":137,"home_preview_img_url":163,"slug":164,"view_count":55,"category_name":29,"create_tm":165},685716,"Linked Lists - Introduction - Properties, Advantages, Disadvantages, and Types","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999688533/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=LNTgGD6LR1nPC2rP1hHHXkxWJdU%3D","linked-lists-introduction-properties-advantages-disadvantages-and-types",1794016969,{"doc_id":167,"doc_title":168,"file_type":137,"home_preview_img_url":169,"slug":170,"view_count":105,"category_name":29,"create_tm":171},697943,"Lecture 12 Doubly Linked Lists - (with Recursion)","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230009212198/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=SyEdnmBgFhaxiQ1PkPQx2xGiuCw%3D","lecture-12-doubly-linked-lists-with-recursion",1794446071,{"doc_id":173,"doc_title":174,"file_type":137,"home_preview_img_url":175,"slug":176,"view_count":55,"category_name":29,"create_tm":177},685726,"L6b - Linked List Variations - Lecture 6b","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185855/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=Vns08SWmt7z%2FMkp2PX3vHMrMscU%3D","l6b-linked-list-variations-lecture-6b",1794017196,{"doc_id":179,"doc_title":180,"file_type":137,"home_preview_img_url":181,"slug":182,"view_count":55,"category_name":29,"create_tm":183},685762,"Linked List - Course 13004700 Part-2","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999691129/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=%2BYSzLypcULMNSEKDg%2Fo0xUa3lAc%3D","linked-list-course-13004700-part-2",1794017631,{"doc_id":185,"doc_title":186,"file_type":137,"home_preview_img_url":187,"slug":188,"view_count":105,"category_name":29,"create_tm":189},685731,"Lecture Five - Linked List Structure","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999689386/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=sqCX2JHIDl69WwjUjgUETfXpcHg%3D","lecture-five-linked-list-structure",1794017204,{"doc_id":191,"doc_title":192,"file_type":137,"home_preview_img_url":193,"slug":194,"view_count":30,"category_name":29,"create_tm":195},732873,"Singly Linked Lists in C - Introduction and Traversal Example","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230031413508/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=XddfZ84TiPVKIo1bXI7kRGwrKm4%3D","singly-linked-lists-in-c-introduction-and-traversal-example",1795382670,{"doc_id":197,"doc_title":198,"file_type":137,"home_preview_img_url":199,"slug":200,"view_count":33,"category_name":29,"create_tm":177},685727,"Circular Linked Lists - All Operations and Complexity Analysis","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185859/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=zLR92d9S3iHKPAXQJHTjqboxSGQ%3D","circular-linked-lists-all-operations-and-complexity-analysis",{"doc_id":202,"doc_title":203,"file_type":137,"home_preview_img_url":204,"slug":205,"view_count":101,"category_name":29,"create_tm":206},685719,"Data Structures - Linked List - Unit 3","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000182441/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=qmmoKd1GgPvsJSzZLLeyN%2FlagFI%3D","data-structures-linked-list-unit-3",1794016973,{"doc_id":208,"doc_title":209,"file_type":137,"home_preview_img_url":210,"slug":211,"view_count":55,"category_name":29,"create_tm":212},685741,"ROHINI COLLEGE OF ENGINEERING & TECHNOLOGY - Linked list implementation - Singly linked lists - Core algorithms for traversal, counting, searching and insertion","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000186201/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=tt8piBYXLh2pqJYzuZNuz9pLjp0%3D","rohini-college-of-engineering-technology-linked-list-implementation-singly-linked-lists-core-algorithms-for-traversal-counting-searching-and-insertion",1794017223,{"doc_id":214,"doc_title":215,"file_type":137,"home_preview_img_url":216,"slug":217,"view_count":105,"category_name":29,"create_tm":218},685760,"CS62 Class 8 - Linked lists - Basic Data Structures","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000192614/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111339&Signature=Y3PU7EDjqg9ArcnFyONGS1%2BX%2FHU%3D","cs62-class-8-linked-lists-basic-data-structures",1794017629]