This preview shows pages 1–4. Sign up to view the full content.
This preview has intentionally blurred sections. Sign up to view the full version.
View Full DocumentThis preview has intentionally blurred sections. Sign up to view the full version.
View Full Document
Unformatted text preview: 10/19/2010 1 CENG 213 Data Structures 1 More on Algorithm Analysis What is Important? ringbutton3 An arraybased list retrieve operation is O(1), a linked listbased list retrieve operation is O(n). ringbutton3 But insert and delete operations are much easier on a linkedlistbased 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 tradeoffs 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 Orderofmagnitude analysis focuses on large problems. 3 A Comparison of GrowthRate Functions 4 10/19/2010 3 A Comparison of GrowthRate Functions (cont.) 5 GrowthRate 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.
 Spring '10
 Yok

Click to edit the document details