boblied 26 Newbie Poster

... Note that "time" is highlighted. It's a C++ keyword.

Sorry for the tangent, but "time" is not a C++ keyword. The fact that it's highlighted is maybe because the syntax highlighter handles multiple languages, and "time" is a keyword in some of them (for instance, in the bash shell); or maybe because there is a Unix/POSIX/C standard function called time() from time.h . But "time" is not a C or C++ keyword, and the global function time() wouldn't conflict with a member variable called "time."

boblied 26 Newbie Poster

At line 6, you declared showMedian to take a double parameter, but
you implemented it to take a double *.

At line 84, are you trying to call arrSelectSort again? If so, it doesn't need the types in its arguments.

At line 90, you are checking a pointer to see if it's odd or even. Probably you meant to check size, not array.

At line 92, it looks like you have become confused between the size parameter and the numValues variable used elsewhere.

In the case for even number of elements, remember that array will be indexed from 0 to size-1, not 1 to size.

Nick Evan commented: sounds like good advice to me! +22
boblied 26 Newbie Poster

Couple o' things:

Search has to return a pointer, so don't return info, return the pointer of the node you're looking at.

The recursive call of Search() has to take the same parameters as the first call, so don't forget to pass key.

That while loop at the end of search is trouble: if the condition wasn't true before calling Search(), it
still won't be true after you call search -- infinite loop. A simple if would do -- the recursion is taking the place of looping.

In FindMax, it would probably be helpful to pass the biggest value found so far as an input parameter.

blackhawk9876 commented: thx +2
boblied 26 Newbie Poster

For the purpose of sorting, any complete ordering will do. You could define a sort that uses x as primary key, y as secondary, and z as tiebreaker.

// Comparator function object to define less-than for Points
struct PointLess
{
    bool operator()(const Point& p1, const Point& p2) const
    {
        if ( p1.x < p2.x )
            return true;
        else if ( p2.x < p1.x )
            return false;
        // assert(p1.x == p2.x )
        if ( p1.y < p2.y )
            return true;
        else if ( p2.y < p1.y )
            return false;
        // assert(p1.x == p2.x && p1.y == p2.y )
        if ( p1.z < p2.z )
            return true;
        else
            return false;
    }
};

std::set<Point, PointLess> sp( pointVec.begin(), pointVec.end() );

std::vector<Point> noDupVec( sp.begin(), sp.end());
daviddoria commented: Good idea. +2