<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE wml PUBLIC "-//WAPFORUM//DTD WML 1.1//EN" "http://www.wapforum.org/DTD/wml_1.1.xml">
<wml>
<card id="c" title="Big O Notation Guide for Beginners">
<do type="prev" label="Back"><prev/></do>
<p>O(N) describes an algorithm whose performance will grow linearly and in direct proportion to the size of the input data set.</p>
<p>The example below also demonstrates how Big O supports the worst-case performance scenario.</p>
<p mode="nowrap">const nums = [1, 2, 3, 4, 5];<br/>let sum = 0;<br/>for (let num of nums) {<br/>&#160;&#160;sum += num;<br/>}</p>
<p mode="wrap">Again, the question is: how many input operations are required? Here, you need to iterate over each element, i.e., an operation for each element. The larger the array, the more operations.</p>
<p>Using Big O notation: O(n), or &quot;complexity of order n.&quot; Such algorithms are also called &quot;linear&quot; or that the algorithm &quot;scales linearly.&quot;</p>
<p mode="wrap"><a href="/wap/eng/guide-to-Big-O-notation-2.wml">&lt;&lt; Prev</a> | 3/11 | <a href="/wap/eng/guide-to-Big-O-notation-4.wml">Next &gt;&gt;</a><br/><a href="/wap/eng.wml">English</a><br/><a href="/wap/index.wml">Home</a></p>
</card>
</wml>
