Thread: Binary search on strings

  1. #1
    Registered User
    Join Date
    Oct 2007
    Posts
    1

    Post Binary search on strings

    I want to build a spell checker using binary search.

    Can anyone guide me how to do the binary search on strings.

  2. #2
    Registered User
    Join Date
    Jan 2005
    Posts
    7,366
    Code:
    std::vector<std::string> list_of_strings;
    // fill and sort list
    
    std::binary_search(list_of_strings.begin(), list_of_strings.end(), string_to_search_for);

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. problem in storing data in a binary search tree
    By alavardi in forum C Programming
    Replies: 5
    Last Post: 02-13-2005, 03:20 PM
  2. Tutorial review
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 11
    Last Post: 03-22-2004, 09:40 PM
  3. Request for comments
    By Prelude in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 01-02-2004, 10:33 AM
  4. Sorting strings to speed up search?
    By Mox in forum C++ Programming
    Replies: 5
    Last Post: 09-10-2001, 12:17 PM