CPS 6, Ramm - Summer Semester I - 6/11/99 #16

Chap 8. Arrays, Data, & Random Access

  • A Simple Information Storage/Retrieval System
    • Concepts
      • Store lines from file in vector
      • Retrieve lines by matching substrings
      • Like UNIX grep program
    • getinfo.cc

  • Improving the Storage/Retrieval System

  • WordList Class
    • List of Unique Words
    • Update with next word
      • Search for previous
    • Print Unique List
    • allword3.cc

  • Binary Search
    • Telephone Book Analogy
      • Eliminate half each time
    • Requires Sorted Lists
    • list size binary search sequential search
      1 1 1
      10 4 10
      1,000 11 1000
      5,000 14 5000
      100,000 18 100,000
      1,000,000 21 1,000,000
    • binsearch

  • Keeping a Sorted List