[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"doc-seo-732882-105":3,"detail-sidebar-cat-0-en-105":80,"doc-detail-732882-en":130,"doc-similar-732882":161},{"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","linked-lists-in-mips-mips-implementation-recursive-functions-isa-and-x86-vs-mips-comparison","Linked Lists in MIPS - MIPS Implementation, Recursive Functions, ISA and x86 vs MIPS Comparison","","Linked Lists in MIPS explains how singly linked lists are represented in memory as 8-byte nodes, with 4 bytes for integer data and 4 bytes for the next-node pointer, including how to set next pointers and iterate through nodes using MIPS code. It then covers recursive functions with base-case translation and stack preservation considerations. Finally, it introduces ISA as the hardware-software abstraction layer, compares RISC and CISC history, and contrasts x86 (CISC) registers and addressing modes with MIPS (RISC) fixed addressing and instruction formats.",{"@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/exam/","Exam",3,{"item":32,"name":10,"@type":21,"position":33},"https://docshare.wps.com/document/linked-lists-in-mips-mips-implementation-recursive-functions-isa-and-x86-vs-mips-comparison/732882/",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/linked-lists-in-mips-mips-implementation-recursive-functions-isa-and-x86-vs-mips-comparison/732882.png","ImageObject",300,407,{"name":42,"@type":43},"awa","Person",{"url":19,"name":45,"@type":46},"DocShare","Organization","application/pdf","2026-11-30","2026-11-22",true,{"@type":52,"interactionType":53,"userInteractionCount":30},"InteractionCounter",{"@type":54},"ViewAction",{"@type":56,"mainEntity":57},"FAQPage",[58,64,68],{"name":59,"@type":60,"acceptedAnswer":61},"How is a singly linked list node represented in MIPS memory?","Question",{"text":62,"@type":63},"Each node uses 8 bytes: the first 4 bytes store the int data, and the next 4 bytes store a pointer to the next node. The last node’s next pointer is NULL (zero).","Answer",{"name":65,"@type":60,"acceptedAnswer":66},"How do you traverse and print elements of a linked list in MIPS?",{"text":67,"@type":63},"Load head into a register, loop while it is not zero, load head->data, call print, then advance head to head->next using the pointer stored at offset 4($t0).",{"name":69,"@type":60,"acceptedAnswer":70},"What does the ISA provide and why is it important?",{"text":71,"@type":63},"The ISA is an abstraction layer between hardware and software, so software does not need to know processor implementation details. Processors implementing the same ISA appear equivalent, enabling innovation without rewriting software.","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},732882,1795382683,{"code":4,"msg":81,"data":82},"success",[83,87,91,94,99,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":29,"show_sort_weight":92,"slug":93},70,"exam",{"id":95,"doc_module":4,"doc_module_name":25,"category_name":96,"show_sort_weight":97,"slug":98},5,"Comic",60,"comic",{"id":100,"doc_module":4,"doc_module_name":25,"category_name":101,"show_sort_weight":102,"slug":103},6,"Technology",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":95,"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":33,"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":30,"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":112,"preview_page_count":33,"preview_urls":144},3985747858093,"https://ap-avatar.wpscdn.com/davatar_3d24733baf745e90a7e4bdd5f77d97b2","Linked Lists in MIPS  \n􀂃 Let’s see how singly linked lists are implemented in MIPS  \n— on MP2, we have a special type of doubly linked list  \n1000 1008 1016 1024  \n\n| 3 |  | 2 |  | 1 |  |\n| --- | --- | --- | --- | --- | --- |\n\n􀂃 Each node consists of 8 bytes:  \n— the first 4 bytes contain the int data  \n— the next 4 bytes contain a pointer to the next node in the list  \n— the last node’s next pointer is NULL (zero)  \n􀂃 Suppose $a0 points to the first node in the list ($a0 = 1000) C/C++ MIPS  \nt0 = a0->data lw $t0, 0($a0)  \nt1 = a0->next lw $t1, 4($a0)  \nSetting the next pointers  \n􀂃 Suppose we want the links to point as follows:  \n1000 1008 1016  \n| 3 |  | 2\u003Cbr>| NULL | 1 |  |\n| --- | --- | --- | --- | --- | --- |\n\n1024  \n􀂃 Again, suppose $a0 points to the first node in the list ($a0 = 1000)  \naddi $t1, $a0, 16  \naddi $t2, $a0, 8  \nsw $t1, 4($a0)  \nsw $t2, 4($t1)  \nsw $0, 4($t2)  \nPrinting the elements of a linked list  \n􀂃 Translate the following code into MIPS  \n// head points to the first node in the list while(head != NULL) {  \nprint(head->data);  \nhead = head->next;  \n}  \nloop: \\# assume $t0 = head (WARNING: errors!!) beq $t0, $0, done  \nlw $a0, 0($t0)  \njal print  \nlw $t0, 4($t0)  \nj loop  \ndone:  \nRecursive Functions  \n􀂃 Recall that recursive functions have one or more base-cases, and one or more recursive calls. Example:  \nint length(node *head) {  \nif(head == NULL) return 0;  \nreturn 1 + length(head->next);  \n}  \n􀂃 Useful tip: Translate the base case first (rarely needs the stack)  \nlength: \\# $a0 = head  \nbne $a0, $0, rec_case  \nli $v0, 0 \\# return-value = NULL = 0  \njr $ra  \nrec_case: ...  \n􀂃 Let’s examine the recursive step more carefully:  \nreturn 1 + length(head->next);  \n􀂃 Useful tip: Apart from $ra, what else must be preserved across the function call?  \n— Here: nothing  \nrec case:  \naddi $sp, $sp, -4 \\# save space for $ra  \nsw $ra, 0($sp)  \nlw $a0, 4($a0)  \njal length \\# recursive call addi $v0, $v0, 1  \nlw $ra, 0($sp) addi $sp, $sp, 4  \nInstruction Set Architecture (ISA)  \n􀂃 The ISA is an abstraction layer between hardware and software  \n—Software doesn’t need to know how the processor is implemented  \n—Processors that implement the same ISA appears equivalent  \nSoftware  \nISA  \nProc \\#1  \nProc \\#2  \n􀂃 An ISA enables processor innovation without changing software  \n—This is how Intel has made billions of dollars  \n􀂃 Before ISAs, software was re-written/re-compiled for each new machine  \nISA history: RISC vs. CISC  \n􀂃 1964: IBM System/360, the first computer family  \n— IBM wanted to sell a range of machines that ran the same software  \n􀂃 1960’s, 1970’s: Complex Instruction Set Computer (CISC) era  \n— Much assembly programming, compiler technology immature  \n— Hard to optimize, guarantee correctness, teach  \n􀂃 1980’s: Reduced Instruction Set Computer (RISC) era  \n— Most programming in high-level languages, mature compilers  \n— Simpler, cleaner ISA’s facilitated pipelining , high clock frequencies  \n􀂃 1990’s: Post-RISC era  \n— ISA compatibility outweighs any RISC advantage in general purpose  \n— CISC and RISC chips use same techniques (pipelining, superscalar, ..)  \n— Embedded processors prefer RISC for lower power, cost  \n􀂃 2000’s: Multi-core era  \nComparing x86 and MIPS  \n􀂃 x86 is a typical CISC ISA, MIPS is a typical RISC ISA  \n􀂃 Much more is similar than different:  \n— Both use registers and have byte-addressable memories  \n— Same basic types of instructions (arithmetic, branches, memory)  \n􀂃 A few of the differences:  \n— Fewer registers: 8 (vs. 32 for MIPS)  \n— 2-register instruction formats (vs. 3-register format for MIPS)  \n—Additional, complex addressing modes  \n—Variable-length instruction encoding (vs. fixed 32-bit length for MIPS)  \nx86 Registers  \n􀂃 Few, and special purpose  \n— 8 integer registers  \n— two used only for stack  \n— not all instructions can use all registers  \n􀂃 Little room for temporary values  \n— x86 uses “two-address code”  \n— op x, y \\# y = y op x  \n􀂃 Rarely can the compiler fit every","cbCaiskczMgik0Qn","https://ap.wps.com/l/cbCaiskczMgik0Qn","pdf",56452,12,"English","# Linked Lists in MIPS\n## Node structure and memory layout\n## Setting next pointers\n## Printing linked list elements\n# Recursive Functions\n## Base case translation\n## Recursive step and stack usage\n# ISA Overview\n## RISC vs CISC history\n## Comparing x86 and MIPS\n## Registers and addressing modes","[{\"question\":\"How is a singly linked list node represented in MIPS memory?\",\"answer\":\"Each node uses 8 bytes: the first 4 bytes store the int data, and the next 4 bytes store a pointer to the next node. The last node’s next pointer is NULL (zero).\"},{\"question\":\"How do you traverse and print elements of a linked list in MIPS?\",\"answer\":\"Load head into a register, loop while it is not zero, load head-\\u003edata, call print, then advance head to head-\\u003enext using the pointer stored at offset 4($t0).\"},{\"question\":\"What does the ISA provide and why is it important?\",\"answer\":\"The ISA is an abstraction layer between hardware and software, so software does not need to know processor implementation details. Processors implementing the same ISA appear equivalent, enabling innovation without rewriting software.\"}]","Linked Lists in MIPS - MIPS Implementation, Recursive Functions, ISA and x86 vs MIPS Comparison | PDF",[145,149,153,157],{"page_no":22,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/7511d7909113453b8b6acc2c9c590e48.webp",983,759,{"page_no":26,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/406f4887732366a808cef365f080f614.webp",982,758,{"page_no":30,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/9618a1d1dd7cf8948192acc1b0a6ec21.webp",981,757,{"page_no":33,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-22/8207e3435596f919edbb6dc8b3bcd7c5.webp",980,756,{"list":162,"token":11},[163,169,175,181,187,194,201,207,213,219],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":123,"category_name":29,"create_tm":168},685729,"Chapter 14 Linked Lists - Chapter 14 - Operations and Implementations of Singly Linked Lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000185871/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=p9buYeN59SMyZtRYCAlGvoGZiag%3D","chapter-14-linked-lists-chapter-14-operations-and-implementations-of-singly-linked-lists",1794017196,{"doc_id":170,"doc_title":171,"file_type":137,"home_preview_img_url":172,"slug":173,"view_count":123,"category_name":29,"create_tm":174},685768,"CS 2351 Data Structures - Linked Lists","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230000198125/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=%2FvlRPUzLU6waMo%2BZfCWMzza4G%2BA%3D","cs-2351-data-structures-linked-lists",1794017950,{"doc_id":176,"doc_title":177,"file_type":137,"home_preview_img_url":178,"slug":179,"view_count":100,"category_name":29,"create_tm":180},697956,"Linked List - Lecture 23-24 - Notes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230010142265/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=DLdogkoo%2FSXJMLgckfA9FnpDB8Q%3D","linked-list-lecture-23-24-notes",1794446335,{"doc_id":182,"doc_title":183,"file_type":137,"home_preview_img_url":184,"slug":185,"view_count":110,"category_name":29,"create_tm":186},685761,"Singly-Linked List Class - Exam 1 - Review and HW5 Card Game Efficiency","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229999691124/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=a86ySFWIcQEMg99ZMS2WivLv54E%3D","singly-linked-list-class-exam-1-review-and-hw5-card-game-efficiency",1794017629,{"doc_id":188,"doc_title":189,"file_type":137,"home_preview_img_url":190,"slug":191,"view_count":192,"category_name":29,"create_tm":193},391235,"C Language Questions and Answers - Study & Interview Quick Reference","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917369724/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=13s49AcwmS8XnRS5ZYe17%2B%2FWEhM%3D","c-language-questions-and-answers-study-interview-quick-reference",17,1790350259,{"doc_id":195,"doc_title":196,"file_type":137,"home_preview_img_url":197,"slug":198,"view_count":199,"category_name":29,"create_tm":200},391408,"Genpact Interview Questions for Freshers","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229917680893/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=h%2FRPUHUZkMxmaBS4rOFJ1pyT1lQ%3D","genpact-interview-questions-for-freshers",21,1790353128,{"doc_id":202,"doc_title":203,"file_type":137,"home_preview_img_url":204,"slug":205,"view_count":22,"category_name":29,"create_tm":206},759758,"EC 8691 - Microprocessor and Microcontroller Unit-1 - The 8086 Microprocessor","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044482778/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=U7V4V1Z8hgQqT4mGrkt245X3CMI%3D","ec-8691-microprocessor-and-microcontroller-unit-1-the-8086-microprocessor",1795894369,{"doc_id":208,"doc_title":209,"file_type":137,"home_preview_img_url":210,"slug":211,"view_count":22,"category_name":29,"create_tm":212},759762,"COE 205 Lab Manual - Lab 4 - Basic Instructions and Addressing Modes","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110230044482793/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=tPqPI429B9WPHHxm2U%2FUuOrwxL0%3D","coe-205-lab-manual-lab-4-basic-instructions-and-addressing-modes",1795894376,{"doc_id":214,"doc_title":215,"file_type":137,"home_preview_img_url":216,"slug":217,"view_count":110,"category_name":29,"create_tm":218},413492,"Term 3 Week 4 2025 Newsletter","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229922016462/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=pG7UtzBnAtrBRYF4Rq%2Fa2%2BVykiM%3D","term-3-week-4-2025-newsletter",1790595009,{"doc_id":220,"doc_title":221,"file_type":137,"home_preview_img_url":222,"slug":223,"view_count":110,"category_name":29,"create_tm":224},515963,"05 October 2026 - Daily One Pager - Lead IAS","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229937451444/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796166059&Signature=DgcYc%2BfcIgiZ1Tb46LyeOCu%2BzFQ%3D","05-october-2026-daily-one-pager-lead-ias",1791323925]