Homework/HW05/HashTable.cc
bool HashTable::find(WordCounter &wordc, string k, int position)
{
    //Assume this method will not find anything.
    bool found = false;

    //Check to make sure that the position being passed into this method is valid.
    if (isValid(position))
    {
        //Set up a list iterator and point it at the beginning of the list contained in the position
        //element of the storage vector.
        ListIter iter = storage[position].begin();

        //Iterate through the list looking for the string k.
        while (iter != storage[position].end() && key(*iter) != k)
            //If the string is not found at that location, increment the iterator.
            ++iter;

        //Once the loop is done, test the iterator and check if it is at the end of the list.
        if (iter != storage[position].end())
        {
            //If the iterator is not at the end of the list, copy the word counter object that iter
            //references into wordc and set the found flag to true indicating that string k was
            //located.
            wordc = *iter;
            found = true;
        }
    }

    //Return the flag found, be it true or false.
    return found;
}
/****************************** find ***************************************************************
Action:         Determines if the string k argument passed to it has been used as a key to insert an
                object in the list at the given position.  If yes, then it copies that object into
                the object wordc and returns true.

Parameters:
IN:             string k, holds the string that is being searched for.
IN:             int position, holds the element number in the storage vector where the list to be
                searched is located.
OUT:            WordCounter &wordc, holds a reference to the word counter which will hold the found
                object.  If an object is not found, this variable is unchanged.

Returns:        bool, representing whether string k has been found in this list position.

Precondition:   None
***************************************************************************************************/
find
Action:         Determines if the string k argument passed to it has been used as a key to insert an
object in the list at the given position.  If yes, then it copies that object into
the object wordc and returns true.

string k, holds the string that is being searched for.
IN:             int position, holds the element number in the storage vector where the list to be
searched is located.
OUT:            WordCounter &wordc, holds a reference to the word counter which will hold the found
object.  If an object is not found, this variable is unchanged.

bool, representing whether string k has been found in this list position.

None
find Action : Determines if the string k argument passed to it has been used as a key to insert an object in the list at the given position . If yes then it copies that object into the object wordc and returns true . string k holds the string that is being searched for . IN : int position holds the element number in the storage vector where the list to be searched is located . OUT : WordCounter &wordc holds a reference to the word counter which will hold the found object . If an object is not found this variable is unchanged . bool representing whether string k has been found in this list position . None
bool HashTable::find(WordCounter &wordc, string k, int position)
{
    bool found = false;
    if (isValid(position))
    {
        ListIter iter = storage[position].begin();
        while (iter != storage[position].end() && key(*iter) != k)
            ++iter;
        if (iter != storage[position].end())
        {
            wordc = *iter;
            found = true;
        }
    }
    return found;
}
bool HashTable :: find ( WordCounter & wordc , string k , int position ) { bool found = false ; if ( isValid ( position ) ) { ListIter iter = storage [ position ] . begin ( ) ; while ( iter != storage [ position ] . end ( ) && key ( * iter ) != k ) ++ iter ; if ( iter != storage [ position ] . end ( ) ) { wordc = * iter ; found = true ; } } return found ; }
find
Action:         Determines if the string k argument passed to it has been used as a key to insert an
object in the list at the given position.
find Action : Determines if the string k argument passed to it has been used as a key to insert an object in the list at the given position .
//Assume this method will not find anything. //Check to make sure that the position being passed into this method is valid. //Set up a list iterator and point it at the beginning of the list contained in the position //element of the storage vector. //Iterate through the list looking for the string k. //If the string is not found at that location, increment the iterator. //Once the loop is done, test the iterator and check if it is at the end of the list. //If the iterator is not at the end of the list, copy the word counter object that iter //references into wordc and set the found flag to true indicating that string k was //located. //Return the flag found, be it true or false.