[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-719599-105":59,"doc-detail-719599-en":130,"doc-similar-719599":161},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","introduction-to-linked-lists-part-15-121","Introduction to Linked Lists - Part 15-121","","Lecture notes from 15-121 (Fall 2020, Margaret Reid-Miller) introducing linked-list concepts by first reviewing ArrayLists and key runtime ideas. It covers ArrayList internal representation, generic type parameters, array creation, and how worst/best/average runtime differs, including amortized analysis for add(). The notes review ArrayList method complexities, string immutability costs when building with concatenation, and how StringBuilder improves performance. Finally, it summarizes ArrayList advantages and disadvantages relevant to choosing data structures.",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":30,"@type":76,"position":81},"https://docshare.wps.com/document/technology/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/introduction-to-linked-lists-part-15-121/719599/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/introduction-to-linked-lists-part-15-121/719599.png","ImageObject",300,407,{"name":92,"@type":93},"percent12345","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-23","2026-11-18",true,{"@type":102,"interactionType":103,"userInteractionCount":81},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"How is an ArrayList represented internally in this lecture?","Question",{"text":112,"@type":113},"It uses a partially-filled array plus an integer tracking how many elements are currently stored.","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What does amortized analysis mean for ArrayList add()?",{"text":117,"@type":113},"The worst case for a resize is expensive, but averaged over a sequence of n adds, the per-operation cost becomes amortized O(1), even though occasional expansions cost O(n).",{"name":119,"@type":110,"acceptedAnswer":120},"Why is String concatenation in a loop inefficient, and what alternative is recommended?",{"text":121,"@type":113},"Strings are immutable, so each concatenation creates a new String and copies growing amounts of data, leading to O(n^2) copying. The lecture recommends using StringBuilder for efficient append/insert-style construction.","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},719599,1795006735,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":29,"category_name":30,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":81,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":139,"language":140,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":141,"faqs":142,"seo_title":143,"seo_description":67,"update_tm":129,"read_time":144,"preview_page_count":19,"preview_urls":145},1099529851338,"https://ap-avatar.wpscdn.com/davatar_155a257f0dc6eb9ab79c44ca47cae57d","Introduction to Linked Lists  \n15-121 Fall 2020 Margaret Reid-Miller  \nAnnouncements:  \n• Exam 1: Next Thursday. Questions?  \n• I'll post problem solutions Hw3 on autolab later today  \n• No late days for Hw5 Part I & checkpoint due Monday Oct 5.  \nToday:  \n• Review ArrayLists  \n• StringBuilder  \n• Introduction to Linked Lists  \nFall 2020 15-121 (Reid-Miller) 2  \nArrayList class implementation  \n• How did we represent an ArrayList internally? A partially-filled array and an int variable for the number of elements in that array.  \n• Where did we specify the type of the array? A type parameter E specified in the class header  \npublic class ArrayList\u003CE>  \n• Does the parameter have to be name E?  \n• No, you could use any name such as T, anytype  \nFall 2020 15-121 (Reid-Miller) 3  \nArrayList implementation review  \n• Does the constructor header include the type parameter?  \nNo  \n• How did we create the array?  \n(E[]) new Object[1];  \n• Where do we use the type parameter E?  \nMethod parameters, return types, local variables; Whenever we refer to an object in the array.  \nFall 2020 15-121 (Reid-Miller) 4  \nRuntime variations  \nFor a single operation:  \n• Worst: The longest runtime for any input of size n.  \n• Best: The shortest runtime for some input of size n.  \nNote: Not n=1 but for arbitrarily large n!  \n• Average: The runtime averaged over all distinct inputs of size n. (Assumes all input equally likely.)  \nFor a sequence of operations:  \n• Amortize worst: The average runtime per operation of a worst-case sequence of n operations.  \nFall 2020 15-121 (Reid-Miller) 5  \nArrayList add()  \n• What is the worst case running time for n calls to an ArrayList add(obj)?  O ( n ). Why?  \n• The array is full when we have  \n1, 2, 4, 8, 16, 32,…elements.  \n• After adding 17 elements, we will have copied  \n1 + 2 + 4 + 8 + 16 = 31 elements to larger arrays.  \n• After adding 33 elements, we will have copied  \n1 + 2 + 4 + 8 + 16 +32 = 63 elements to larger arrays.  \n• After adding n elements, we will have copied O(n) elements to larger arrays.  \nHence, add(obj ) is amortized O(1) time.  \nFall 2020 15-121 (Reid-Miller) 6  \nArrayList complexity  \njava.util .ArrayList\u003CE>  \nint size()  \nE get( int index)  \nE set( int index, E obj )  \nboolean add(E obj )  \nvoid add( int index, E obj ) E remove( int index)  \nboolean remove(Object obj ) boolean contains(Object obj ) int indexOf(Object obj )  \nWorst Average  Best O(1)  \nO(1)  \nO(1)  \nO (1)*  \nO(n) O(n) O(1)*  \nO (n) O(n) O(1) O (n)  \nO(n) O(n) O(1)  \nO (n) O(n) O(1)  \n*amortized  \nFall 2020 15-121 (Reid-Miller) 7  \nStrings are immutable.  \nWhat does the second statement do? String str = \"array\"; str = str + \" s\";  \nCreates a new String object containing \"arrays\" and assigns it to str.  \nString reverse = \"\";  \nfor ( int j = str.length()-1; j >= 0; j--)  \nreverse += str.charAt(j); How many Strings objects does the above make?  \nstr.length()+1 new strings.  \nHow many characters are copied?  \n1 + 2 + 3 + 4 +   + (n-1) = n*(n-1)/2 = O (n2 )  \nFall 2020 15-121 (Reid-Miller) 8  \nFor building up long Strings use a StringBuilder.  \nStringBuilder objects can append, insert, delete, replace,…character data.  \nFor example, in the MyArrayList\u003CE> class: public String toString() {  \nStringBuilder result = new StringBuilder ( \"[\" ); for ( int i = 0; i \u003C size-1; i++) {  \nresult .append (values[i] + \", \" );}  \nresult .append (values[size-1] + \"]\" );  \nreturn result .toString();}  \nNeed toString to  \nreturn a string. Why?  \nFall 2020 15-121 (Reid-Miller) 9  \nArrayLists  \n• Advantages:  \n• Time to access/set element 0 is the same as element 9000, referred to as “random access.”  \n• Space efficient.  \n• Disadvantages:  \n• Need to shift data to insert or delete values.  \n• Fixed size. Need to copy and expand the array to store more values.  \n• All data in the array must be store sequentially in memory. It can be hard to find a really big piece of contiguous memory.  \nFall 2020 15-121 (Reid-Miller) 10","cbCaiqOHO4CtI1R8","https://ap.wps.com/l/cbCaiqOHO4CtI1R8","pdf",336963,23,"English","# Introduction to Linked Lists\n## ArrayList internal representation and generics\n## Runtime variations: worst/best/average and amortized\n## ArrayList add() complexity and table of operations\n## String immutability and StringBuilder for efficiency\n## ArrayList advantages and disadvantages","[{\"question\":\"How is an ArrayList represented internally in this lecture?\",\"answer\":\"It uses a partially-filled array plus an integer tracking how many elements are currently stored.\"},{\"question\":\"What does amortized analysis mean for ArrayList add()?\",\"answer\":\"The worst case for a resize is expensive, but averaged over a sequence of n adds, the per-operation cost becomes amortized O(1), even though occasional expansions cost O(n).\"},{\"question\":\"Why is String concatenation in a loop inefficient, and what alternative is recommended?\",\"answer\":\"Strings are immutable, so each concatenation creates a new String and copies growing amounts of data, leading to O(n^2) copying. The lecture recommends using StringBuilder for efficient append/insert-style construction.\"}]","Introduction to Linked Lists - Part 15-121 | PDF",58,[146,150,153,157],{"page_no":8,"url":147,"width":148,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/34940d67f4547a21e7b8786fb6a40c30.webp",983,736,{"page_no":14,"url":151,"width":152,"height":149},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/f946bc670dd7c37c6dce89fb994258a5.webp",982,{"page_no":81,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/0002a3f5d4604998916aea2e11ddc5c4.webp",981,735,{"page_no":19,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/5b6ca561959c99f3dc65a5200c5d0fb3.webp",980,734,{"list":162,"token":66},[163,169,175,182,189,196,203,210,217,224],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":24,"category_name":30,"create_tm":168},685694,"Implementing an ArrayList - Part 1 - Homework/Exam Announcements","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000179430/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=IPWImQ5zM4Lafo4MdIj3KmYgZzI%3D","implementing-an-arraylist-part-1-homeworkexam-announcements",1794016774,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":29,"category_name":30,"create_tm":174},685799,"ARRAY LISTS - Lecture 17 - CS302 Introduction to Programming","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000212652/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=2QpE9A8Xl1yxlfEXxCamMbk6hQo%3D","array-lists-lecture-17-cs302-introduction-to-programming",1794018682,{"doc_id":176,"doc_title":177,"file_type":137,"home_preview_img_url":178,"slug":179,"view_count":180,"category_name":30,"create_tm":181},115355,"Claude AI Bible - The Complete Guide to Mastering Claude, Claude Code, Claude Cowork, MCP, AI Agents, Automation & Advanced Prompting","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229831893665/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=513MX3iZEIUYd%2FwsaS9ljkxIcJM%3D","claude-ai-bible-the-complete-guide-to-mastering-claude-claude-code-claude-cowork-mcp-ai-agents-automation-advanced-prompting",913,1785472614,{"doc_id":183,"doc_title":184,"file_type":137,"home_preview_img_url":185,"slug":186,"view_count":187,"category_name":30,"create_tm":188},185,"XNX Universal Transmitter Installation Manual (Complete Guide) [Honeywell Official]","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229693710157/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=pJpIYXg1%2F6x%2BXftSyI0UEXvwIE8%3D","xnx-universal-transmitter-installation-manual",854,1776135954,{"doc_id":190,"doc_title":191,"file_type":137,"home_preview_img_url":192,"slug":193,"view_count":194,"category_name":30,"create_tm":195},299143,"THE CANDLESTICK TRADING BIBLE - Trading Guide","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229905832418/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=XgFYX9V73Ts5F4yUTGPgy0hGn1w%3D","the-candlestick-trading-bible-trading-guide",804,1789767270,{"doc_id":197,"doc_title":198,"file_type":137,"home_preview_img_url":199,"slug":200,"view_count":201,"category_name":30,"create_tm":202},176,"Free Fire Proxy Server","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229693709822/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=1UO1CbRj1xzudixe2Bm%2FLfWbZvs%3D","free-fire-proxy-server",565,1776135932,{"doc_id":204,"doc_title":205,"file_type":137,"home_preview_img_url":206,"slug":207,"view_count":208,"category_name":30,"create_tm":209},129220,"Operations and Supply Chain Management - Eleventh Edition - Dedicated to students and faculty","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229840674154/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=85%2BCbSzXSUp49ZkftmeQ1%2Brt5A4%3D","operations-and-supply-chain-management-eleventh-edition-dedicated-to-students-and-faculty",498,1786012506,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":215,"category_name":30,"create_tm":216},8566,"Trik Ngonten TikTok dari 0 Sampai FYP","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229696842324/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=uIsjoo2EkYwZlGhIZfJQpS0MPUg%3D","tiktok-content-tricks-from-0-to-fyp",489,1776338393,{"doc_id":218,"doc_title":219,"file_type":137,"home_preview_img_url":220,"slug":221,"view_count":222,"category_name":30,"create_tm":223},387603,"Building Applications with AI Agents - Multiagent Systems - Designing and Implementing","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229916172328/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=XDvsSRIRgiM8SLFvqmHBm4%2BQWg0%3D","building-applications-with-ai-agents-multiagent-systems-designing-and-implementing",454,1790287169,{"doc_id":225,"doc_title":226,"file_type":137,"home_preview_img_url":227,"slug":228,"view_count":229,"category_name":30,"create_tm":230},14249,"EW 101: A First Course in Electronic Warfare","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229699258216/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796111519&Signature=j3ZRL0qYFdzYXbVGFU%2F%2BQM8xV2Q%3D","ew-101-a-first-course-in-electronic-warfare",438,1776558348]