10.09.2013 Views

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

1. Advanced Data Structure using C++

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

LECTURE NOTES OF ADVANCED DATA STRUCTURE (MT-CSE 110)<br />

Algorithm Analysis and Big‐O Notation<br />

An algorithm is a sequence of computational steps that transform the input<br />

data into useful output data. Algorithm analysis is mostly measuring of the<br />

computational time to solve the problem. Because the behavior of an algorithm<br />

may be different for each possible set of data, there needs to be a means for<br />

summarizing that behavior in simple, easily understood formulas. One way to<br />

derive these formulas is the big O notation. Big O notation, also called an<br />

efficiency indicator, is used to describe the growth rate of a function.<br />

A notation we use to give an approximation to the run‐time efficiency of an<br />

algorithm is called Big‐O notation (The O is for order of magnitude of operations<br />

or space at run‐time.<br />

The Big‐O of a function is a relative measure of how fast the function grows with<br />

respect to n. To apply Big‐O to an algorithm we let f(n) = the number of steps<br />

(or instructions) that are executed when the algorithm runs on n inputs. There<br />

are certain Big‐Oh values that occur frequently in the analysis of algorithms.<br />

Here is a partial list in increasing "size" and the approximate value of |f(n)| for a<br />

few values of n.<br />

Abstract <strong>Data</strong> Type<br />

Array<br />

– A collection of data of the same type<br />

An array is usually implemented as a consecutive set of memory locations<br />

– int list[5], *plist[5]<br />

Variable Memory Address<br />

list[0] base address= b<br />

list[1] b+sizeof(int)<br />

list[2] b+2*sizeof(int)<br />

Prepared By :­<br />

Er. Harvinder Singh<br />

Assist Prof., CSE, H.C.T.M (Kaithal) Page ‐ 55 ‐

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!