02b-MoreOnAlgorithmAnalysis

02b-MoreOnAlgorithmAnalysis - 10/19/2010 1 CENG 213 Data...

Info iconThis preview shows pages 1–4. Sign up to view the full content.

View Full Document Right Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: 10/19/2010 1 CENG 213 Data Structures 1 More on Algorithm Analysis What is Important? ringbutton3 An array-based list retrieve operation is O(1), a linked- list-based list retrieve operation is O(n). ringbutton3 But insert and delete operations are much easier on a linked-list-based list implementation. barb4right When selecting the implementation of an Abstract Data Type (ADT), we have to consider how frequently particular ADT operations occur in a given application. ringbutton3 If the problem size is always small, we can probably ignore the algorithm’s efficiency. circle5 In this case, we should choose the simplest algorithm. 2 10/19/2010 2 What is Important? (cont.) ringbutton3 We have to weigh the trade-offs between an algorithm’s time requirement and its memory requirements. ringbutton3 We have to compare algorithms for both style and efficiency. circle5 The analysis should focus on gross differences in efficiency and not reward coding tricks that save small amount of time. circle5 That is, there is no need for coding tricks if the gain is not too much. circle5 Easily understandable program is also important. ringbutton3 Order-of-magnitude analysis focuses on large problems. 3 A Comparison of Growth-Rate Functions 4 10/19/2010 3 A Comparison of Growth-Rate Functions (cont.) 5 Growth-Rate Functions O(1) Time requirement is constant , and it is independent of the problem’s size. O(log 2 n) Time requirement for a logarithmic algorithm increases slowly as the problem size increases. O(n) Time requirement for a linear algorithm increases directly with the size of the problem....
View Full Document

This note was uploaded on 11/12/2010 for the course CENG 223 taught by Professor Yok during the Spring '10 term at Middle East Technical University.

Page1 / 9

02b-MoreOnAlgorithmAnalysis - 10/19/2010 1 CENG 213 Data...

This preview shows document pages 1 - 4. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online