1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

c++ binary search

Discussion in 'Web Design & Development' started by Sphinx, Jan 24, 2007.

Thread Status:
Not open for further replies.
  1. Sphinx

    Sphinx Thread Starter

    Aug 5, 2003
    Ok, I have two vectors, each containing a bunch of strings.

    One of them is the keywords vector, the other is a longer vector containing a big list of words.

    My object is to search the the big list of words and count how many times each of the keywords occurs in that.

    Assume both vectors are sorted.
    If i use two for loops (one inside the other) I can easily do this using the compare function for strings, however, this way is very inneficient.

    I want to use binary search, however binary search simply returns the position of the string you are looking for, and that's it. This doesn't really help me, as the word may occur many times.

  2. MMJ

    MMJ Guest

    Oct 15, 2006
    Why is this in web dev?
As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/537870

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice