[{"data":1,"prerenderedAt":314},["ShallowReactive",2],{"term-l\u002Flinked-list":3,"related-l\u002Flinked-list":300},{"id":4,"title":5,"acronym":6,"body":7,"category":281,"description":282,"difficulty":283,"extension":284,"letter":285,"meta":286,"navigation":130,"path":287,"related":288,"seo":294,"sitemap":295,"stem":298,"subcategory":6,"__hash__":299},"terms\u002Fterms\u002Fl\u002Flinked-list.md","Linked List",null,{"type":8,"value":9,"toc":275},"minimark",[10,15,19,23,26,30,264,268,271],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"A linked list is like a treasure hunt where each clue tells you where the next clue is. Each item (node) holds a value AND a pointer to the next item. Unlike arrays, items are not side-by-side in memory — they are scattered around, connected by pointers. Great for inserting items in the middle, terrible for random access.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"A linked list is a linear data structure where each node contains data and a reference (pointer) to the next node. Unlike arrays, nodes are not stored contiguously in memory. Linked lists provide O(1) insertion and deletion at the head, but O(n) access by index. Doubly linked lists also store a pointer to the previous node, enabling traversal in both directions.",[11,27,29],{"id":28},"show-me-the-code","Show Me The Code",[31,32,37],"pre",{"className":33,"code":34,"language":35,"meta":36,"style":36},"language-javascript shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","\u002F\u002F Implementing a simple linked list in JS:\nclass Node {\n  constructor(value) {\n    this.value = value;\n    this.next = null;\n  }\n}\n\nclass LinkedList {\n  constructor() { this.head = null; }\n  prepend(value) {\n    const node = new Node(value);\n    node.next = this.head;\n    this.head = node; \u002F\u002F O(1)\n  }\n}\n\n\u002F\u002F head → [1] → [2] → [3] → null\n","javascript","",[38,39,40,49,64,82,100,113,119,125,132,142,167,182,207,226,243,248,253,258],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F Implementing a simple linked list in JS:\n",[41,50,52,56,60],{"class":43,"line":51},2,[41,53,55],{"class":54},"spNyl","class",[41,57,59],{"class":58},"sBMFI"," Node",[41,61,63],{"class":62},"sMK4o"," {\n",[41,65,67,70,73,77,80],{"class":43,"line":66},3,[41,68,69],{"class":54},"  constructor",[41,71,72],{"class":62},"(",[41,74,76],{"class":75},"sHdIc","value",[41,78,79],{"class":62},")",[41,81,63],{"class":62},[41,83,85,88,91,94,97],{"class":43,"line":84},4,[41,86,87],{"class":62},"    this.",[41,89,76],{"class":90},"sTEyZ",[41,92,93],{"class":62}," =",[41,95,96],{"class":90}," value",[41,98,99],{"class":62},";\n",[41,101,103,105,108,110],{"class":43,"line":102},5,[41,104,87],{"class":62},[41,106,107],{"class":90},"next",[41,109,93],{"class":62},[41,111,112],{"class":62}," null;\n",[41,114,116],{"class":43,"line":115},6,[41,117,118],{"class":62},"  }\n",[41,120,122],{"class":43,"line":121},7,[41,123,124],{"class":62},"}\n",[41,126,128],{"class":43,"line":127},8,[41,129,131],{"emptyLinePlaceholder":130},true,"\n",[41,133,135,137,140],{"class":43,"line":134},9,[41,136,55],{"class":54},[41,138,139],{"class":58}," LinkedList",[41,141,63],{"class":62},[41,143,145,147,150,153,156,159,161,164],{"class":43,"line":144},10,[41,146,69],{"class":54},[41,148,149],{"class":62},"()",[41,151,152],{"class":62}," {",[41,154,155],{"class":62}," this.",[41,157,158],{"class":90},"head",[41,160,93],{"class":62},[41,162,163],{"class":62}," null;",[41,165,166],{"class":62}," }\n",[41,168,170,174,176,178,180],{"class":43,"line":169},11,[41,171,173],{"class":172},"swJcz","  prepend",[41,175,72],{"class":62},[41,177,76],{"class":75},[41,179,79],{"class":62},[41,181,63],{"class":62},[41,183,185,188,191,193,196,199,201,203,205],{"class":43,"line":184},12,[41,186,187],{"class":54},"    const",[41,189,190],{"class":90}," node",[41,192,93],{"class":62},[41,194,195],{"class":62}," new",[41,197,59],{"class":198},"s2Zo4",[41,200,72],{"class":172},[41,202,76],{"class":90},[41,204,79],{"class":172},[41,206,99],{"class":62},[41,208,210,213,216,218,220,222,224],{"class":43,"line":209},13,[41,211,212],{"class":90},"    node",[41,214,215],{"class":62},".",[41,217,107],{"class":90},[41,219,93],{"class":62},[41,221,155],{"class":62},[41,223,158],{"class":90},[41,225,99],{"class":62},[41,227,229,231,233,235,237,240],{"class":43,"line":228},14,[41,230,87],{"class":62},[41,232,158],{"class":90},[41,234,93],{"class":62},[41,236,190],{"class":90},[41,238,239],{"class":62},";",[41,241,242],{"class":47}," \u002F\u002F O(1)\n",[41,244,246],{"class":43,"line":245},15,[41,247,118],{"class":62},[41,249,251],{"class":43,"line":250},16,[41,252,124],{"class":62},[41,254,256],{"class":43,"line":255},17,[41,257,131],{"emptyLinePlaceholder":130},[41,259,261],{"class":43,"line":260},18,[41,262,263],{"class":47},"\u002F\u002F head → [1] → [2] → [3] → null\n",[11,265,267],{"id":266},"when-youll-hear-this","When You'll Hear This",[16,269,270],{},"\"Linked lists are great for queues where you insert and delete from both ends.\" \u002F \"Arrays are usually better unless you need O(1) insertion in the middle.\"",[272,273,274],"style",{},"html pre.shiki code .sHwdD, html code.shiki .sHwdD{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#546E7A;--shiki-default-font-style:italic;--shiki-dark:#676E95;--shiki-dark-font-style:italic}html pre.shiki code .spNyl, html code.shiki .spNyl{--shiki-light:#9C3EDA;--shiki-default:#C792EA;--shiki-dark:#C792EA}html pre.shiki code .sBMFI, html code.shiki .sBMFI{--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sHdIc, html code.shiki .sHdIc{--shiki-light:#90A4AE;--shiki-light-font-style:italic;--shiki-default:#EEFFFF;--shiki-default-font-style:italic;--shiki-dark:#BABED8;--shiki-dark-font-style:italic}html pre.shiki code .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}html pre.shiki code .s2Zo4, html code.shiki .s2Zo4{--shiki-light:#6182B8;--shiki-default:#82AAFF;--shiki-dark:#82AAFF}html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"title":36,"searchDepth":51,"depth":51,"links":276},[277,278,279,280],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":266,"depth":51,"text":267},"general","A linked list is like a treasure hunt where each clue tells you where the next clue is. Each item (node) holds a value AND a pointer to the next item.","intermediate","md","l",{},"\u002Fterms\u002Fl\u002Flinked-list",[289,290,291,292,293],"Data Structure","Array","Stack","Queue","Pointer",{"title":5,"description":282},{"changefreq":296,"priority":297},"weekly",0.7,"terms\u002Fl\u002Flinked-list","FywWXOOi1-M1oY80nW7QuGjIE7XpBSt4_4IIKTRYy8c",[301,305,308,311],{"title":290,"path":302,"acronym":6,"category":281,"difficulty":303,"description":304},"\u002Fterms\u002Fa\u002Farray","beginner","An array is a list of things in order, like a numbered row of boxes. Box 0 holds the first item, box 1 holds the second, and so on.",{"title":289,"path":306,"acronym":6,"category":281,"difficulty":303,"description":307},"\u002Fterms\u002Fd\u002Fdata-structure","A data structure is a way of organizing information in your code so it is easy to use and fast to access.",{"title":292,"path":309,"acronym":6,"category":281,"difficulty":303,"description":310},"\u002Fterms\u002Fq\u002Fqueue","A queue is like a line at a coffee shop — first come, first served. The first person to get in line is the first to get their coffee.",{"title":291,"path":312,"acronym":6,"category":281,"difficulty":303,"description":313},"\u002Fterms\u002Fs\u002Fstack","A stack is a pile of things where you can only add to the top and take from the top — like a stack of plates.",1776518292248]