[{"data":1,"prerenderedAt":343},["ShallowReactive",2],{"term-d\u002Fdata-structure":3,"related-d\u002Fdata-structure":323},{"id":4,"title":5,"acronym":6,"body":7,"category":302,"description":303,"difficulty":304,"extension":305,"letter":306,"meta":307,"navigation":54,"path":308,"related":309,"seo":317,"sitemap":318,"stem":321,"subcategory":6,"__hash__":322},"terms\u002Fterms\u002Fd\u002Fdata-structure.md","Data Structure",null,{"type":8,"value":9,"toc":296},"minimark",[10,15,19,23,26,30,285,289,292],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"A data structure is a way of organizing information in your code so it is easy to use and fast to access. Like how a phonebook is organized alphabetically so you can find numbers fast. Different structures are good at different things — arrays are great for lists, hash maps are great for lookups.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"A data structure is a specialized way of organizing, storing, and manipulating data in memory to enable efficient access and modification. The choice of data structure fundamentally affects algorithm performance. Common data structures include arrays, linked lists, stacks, queues, hash maps, trees, and graphs. Each has trade-offs in time and space complexity for different operations.",[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 Choosing the right data structure matters:\n\n\u002F\u002F Array — good for ordered lists:\nconst fruits = ['apple', 'banana', 'cherry'];\n\n\u002F\u002F Hash Map (Object) — good for key lookups:\nconst userById = { 'u1': { name: 'Alice' }, 'u2': { name: 'Bob' } };\nconst user = userById['u1']; \u002F\u002F O(1) lookup vs O(n) for array search\n\n\u002F\u002F Set — good for unique values:\nconst visited = new Set();\nvisited.add('page1'); \u002F\u002F fast deduplification\n","javascript","",[38,39,40,49,56,62,115,120,126,195,222,227,233,255],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F Choosing the right data structure matters:\n",[41,50,52],{"class":43,"line":51},2,[41,53,55],{"emptyLinePlaceholder":54},true,"\n",[41,57,59],{"class":43,"line":58},3,[41,60,61],{"class":47},"\u002F\u002F Array — good for ordered lists:\n",[41,63,65,69,73,77,80,83,87,89,92,95,98,100,102,104,107,109,112],{"class":43,"line":64},4,[41,66,68],{"class":67},"spNyl","const",[41,70,72],{"class":71},"sTEyZ"," fruits ",[41,74,76],{"class":75},"sMK4o","=",[41,78,79],{"class":71}," [",[41,81,82],{"class":75},"'",[41,84,86],{"class":85},"sfazB","apple",[41,88,82],{"class":75},[41,90,91],{"class":75},",",[41,93,94],{"class":75}," '",[41,96,97],{"class":85},"banana",[41,99,82],{"class":75},[41,101,91],{"class":75},[41,103,94],{"class":75},[41,105,106],{"class":85},"cherry",[41,108,82],{"class":75},[41,110,111],{"class":71},"]",[41,113,114],{"class":75},";\n",[41,116,118],{"class":43,"line":117},5,[41,119,55],{"emptyLinePlaceholder":54},[41,121,123],{"class":43,"line":122},6,[41,124,125],{"class":47},"\u002F\u002F Hash Map (Object) — good for key lookups:\n",[41,127,129,131,134,136,139,141,145,147,150,152,155,157,159,162,164,167,169,172,174,176,178,180,182,184,187,189,192],{"class":43,"line":128},7,[41,130,68],{"class":67},[41,132,133],{"class":71}," userById ",[41,135,76],{"class":75},[41,137,138],{"class":75}," {",[41,140,94],{"class":75},[41,142,144],{"class":143},"swJcz","u1",[41,146,82],{"class":75},[41,148,149],{"class":75},":",[41,151,138],{"class":75},[41,153,154],{"class":143}," name",[41,156,149],{"class":75},[41,158,94],{"class":75},[41,160,161],{"class":85},"Alice",[41,163,82],{"class":75},[41,165,166],{"class":75}," },",[41,168,94],{"class":75},[41,170,171],{"class":143},"u2",[41,173,82],{"class":75},[41,175,149],{"class":75},[41,177,138],{"class":75},[41,179,154],{"class":143},[41,181,149],{"class":75},[41,183,94],{"class":75},[41,185,186],{"class":85},"Bob",[41,188,82],{"class":75},[41,190,191],{"class":75}," }",[41,193,194],{"class":75}," };\n",[41,196,198,200,203,205,208,210,212,214,216,219],{"class":43,"line":197},8,[41,199,68],{"class":67},[41,201,202],{"class":71}," user ",[41,204,76],{"class":75},[41,206,207],{"class":71}," userById[",[41,209,82],{"class":75},[41,211,144],{"class":85},[41,213,82],{"class":75},[41,215,111],{"class":71},[41,217,218],{"class":75},";",[41,220,221],{"class":47}," \u002F\u002F O(1) lookup vs O(n) for array search\n",[41,223,225],{"class":43,"line":224},9,[41,226,55],{"emptyLinePlaceholder":54},[41,228,230],{"class":43,"line":229},10,[41,231,232],{"class":47},"\u002F\u002F Set — good for unique values:\n",[41,234,236,238,241,243,246,250,253],{"class":43,"line":235},11,[41,237,68],{"class":67},[41,239,240],{"class":71}," visited ",[41,242,76],{"class":75},[41,244,245],{"class":75}," new",[41,247,249],{"class":248},"s2Zo4"," Set",[41,251,252],{"class":71},"()",[41,254,114],{"class":75},[41,256,258,261,264,267,270,272,275,277,280,282],{"class":43,"line":257},12,[41,259,260],{"class":71},"visited",[41,262,263],{"class":75},".",[41,265,266],{"class":248},"add",[41,268,269],{"class":71},"(",[41,271,82],{"class":75},[41,273,274],{"class":85},"page1",[41,276,82],{"class":75},[41,278,279],{"class":71},")",[41,281,218],{"class":75},[41,283,284],{"class":47}," \u002F\u002F fast deduplification\n",[11,286,288],{"id":287},"when-youll-hear-this","When You'll Hear This",[16,290,291],{},"\"Use a hash map for that — O(1) lookup instead of O(n).\" \u002F \"Knowing your data structures is key for coding interviews.\"",[293,294,295],"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 .sTEyZ, html code.shiki .sTEyZ{--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8}html pre.shiki code .sMK4o, html code.shiki .sMK4o{--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF}html pre.shiki code .sfazB, html code.shiki .sfazB{--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D}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":297},[298,299,300,301],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":287,"depth":51,"text":288},"general","A data structure is a way of organizing information in your code so it is easy to use and fast to access.","beginner","md","d",{},"\u002Fterms\u002Fd\u002Fdata-structure",[310,311,312,313,314,315,316],"Array","Hash Map","Linked List","Stack","Queue","Tree","Graph",{"title":5,"description":303},{"changefreq":319,"priority":320},"weekly",0.7,"terms\u002Fd\u002Fdata-structure","XENM1Sq_lfP5QSGeEWCnYcdSRtD6GnZBI19wC4XLIEc",[324,327,331,334,337,340],{"title":310,"path":325,"acronym":6,"category":302,"difficulty":304,"description":326},"\u002Fterms\u002Fa\u002Farray","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":316,"path":328,"acronym":6,"category":302,"difficulty":329,"description":330},"\u002Fterms\u002Fg\u002Fgraph","intermediate","A graph is like a network of dots connected by lines. Each dot is a node and each line is an edge.",{"title":311,"path":332,"acronym":6,"category":302,"difficulty":329,"description":333},"\u002Fterms\u002Fh\u002Fhash-map","A hash map is a super-fast lookup table. You store a value under a key (like a label), and you can find it instantly without searching through everything.",{"title":312,"path":335,"acronym":6,"category":302,"difficulty":329,"description":336},"\u002Fterms\u002Fl\u002Flinked-list","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.",{"title":314,"path":338,"acronym":6,"category":302,"difficulty":304,"description":339},"\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":313,"path":341,"acronym":6,"category":302,"difficulty":304,"description":342},"\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.",1776518272512]