[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-719603-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-719603-en":130,"doc-similar-719603":180},{"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":73,"head_meta":75,"extra_data":77,"updated_unix":79},105,"en","cs1020-data-structures-and-algorithms-i-lecture-10-list-adt-linked-lists","CS1020 Data Structures and Algorithms I Lecture 10 - List ADT & Linked Lists","","Lecture note #10 focuses on the List ADT and multiple linked-list implementations within a CS1020 Data Structures and Algorithms I context. It motivates lists as dynamic linear collections supporting core operations such as create, test empty, query size, add at a position, remove at a position, remove all, and read items. The note compares array-based and linked-list-based implementations, introduces the ListNode concept, extends to enhanced and tailed variants, and briefly covers other forms like circular and doubly linked lists. It concludes by referencing the Java LinkedList API and summarizing key ideas.",{"@graph":14,"@context":72},[15,34,55],{"@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/cs1020-data-structures-and-algorithms-i-lecture-10-list-adt-linked-lists/719603/",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/cs1020-data-structures-and-algorithms-i-lecture-10-list-adt-linked-lists/719603.png","ImageObject",300,407,{"name":42,"@type":43},"Danger Angel","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-29","2026-11-18",true,{"@type":52,"interactionType":53,"userInteractionCount":33},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"Why use a List in data structures?","Question",{"text":62,"@type":63},"A list is a basic data collection for storing items of the same type, such as groceries or friends. It supports managing data through operations like add, remove, and query.","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"What core operations are defined in a List ADT?",{"text":67,"@type":63},"A List ADT is a dynamic linear structure with operations including creating an empty list, checking whether it is empty, getting the number of items, adding and removing items at positions, removing all items, and reading an item by position.",{"name":69,"@type":60,"acceptedAnswer":70},"How do array-based and linked-list-based implementations differ?",{"text":71,"@type":63},"The note presents two implementations of the same List ADT: an array-based approach and a linked-list-based approach. It outlines adding/removing in arrays with efficiency discussion, then introduces a linked-list approach using ListNode and concrete implementations like BasicLinkedList.","https://schema.org",{"og:url":32,"og:type":74,"og:title":10,"og:site_name":45,"og:description":12},"article",{"robots":76,"canonical":32},"index,follow",{"doc_id":78,"site_id":7},719603,1795006746,{"code":4,"msg":81,"data":82},"success",[83,87,91,95,100,104,109,114,119,122,126],{"id":22,"doc_module":4,"doc_module_name":25,"category_name":84,"show_sort_weight":85,"slug":86},"Story & Novel",90,"story-novel",{"id":26,"doc_module":4,"doc_module_name":25,"category_name":88,"show_sort_weight":89,"slug":90},"Literature",80,"literature",{"id":33,"doc_module":4,"doc_module_name":25,"category_name":92,"show_sort_weight":93,"slug":94},"Exam",70,"exam",{"id":96,"doc_module":4,"doc_module_name":25,"category_name":97,"show_sort_weight":98,"slug":99},5,"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":96,"slug":129},19,"General","general",{"code":4,"msg":81,"data":131},{"doc_id":78,"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":33,"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":79,"read_time":144,"preview_page_count":115,"preview_urls":145},962090769052,"https://ap-avatar.wpscdn.com/davatar_9964176cb1d06d4a9deccf72a44ae3dc","CS1020 Data Structures and Algorithms I Lecture Note \\#10  \nList ADT & Linked Lists  \nReferences  \nBook  \n• List ADT: Chapter 4, pages 227 to 233  \n• An array-based implementation: Chapter 4, pages 250 to 257  \n• Linked Lists: Chapter 5, pages 265 to 325  \nCS1020 website 􀃆 Resources  \n􀃆 Lectures  \n•  .[comp.nus.edu.sg/](comp.nus.edu.sg/)[ ](comp.nus.edu.sg/)cs1020/2  resources/lectures.html  \n~~  ~~[CS1020~~ ~~Lecture~~ ~~10:~~ ~~List~~ ~~ADT~~ ~~&~~ ~~Linked~~ ~~Lists]~~  ~~  \nPrograms used in this lecture  \n􀂉 For Array implementation of List:  \n􀂄 [ListInterface.java](ListInterface.java)  \n􀂄 [ListUsingArray.java](ListUsingArray.java), [TestListUsingArray.java](TestListUsingArray.java)  \n􀂉 For Linked List implementation of List:  \n􀂄 [ListNode.java](ListNode.java)  \n􀂄 [ListInterface.java](ListInterface.java) (same [ListInterface.java](ListInterface.java) as in array implementation)  \n􀂄 [BasicLinkedList.java](BasicLinkedList.java), [TestBasicLinkedList1.java](TestBasicLinkedList1.java), [TestBasicLinkedList2.java](TestBasicLinkedList2.java)  \n􀂄 [EnhancedListInterface.java](EnhancedListInterface.java)  \n􀂄 [EnhancedLinkedList.java](EnhancedLinkedList.java), [TestEnhancedLinkedList.java](TestEnhancedLinkedList.java)  \n􀂄 [TailedLinkedList.java](TailedLinkedList.java), [TestTailedLinkedList.java](TestTailedLinkedList.java)  \n~~  ~~[CS1020~~ ~~Lecture~~ ~~10:~~ ~~List~~ ~~ADT~~ ~~&~~ ~~Linked~~ ~~Lists]~~  ~~  \nOutline  \n1. Use of a List (Motivation)  \n􀂃 List ADT  \n2. List ADT Implementation via Array  \n􀂃 Adding and removing elements in an array  \n􀂃 Time and space efficiency  \n3. List ADT Implementation via Linked Lists  \n􀂃 Linked list approach  \n􀂃 ListNode class: forming a linked list with ListNode  \n􀂃 BasicLinkedList  \n4. More Linked Lists  \n􀂃 EnhancedLinkedList, TailedLinkedList  \n5. Other Variants  \n􀂃 CircularLinkedList, DoublyLinkedList  \n6. Java API: LinkedList class  \n7. Summary  \n~~  ~~[CS1020~~ ~~Lecture~~ ~~10:~~ ~~List~~ ~~ADT~~ ~~&~~ ~~Linked~~ ~~Lists]~~  ~~  \n1  \nUse of a List  \nMotivation  \n1. Use of a List   \nMotivation   \n􀂉 List is one of the most basic types of data collection  \n􀂃 For example, list of groceries, list of modules, list of friends, etc.  \n􀂃 In general, we keep items of the same type (class) in one list  \n􀂉 Typical Operations on a data collection  \n􀂃 Add data  \n􀂃 Remove data  \n􀂃 Query data  \n􀂃 The details of the operations vary from application to application. The overall theme is the management of data  \n[CS1020 Lecture 10: List ADT & Linked Lists]  \n1. Use of a List   \nADT of a List (1/3)  \n􀂉 A list ADT is a dynamic linear data structure  \n􀂃 A collection of data items, accessible one after another  \nstarting from the beginning (head) of the list  \n􀂉 Examples of List ADT operations:  \n􀂃 Create an empty list  \nYou will learn nonlinear data structures such as trees and graphs in CS2010 .  \n􀂃 Determine whether a list is empty  \n􀂃 Determine number of items in the list  \n􀂃 Add an item at a given position  \n􀂃 Remove an item at a position  \n􀂃 Remove all items  \n􀂃 Read an item from the list at a position  \n􀂉 The next slide on the basic list interface does not have all the above operations…we will slowly build up these operations in list beyond the basic list.  \n~~  ~~[CS1020~~ ~~Lecture~~ ~~10:~~ ~~List~~ ~~ADT~~ ~~&~~ ~~Linked~~ ~~Lists]~~  ~~  \n1. Use of a List   \nADT of a List (2/3)  \n\n| import java.util .*; | [ListInterface.java](ListInterface.java) |  |\n| --- | --- | --- |\n| public interface ListInterface \u003CE> {\u003Cbr>public boolean isEmpty();\u003Cbr>public int size();\u003Cbr>public E getFirst() throws NoSuchElementException;\u003Cbr>public boolean contains(E item);\u003Cbr>public void addFirst(E item);\u003Cbr>public E removeFirst()\u003Cbr>throws NoSuchElementException;\u003Cbr>public void print();\u003Cbr>} |  |  |\n\n􀂉 The ListInterface above defines the operations (methods) we would like to have in a List ADT  \n􀂉 The operations shown here are just a small sample. An actual List ADT usually contains more operations.  \n~~  ~~[CS1020~~ ~~Lecture~~","cbCaibFcKqaToc7w","https://ap.wps.com/l/cbCaibFcKqaToc7w","pdf",576226,82,"English","# Use of a List\n## Motivation\n# List ADT Implementation via Array\n## Adding and removing elements in an array\n## Time and space efficiency\n# List ADT Implementation via Linked Lists\n## Linked list approach\n## ListNode class and forming a linked list\n## BasicLinkedList\n# More Linked Lists\n## EnhancedLinkedList and TailedLinkedList\n# Other Variants\n## CircularLinkedList and DoublyLinkedList\n# Java API: LinkedList class\n# Summary","[{\"question\":\"Why use a List in data structures?\",\"answer\":\"A list is a basic data collection for storing items of the same type, such as groceries or friends. It supports managing data through operations like add, remove, and query.\"},{\"question\":\"What core operations are defined in a List ADT?\",\"answer\":\"A List ADT is a dynamic linear structure with operations including creating an empty list, checking whether it is empty, getting the number of items, adding and removing items at positions, removing all items, and reading an item by position.\"},{\"question\":\"How do array-based and linked-list-based implementations differ?\",\"answer\":\"The note presents two implementations of the same List ADT: an array-based approach and a linked-list-based approach. It outlines adding/removing in arrays with efficiency discussion, then introduces a linked-list approach using ListNode and concrete implementations like BasicLinkedList.\"}]","CS1020 Data Structures and Algorithms I Lecture 10 - List ADT & Linked Lists | PDF",207,[146,150,153,157,161,165,168,172,176],{"page_no":22,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/8d8a847ec08fb0c705ab94f95d3e14c6.webp",983,736,{"page_no":26,"url":151,"width":152,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/2630e1c586b6c8f93ce8cd4c2ffc148a.webp",982,{"page_no":30,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/166ca91838acdd38731cbf164e160a7d.webp",981,735,{"page_no":33,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/369541ff50a94962654869229b18e541.webp",980,734,{"page_no":96,"url":162,"width":163,"height":164},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/0aa5bd50db5670ea47681d71f33c27c4.webp",979,733,{"page_no":101,"url":166,"width":167,"height":164},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/a273326aad05b430a12e07587689ee0c.webp",978,{"page_no":105,"url":169,"width":170,"height":171},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/f5db25e907c06aecd9441d99e73dbc2e.webp",977,732,{"page_no":110,"url":173,"width":174,"height":175},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/f7f89719e4050dcda49f887f2ca30d4f.webp",976,731,{"page_no":115,"url":177,"width":178,"height":179},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/82ed6776c6678417cef5e01c1eb3ec79.webp",975,730,{"list":181,"token":11},[182,188,194,200,206,212,218,223,229,235],{"doc_id":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":96,"category_name":29,"create_tm":187},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=1796111459&Signature=7%2FqnZH1%2B%2BNwLAWRNo2TQsLft5pg%3D","l6b-linked-list-variations-lecture-6b",1794017196,{"doc_id":189,"doc_title":190,"file_type":137,"home_preview_img_url":191,"slug":192,"view_count":33,"category_name":29,"create_tm":193},685692,"ArrayList vs LinkedList - For Introduction to Java Programming - Performance Comparison","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000179353/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111459&Signature=BzfqxZ27ukbPFD9dxmQH6CU6AfU%3D","arraylist-vs-linkedlist-for-introduction-to-java-programming-performance-comparison",1794016770,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":101,"category_name":29,"create_tm":199},697916,"Java Collections - List Set Map","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010130865/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111459&Signature=p5V%2BelwuLX68744jpBHkPf%2Fc01g%3D","java-collections-list-set-map",1794445817,{"doc_id":201,"doc_title":202,"file_type":137,"home_preview_img_url":203,"slug":204,"view_count":101,"category_name":29,"create_tm":205},685666,"Lecture 6 - List ADT","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000175827/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111459&Signature=0nXYcas4uaCT8E0D7yYglwoGRRA%3D","lecture-6-list-adt",1794016534,{"doc_id":207,"doc_title":208,"file_type":137,"home_preview_img_url":209,"slug":210,"view_count":105,"category_name":29,"create_tm":211},685695,"High Performance Lists in Java - JavaZone 2015 - Motivation: A Real World Example","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000179383/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111459&Signature=Js5ye1Pjr3QMogzbxC0e6T1ZtYg%3D","high-performance-lists-in-java-javazone-2015-motivation-a-real-world-example",1794016775,{"doc_id":213,"doc_title":214,"file_type":137,"home_preview_img_url":215,"slug":216,"view_count":96,"category_name":29,"create_tm":217},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=1796111459&Signature=Jv8M4DJVhP08bdrZ%2FI5Z5U%2BpHqM%3D","linked-list-course-13004700-part-2",1794017631,{"doc_id":219,"doc_title":220,"file_type":137,"home_preview_img_url":221,"slug":222,"view_count":33,"category_name":29,"create_tm":187},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=1796111459&Signature=Ddkzdm9VUwtIdrqkEDtE%2BYBkZlU%3D","circular-linked-lists-all-operations-and-complexity-analysis",{"doc_id":224,"doc_title":225,"file_type":137,"home_preview_img_url":226,"slug":227,"view_count":96,"category_name":29,"create_tm":228},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=1796111459&Signature=m%2B%2BfVXFVUs63qBBBXGSGLdnJETU%3D","linked-lists-introduction-properties-advantages-disadvantages-and-types",1794016969,{"doc_id":230,"doc_title":231,"file_type":137,"home_preview_img_url":232,"slug":233,"view_count":96,"category_name":29,"create_tm":234},697921,"Java Collections Framework - Interfaces, Implementations, and Core Algorithms","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010131024/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111459&Signature=%2F2376xwKDRM9gfHBt7IC7FcKtb0%3D","java-collections-framework-interfaces-implementations-and-core-algorithms",1794445828,{"doc_id":236,"doc_title":237,"file_type":137,"home_preview_img_url":238,"slug":239,"view_count":33,"category_name":29,"create_tm":240},685691,"ArrayList and Iterator in Java - Java List Iteration Methods and Examples","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000179348/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111459&Signature=0YXsbhHYuW6ZCvBjGyeJRPxQ5nM%3D","arraylist-and-iterator-in-java-java-list-iteration-methods-and-examples",1794016767]