{"version":3,"sources":["webpack:///./src/content/The_Power_of_Efficiency_Big_O_Analysis.mdx","webpack:///./src/components/MdxLink.vue?af12","webpack:///src/components/MdxLink.vue","webpack:///./src/components/MdxLink.vue?b35b","webpack:///./src/components/MdxLink.vue"],"names":["h","layoutProps","MDXLayout","MDXContent","components","props","require","isMDXComponent","name","inject","$mdxComponents","default","computed","this","render","createElement","mdx","bind","_vm","_h","$createElement","_c","_self","attrs","on","$event","preventDefault","navigate","_t","staticRenderFns","to","type","String","required","methods","$router","push","catch","err","console","error","component"],"mappings":"6HAEIA,E,yDAMEC,EAAc,GAGdC,EAAY,UAClB,SAASC,EAAT,GAGG,IAFDC,EAEC,EAFDA,WACGC,EACF,iCACD,mBAAsBJ,EAAtB,GAAuCI,EAAvC,mBAA0DD,EAA1D,QAA8E,gBAA9E,mBAES,sBAFT,0DAImB,OAJnB,+BAIsC,OAAS,CACvC,KAAQ,mBALhB,8CAOmB,OAPnB,+BAOsC,OAAS,CACvC,KAAQ,gDARhB,2EAUmB,OAVnB,+BAUsC,OAAS,CACvC,KAAQ,+CAXhB,2EAamB,OAbnB,+BAasC,OAAS,CACvC,KAAQ,uCAdhB,kEAgBmB,OAhBnB,+BAgBsC,OAAS,CACvC,KAAQ,iBAjBhB,sCAoBS,iBApBT,mCAsBQ,uBAtBR,+bA4BuB,MA5BvB,iDA4B6E,MA5B7E,oDA4BsI,MA5BtI,qgBAkCS,8CAlCT,gEAoCQ,uBApCR,woBA2CsE,MA3CtE,4RA6CmI,MA7CnI,wGA+Ca,2CA/Cb,gBAgDW,iCAhDX,WAgDiDE,EAAQ,QAhDzD,QAgD8I,OAhD9I,IAgDyJ,yBAhDzJ,YAgD8L,8BAhD9L,2CAmDc,mDAnDd,QAmDyE,YAnDzE,oYAqDS,6CArDT,gEAuDQ,uBAvDR,0WA4D4B,MA5D5B,oDA4DqF,MA5DrF,mKA6D0C,MA7D1C,+IA8D4B,MA9D5B,qJA8DsL,MA9DtL,yIA+D8G,MA/D9G,w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EAAI9B,MACN+B,QAAQC,MAAMF,UCpByT,I,YCO7UG,EAAY,eACd,EACA3B,EACAe,GACA,EACA,KACA,KACA,MAIa,OAAAY,E","file":"js/chunk-4e65855e.ff13de0f.js","sourcesContent":["// vue babel plugin doesn't support pragma replacement\nimport { mdx } from '@mdx-js/vue'\nlet h;\n/* @jsxRuntime classic */\n/* @jsx mdx */\nimport MdxLink from '../components/MdxLink.vue';\n\n\nconst layoutProps = {\n \n};\nconst MDXLayout = \"wrapper\"\nfunction MDXContent({\n components,\n ...props\n}) {\n return \n\n

Table of contents:

\n
    \n
  1. {`Introduction`}
  2. \n
  3. {`The Power of Big O Analysis in JavaScript`}
  4. \n
  5. {`Exploring JavaScript's Built-in Functions`}
  6. \n
  7. {`Craftsmanship in Code Efficiency`}
  8. \n
  9. {`Conclusion`}
  10. \n
\n

\n Introduction\n ↑ go up\n

\n

{`Imagine you have a toy box filled with treasures, and you're searching for a specific toy.\nBig O analysis helps us understand how quickly we can find that toy as the toy box gets bigger.\nIt's like a magic symbol that describes the speed of algorithms.`}

\n

{`Just like finding toys, some algorithms are super fast, while others can be slower. Big O analysis uses some symbols like\n`}{`O(1)`}{`, `}{`O(n)`}{`, or `}{`O(n^2)`}{` to describe the efficiency of algorithms.`}

\n

{`When we talk about the efficiency of an algorithm, we're interested in two things: time complexity\nand space complexity. Time complexity refers to how long an algorithm takes to solve a problem,\nwhile space complexity refers to how much memory or storage an algorithm needs to do its job.`}

\n

{`By analyzing these complexities, we can make better decisions about which algorithms to use in different\nuse case situations.`}

\n

\n The Power of Big O Analysis in JavaScript\n ↑ go up\n

\n

{`Big O analysis isn't just for the \"backend\", it's equally important on the \"client side\".\nWhether you're playing a game or using a website, efficiency matters. It helps programmers optimize their code,\nmaking it run smoothly and ensuring a delightful experience for users.`}

\n

{`It allows us to choose the most efficient algorithms and data structures, resulting in faster and more responsive software.`}

\n

{`For example, let's consider a scenario where we need to search for a specific name in a list of names. With a linear\nsearch algorithm, the time complexity would be `}{`O(n)`}{`, where \"n\" is the number of names in the list. This means that\nas the list grows larger, the search time increases linearly.`}

\n

{`However, with a more efficient algorithm like binary search, the time complexity can be reduced to `}{`O(log n)`}{`, where the\nsearch time grows much slower as the list size increases.`}

\n
\n \"Big-O\n
\n

{`Check-out\n: `}{`Exploring Sorting Algorithms in JavaScript`}{` if you want to go slightly deeper in the topic.`}

\n

{`By understanding Big O analysis, we can identify potential performance bottlenecks in our JavaScript code and optimize it accordingly. This ensures that our applications and websites run smoothly, even when dealing with large datasets or complex operations.`}

\n

\n Exploring JavaScript's Built-in Functions\n ↑ go up\n

\n

{`JavaScript provides us with a range of powerful built-in functions that make our lives easier.\nLet's explore a few examples and understand their time and space complexities. Having an understanding\nof these complexities can help us make better decisions when choosing the right functions for.`}

\n

{`push`}{` and `}{`pop`}{`: These functions allow us to add or remove elements from an array quickly. They have a constant\ntime complexity of `}{`O(1)`}{`, meaning they execute in the same amount of time, regardless of the size of the array.`}

\n

{`slice`}{`: This function creates a new array by copying a portion of the original one. Its time complexity is `}{`O(n)`}{`,\nwhere \"n\" is the size of the resulting sliced array. It also has a space complexity of `}{`O(n)`}{` because it creates a new array.`}

\n

{`sort`}{`: Sorting an array can be a complex task. JavaScript's built-in sorting function typically has an average\ntime complexity of `}{`O(n log(n))`}{` and a worst-case time complexity of `}{`O(n^2)`}{`. It may seem slower for large arrays\nbut performs well in most cases.`}

\n

{`concat`}{`: This function combines multiple arrays into a new array. Its time complexity is `}{`O(m + n)`}{`, where `}{`m`}{` and `}{`n`}{`\nare the sizes of the input arrays. Similarly, its space complexity is also `}{`O(m + n)`}{`.`}

\n

{`indexOf`}{`: This function is used to find the index of a specific element in an array. Its time complexity is `}{`O(n)`}{`,\nas it may need to traverse the entire array to find the desired element. However, if the array is sorted, we can use\nthe more efficient binarySearch function with a time complexity of O(log n).`}

\n

{`map`}{`: The map function is used to transform each element of an array based on a provided callback function. It creates\na new array with the same length as the original array. The time complexity of map is `}{`O(n)`}{`, as it performs the callback\nfunction on each element once.`}

\n

{`filter`}{`: The filter function is used to create a new array with elements that pass a certain condition. It iterates over\neach element of the array, performing a check for the condition. Its time complexity is also`}{`O(n)`}{`, as it may need to examine\neach element once.`}

\n

{`reduce`}{`: The reduce function is used to aggregate the elements of an array into a single value. It applies a callback function\nto each element, accumulating a final result. The time complexity of reduce is also `}{`O(n)`}{`, as it needs to visit each element once.`}

\n

{`includes`}{`: This function checks if an array includes a specific element and returns a boolean value. It has a time complexity\nof`}{`O(n)`}{`, as it may need to traverse the entire array to find the element.`}

\n

{`By understanding the time and space complexities of these built-in functions, we can choose the most efficient ones for our\nalgorithm, ensuring optimal performance in our JavaScript applications.`}

\n

\n Craftsmanship in Code Efficiency\n ↑ go up\n

\n

{`Efficiency plays a vital role in software development, by considering time and space complexities, we optimize our code and\nimprove performance. Efficient code ensures faster responses, scalability as the software grows, and optimal resource utilization.\nIt's like crafting a masterpiece that runs smoothly and impresses users. To achieve efficiency, we need to choose the right\nalgorithms and data structures, write clean and optimized code, and be mindful of the trade-offs between time and space`}

\n

{`Here are a few best practices to keep in mind when aiming for code efficiency:`}

\n
    \n
  1. {`Choose the appropriate data structures and algorithms for the task at hand. Understand their time and space complexities.`}
  2. \n
  3. {`Minimize unnecessary computations and iterations. Optimize loops and conditionals for better performance.`}
  4. \n
  5. {`Avoid unnecessary memory usage and optimize memory-intensive operations. Reuse variables and release resources when\nno longer needed.`}
  6. \n
  7. {`Utilize built-in functions and libraries when they offer optimized implementations. Leverage the expertise of the JavaScript\ncommunity.`}
  8. \n
  9. {`Regularly profile and analyze your code to identify bottlenecks and areas for improvement. Tools like profilers and debuggers\ncan help in this process.`}
  10. \n
\n

{`By following these best practices and considering time and space complexities, we can unlock the full potential of JavaScript\nand create efficient, high-performing applications.`}

\n

\n Conclusion\n ↑ go up\n

\n

{`By understanding efficiency, we can create scalable, and resource-efficient software. Remember to consider time and space\ncomplexities when writing code, as it leads to a better user experience.`}

\n

{`Embrace the art of crafting efficient code, and let it be the foundation of your coding journey.`}

\n

{`Keep exploring, coding, and optimizing your way to success.`}

\n

{`Happy coding!`}

\n
;\n}\n;\nMDXContent.isMDXComponent = true;\n\nexport default {\n name: 'Mdx',\n inject: {\n $mdxComponents: {\n default: () => () => ({})\n }\n },\n computed: {\n components() {\n return this.$mdxComponents()\n }\n },\n render(createElement) {\n h = mdx.bind({ createElement, components: this.components })\n return MDXContent({ components: this.components })\n }\n}\n ","var render = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('a',{attrs:{\"href\":\"#\"},on:{\"click\":function($event){$event.preventDefault();return _vm.navigate($event)}}},[_vm._t(\"default\")],2)}\nvar staticRenderFns = []\n\nexport { render, staticRenderFns }","\n\n\n","import mod from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MdxLink.vue?vue&type=script&lang=js&\"; export default mod; export * from \"-!../../node_modules/cache-loader/dist/cjs.js??ref--12-0!../../node_modules/thread-loader/dist/cjs.js!../../node_modules/babel-loader/lib/index.js!../../node_modules/cache-loader/dist/cjs.js??ref--0-0!../../node_modules/vue-loader/lib/index.js??vue-loader-options!./MdxLink.vue?vue&type=script&lang=js&\"","import { render, staticRenderFns } from \"./MdxLink.vue?vue&type=template&id=9b234c46&\"\nimport script from \"./MdxLink.vue?vue&type=script&lang=js&\"\nexport * from \"./MdxLink.vue?vue&type=script&lang=js&\"\n\n\n/* normalize component */\nimport normalizer from \"!../../node_modules/vue-loader/lib/runtime/componentNormalizer.js\"\nvar component = normalizer(\n script,\n render,\n staticRenderFns,\n false,\n null,\n null,\n null\n \n)\n\nexport default component.exports"],"sourceRoot":""}