Write a function that will determine whether 2 binary search
Solution
Hi, Please find my implementation:
template<class Item>
 bool similar(ninary_trr_node* root1, binary_tree_node* root2){
   
    // empty trees are similar
    if(root1==NULL && root2 == NULL)
        return true;
   // empty tree is not similar to a non-empty one
    if(root1 == NULL || root2 == NULL)
        return false;
   // otherwise check recursively
    return similar(root1->left, root2->left) &&
            similar(root1->right, root2->right);
 }
 9)
    template<class Item>
    bool is_sorted(const list<Item> &l){
       // if size is zero or 1, return true
        if(l.size() <= 1)
            return true;
       // getting iterator pointing to first element
        list<Item>::iterator it = l.begin();
       // iterating size-1 times
        for(int i=0; i<l.size()-1; i++){
            Item first = *it; // getting current element
            ++it; // forwarding iterator
            Item second = *it; // getting next element
           // if these two are not in increasing order, return false
            if(second < first)
                return false;
        }
       return true;
    }

