[{"data":1,"prerenderedAt":255},["ShallowReactive",2],{"term-b\u002Fbig-o":3,"related-b\u002Fbig-o":238},{"id":4,"title":5,"acronym":6,"body":7,"category":219,"description":220,"difficulty":221,"extension":222,"letter":223,"meta":224,"navigation":82,"path":225,"related":226,"seo":232,"sitemap":233,"stem":236,"subcategory":6,"__hash__":237},"terms\u002Fterms\u002Fb\u002Fbig-o.md","Big O",null,{"type":8,"value":9,"toc":213},"minimark",[10,15,19,23,26,30,202,206,209],[11,12,14],"h2",{"id":13},"eli5-the-vibe-check","ELI5 — The Vibe Check",[16,17,18],"p",{},"Big O notation is how we describe how fast (or slow) an algorithm gets as the input grows. O(1) means instant no matter the size. O(n) means it takes twice as long if you double the input. O(n²) means it takes four times longer for double the input. It is the vocabulary for talking about performance at scale.",[11,20,22],{"id":21},"real-talk","Real Talk",[16,24,25],{},"Big O notation describes the upper bound of an algorithm's time or space complexity as a function of input size (n), ignoring constants and lower-order terms. It characterizes worst-case behavior. Common complexities from fastest to slowest: O(1) constant, O(log n) logarithmic, O(n) linear, O(n log n) linearithmic, O(n²) quadratic, O(2ⁿ) exponential. Used to compare algorithm efficiency independently of hardware.",[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 O(1) — constant: doesn't matter how big the array is\nconst first = arr[0];\n\n\u002F\u002F O(n) — linear: one loop through n items\nfor (const item of arr) { \u002F* ... *\u002F }\n\n\u002F\u002F O(n²) — quadratic: nested loops (danger zone)\nfor (const a of arr) {\n  for (const b of arr) { \u002F* ... *\u002F }\n}\n\n\u002F\u002F O(log n) — logarithmic: binary search, halves each step\n\u002F\u002F O(n log n) — merge sort, quicksort (best general-purpose sort)\n","javascript","",[38,39,40,49,77,84,90,120,125,131,150,179,185,190,196],"code",{"__ignoreMap":36},[41,42,45],"span",{"class":43,"line":44},"line",1,[41,46,48],{"class":47},"sHwdD","\u002F\u002F O(1) — constant: doesn't matter how big the array is\n",[41,50,52,56,60,64,67,71,74],{"class":43,"line":51},2,[41,53,55],{"class":54},"spNyl","const",[41,57,59],{"class":58},"sTEyZ"," first ",[41,61,63],{"class":62},"sMK4o","=",[41,65,66],{"class":58}," arr[",[41,68,70],{"class":69},"sbssI","0",[41,72,73],{"class":58},"]",[41,75,76],{"class":62},";\n",[41,78,80],{"class":43,"line":79},3,[41,81,83],{"emptyLinePlaceholder":82},true,"\n",[41,85,87],{"class":43,"line":86},4,[41,88,89],{"class":47},"\u002F\u002F O(n) — linear: one loop through n items\n",[41,91,93,97,100,102,105,108,111,114,117],{"class":43,"line":92},5,[41,94,96],{"class":95},"s7zQu","for",[41,98,99],{"class":58}," (",[41,101,55],{"class":54},[41,103,104],{"class":58}," item ",[41,106,107],{"class":62},"of",[41,109,110],{"class":58}," arr) ",[41,112,113],{"class":62},"{",[41,115,116],{"class":47}," \u002F* ... *\u002F",[41,118,119],{"class":62}," }\n",[41,121,123],{"class":43,"line":122},6,[41,124,83],{"emptyLinePlaceholder":82},[41,126,128],{"class":43,"line":127},7,[41,129,130],{"class":47},"\u002F\u002F O(n²) — quadratic: nested loops (danger zone)\n",[41,132,134,136,138,140,143,145,147],{"class":43,"line":133},8,[41,135,96],{"class":95},[41,137,99],{"class":58},[41,139,55],{"class":54},[41,141,142],{"class":58}," a ",[41,144,107],{"class":62},[41,146,110],{"class":58},[41,148,149],{"class":62},"{\n",[41,151,153,156,159,161,164,167,170,173,175,177],{"class":43,"line":152},9,[41,154,155],{"class":95},"  for",[41,157,99],{"class":158},"swJcz",[41,160,55],{"class":54},[41,162,163],{"class":58}," b",[41,165,166],{"class":62}," of",[41,168,169],{"class":58}," arr",[41,171,172],{"class":158},") ",[41,174,113],{"class":62},[41,176,116],{"class":47},[41,178,119],{"class":62},[41,180,182],{"class":43,"line":181},10,[41,183,184],{"class":62},"}\n",[41,186,188],{"class":43,"line":187},11,[41,189,83],{"emptyLinePlaceholder":82},[41,191,193],{"class":43,"line":192},12,[41,194,195],{"class":47},"\u002F\u002F O(log n) — logarithmic: binary search, halves each step\n",[41,197,199],{"class":43,"line":198},13,[41,200,201],{"class":47},"\u002F\u002F O(n log n) — merge sort, quicksort (best general-purpose sort)\n",[11,203,205],{"id":204},"when-youll-hear-this","When You'll Hear This",[16,207,208],{},"\"What's the Big O of that lookup? O(n) is too slow for this.\" \u002F \"Use a hash map — O(1) instead of O(n) search.\"",[210,211,212],"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 .sbssI, html code.shiki .sbssI{--shiki-light:#F76D47;--shiki-default:#F78C6C;--shiki-dark:#F78C6C}html pre.shiki code .s7zQu, html code.shiki .s7zQu{--shiki-light:#39ADB5;--shiki-light-font-style:italic;--shiki-default:#89DDFF;--shiki-default-font-style:italic;--shiki-dark:#89DDFF;--shiki-dark-font-style:italic}html pre.shiki code .swJcz, html code.shiki .swJcz{--shiki-light:#E53935;--shiki-default:#F07178;--shiki-dark:#F07178}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":214},[215,216,217,218],{"id":13,"depth":51,"text":14},{"id":21,"depth":51,"text":22},{"id":28,"depth":51,"text":29},{"id":204,"depth":51,"text":205},"general","Big O notation is how we describe how fast (or slow) an algorithm gets as the input grows. O(1) means instant no matter the size.","intermediate","md","b",{},"\u002Fterms\u002Fb\u002Fbig-o",[227,228,229,230,231],"Time Complexity","Space Complexity","Algorithm","Hash Map","Array",{"title":5,"description":220},{"changefreq":234,"priority":235},"weekly",0.7,"terms\u002Fb\u002Fbig-o","ToQrttUrW4Ag3ekI5idUFSZCzzr81oGGVRmm7CvLfhU",[239,243,246,249,252],{"title":229,"path":240,"acronym":6,"category":219,"difficulty":241,"description":242},"\u002Fterms\u002Fa\u002Falgorithm","beginner","An algorithm is just a step-by-step recipe for solving a problem. Sort a list? There is an algorithm. Find the shortest path? Algorithm. Make a sandwich?",{"title":231,"path":244,"acronym":6,"category":219,"difficulty":241,"description":245},"\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":230,"path":247,"acronym":6,"category":219,"difficulty":221,"description":248},"\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":228,"path":250,"acronym":6,"category":219,"difficulty":221,"description":251},"\u002Fterms\u002Fs\u002Fspace-complexity","Space complexity is how much extra memory your algorithm uses as the input grows.",{"title":227,"path":253,"acronym":6,"category":219,"difficulty":221,"description":254},"\u002Fterms\u002Ft\u002Ftime-complexity","Time complexity is how the time your algorithm takes grows as the input gets bigger. Does it take twice as long when you double the data? Ten times longer?",1776518260076]