Checking equality of two Deque container in C -


i trying implement function check deque equality in c. algorithm of function should like:

bool isdequeequal(deque d1,deque d2) {      if size of d1 , d2 different             return false      loop front rear of both dequeue        if element @ current position of d1 != element @ current position of d2                    return false        else            continue  if loop ends return true } 

i have implemented of logic not getting how compare if elements of current position in d1 , d2 same. datatype deque container holding can basic or derived datatype. in case how can check if contents @ current location same?

i tried checking how same implemented in std::deque. not getting how done in deque.h library.

please help.

edit1: deque container can hold data-type ex. int, char array, structure etc.

if deque can hold need caller supply comparison function (like qsort see http://linux.die.net/man/3/qsort).

either must supply when create deque , must remember it, or must supplied on functions (like equal) require concept of 'does element x = element y'.


Comments