Developing Efficient Algorithms

Ace your homework & exams now with Quizwiz!

General requirements for a computer program

-must produce correct results -should be maintainable -should run efficiently

factors that influence the time it takes for a program to execute

-the size and content of the input data -the hardware specifications of a particular system -the nature and volume of "other programs" which may be sharing the system at the time of the test

what is the Big O performance of a nested loop (one outer and one inner loop)

O(N^2)

Ignore constant multiples: if C is constant, then O(C*f(N)) is the same as O(f(N)) and O(f(C*N)) is the same as

O(f(N))

if O(f(N)) > O(g(N)) for large values of N, then O(f(N)) + O(g(N)) can be simplified to

O(f(N))

if an algorithm performs a certain sequence of steps f(N) times for a function f, then the time complexity for that sequence is

O(f(N))

if an algorithm performs an operation which requires O(f(N)) and for every step in that operation it also performs a second operation which requires O(g(N)), then the total time complexity is

O(f(N)) * O(g(N))

if an algorithm performs one operation which requires O(f(N)) and then performs a second operation which requires O(g(n)), then the total time complexity is

O(f(N)) + (O(g(N))

an algorithm with O(2^N) is called

an exponential algorithm

constant time

an operation that will always take the same amount of time to execute (i.e. returning the first element of an array)

Why don't we use an average case analysis

because average case analysis is difficult to achieve

what does Big O notation do?

it estimates the execution time of an algorithm in relation to the input size. If the time if not related to the input size, the algorithm is said to take constant time with the notation O(1)

sequential search

searching through a data structure that isn't sorted, searching one value after another until you either find the value you are looking for or don't find it at all

true of false for 0(logN) the time required to search is only doubled if the input data is squared

true

true or false Big O notation is a "worst case" scenario notation

true

true or false the multiplicative constants in algorithm efficiency analysis don't effect growth rates

true

true or false the time required for a sequential search will grow proportionally to the size of an array

true


Related study sets

McGraw Hill Genetics Connect Homework Chpt. 13, 14, 15, 17, 25

View Set

MH Chapter 12: Schizophrenia Spectrum Disorders Halter: Varcarolis' Foundations of Psychiatric-M

View Set

الخلايا - خصائص الكائنات الحية 1-1

View Set

IB Math Core Topics Chapter 2- Sets and Venn Diagrams

View Set

NU272 HESI Case Study: Parkinson Disease

View Set

Using Functions in Models and Decision Making: Piecewise Defined Functions (assignment)~amdm

View Set

Central Dogma of Molecular Biology

View Set