notes19b

2 23 trees olog n 2 note what about bestcase

Info iconThis preview shows page 1. Sign up to view the full content.

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

Unformatted text preview: Lists 3. Search Trees 3.1 BSTs 3.2 2 ­3 Trees O(log n) 2 Note: What about Best ­case Complexity? 3. Search Trees Best-case Complexity 3.1 BSTs O(1) O(1) O(1) 3.2 2 ­3 Trees O(1) O(1) O(1) Memory Model  ­ All memory accesses are O(1) time  ­ In reality, this is not always the case Limitations  ­ Ideally, we like all the data to be in CPU registers, but it is not likely because the registers are relatively small.  ­ Moreover, we want to keep the data as close to the CPU as possible, because differences in access times can be extreme. Eg. Compare 101 to 103 to 107 3 Terminology • Temporal Locality  Programs access a small subset of data over and over  Eg: Likely to have b in the future b a c • Spatial Locality  If a program access a memory location, it is very likely to access its neighbors  Eg: Likely to access item near b a b c...
View Full Document

This note was uploaded on 02/04/2014 for the course CS 234 taught by Professor Baranoski during the Spring '09 term at Waterloo.

Ask a homework question - tutors are online