01:198:111 Lecture Notes - Lecture 21: Boolean Algebra, Computer Architecture, Linear Equation
01:198:111 verified notes
21/28View all
Document Summary
The runtime of a program depends on many factors. The efficiency of an algorithm is based on: How many total operations the algorithm performs. How much memory is used by the algorithm. This is actually six operations since reading the variable is one operations and setting the variable is another. This makes the number of total operations as 6n, n being the number of times the for loop runs. T(n)=6n - linear equation of the amount of operations. This equation means that the time to execute the program is proportional to the number of times the program runs. Int n=a. length; for (int i=0; i