bool identical(node *root1,node *root2){ if(root1==NULL && root2==NULL) return true; if(root1==NULL || root2==NULL) return false; if(root1->data!=root2->data) return false; return identical(root1->left,root2->left) && identical(root1->right,root2->right); }
bool identical(node* a, node*b){ if(a == NULL && b == NULL)return 1; if(a != NULL && b != NULL){ return(identical(a->right, b->right) && identical(a->left, b->left) && (a->data == b->data) ); } return 0; }
namespace named_arithmetic5 { constexpr auto n = fixed_point<uint32_t, -16>{1}; constexpr auto d = fixed_point<uint32_t, -16>{2}; constexpr auto q1 = n/d; static_assert(identical(q1, fixed_point<uint64_t, -32>{0.5}), "Incorrect information in proposal section, Named Arithmetic Functions"); constexpr auto q2 = divide(n, d); static_assert(identical(q2, fixed_point<uint32_t, 0>{0}), "Incorrect information in proposal section, Named Arithmetic Functions"); }
bool identical ( BiTree p , BiTree q ) { if ( p == NULL && q == NULL ) return true ; else if (p == NULL ) return false ; else if (q == NULL ) return false ; else if ( p->digit != q->digit ) return false ; else return ( identical ( p->left_child , q->left_child ) && identical ( p->right_child , q->right_child ) ); }
int main(void) { int i , n ; char input[15] ; BiTree control_group = NULL ; // 对照组 BiTree experimental_group = NULL ; // 实验组 while ( scanf ( "%d" , &n ) , n ) { scanf ( "%s" , input ) ; for ( i = 0 ; input [i] != '\0' ; i ++ ) InsertBST ( control_group , input[i] ); while ( n -- ) { scanf ( "%s" , input ) ; for ( i = 0 ; input [i] != '\0' ; i ++ ) InsertBST ( experimental_group , input[i] ) ; if ( identical ( control_group , experimental_group ) ) puts ( "YES" ) ; else puts ( "NO" ) ; if ( experimental_group != NULL ) { delete experimental_group ; experimental_group = NULL ; } } if ( control_group != NULL ) { delete control_group ; control_group = NULL ; } } return 0 ; }
int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) { unsigned long flags; struct atm_dev_addr **walk; int error; error = check_addr(addr); if (error) return error; spin_lock_irqsave(&dev->lock, flags); for (walk = &dev->local; *walk; walk = &(*walk)->next) if (identical(&(*walk)->addr,addr)) { spin_unlock_irqrestore(&dev->lock, flags); return -EEXIST; } *walk = kmalloc(sizeof(struct atm_dev_addr), GFP_ATOMIC); if (!*walk) { spin_unlock_irqrestore(&dev->lock, flags); return -ENOMEM; } (*walk)->addr = *addr; (*walk)->next = NULL; spin_unlock_irqrestore(&dev->lock, flags); notify_sigd(dev); return 0; }
namespace named_arithmetic3 { constexpr auto f = fixed_point<unsigned, -28>{15.9375}; constexpr auto p = multiply(f, f); static_assert(identical(p, fixed_point<uint64_t, -56>{254.00390625}), "Incorrect information in proposal section, Named Arithmetic Functions"); }
namespace named_arithmetic4 { constexpr auto a1 = fixed_point<int8_t, 32>{0x7f00000000LL}; constexpr auto a2 = fixed_point<int8_t, 0>{0x7f}; constexpr auto s = add(a1, a2); static_assert(identical(s, fixed_point<int64_t, 0>{0x7f0000007fLL}), "Incorrect information in proposal section, Named Arithmetic Functions"); }
int main(int argc, const char * argv[]) { int n, i, len, key; unsigned char c; node *x, *y; node *hashtable[HASHPRIME] = {}; for (scanf("%i%*c", &n); n; --n) { x = (node *)malloc(sizeof(node)); for (i=0; i<6; ++i) { for (len=0; c=getchar()-'0', c<10; ) len = len*10+c; x->value[i] = len; } key = hash(x->value); for (y=hashtable[key]; y; y=y->next) { if (identical(x->value, y->value)) { puts("Twin snowflakes found."); return 0; } } x->next = hashtable[key]; hashtable[key] = x; } puts("No two snowflakes are alike."); return 0; }
/* searches for a synonym in the vocabulary file. * if a synonym is found - it returns it. * if not - the original word is returned */ char* find_synonym(char* word) { char* curword = malloc(MAX_WORD_LENGTH); char* prevword = malloc(MAX_WORD_LENGTH); if(curword == NULL || prevword == NULL) { return NULL; } FILE* prevwordp; if((prevwordp = fopen(vocab_file_name, "r")) == NULL) { return NULL; } rewind(vocab_file); while(fscanf(vocab_file, "%s ", curword) != EOF) { if(identical(curword+1, word) == true) /* curword points to the id (0 or 1) */ { if((curword)[0] == '0') { fscanf(vocab_file, "%s ", curword); free(prevwordp); return (curword+1); } else { free(prevwordp); return (prevword+1); } } fscanf(prevwordp, "%s ", prevword); } free(prevword); return word; }
// Here is a C program using recursion int identical( struct node* a , struct node* b ) { if ( a == NULL && b == NULL ) { return ( true ); } else if ( a != NULL && b != NULL ) { return( a -> data == b -> data && identical( a -> left , b -> left ) && identical( a -> right, b -> right ) ); } else return(false); }
int identical(struct node *root,struct node *dummy) { int rv; if(root != NULL && dummy != NULL) { printf("###"); rv =identical(root->left,dummy->left); if(rv == -1) return -1; if(root->data != dummy->data) return -1; rv =identical(root->right,dummy->right); if(rv == -1) return -1; } else if (root != NULL && dummy == NULL) return -1; else if (root == NULL && dummy != NULL) return -1; else return 0; }
int main() { /*create root*/ struct node *root = newNode(1); struct node *dummy; dummy=root; /* following is the tree after above statement 1 / \ NULL NULL */ root->left = newNode(2); root->right = newNode(3); /* 2 and 3 become left and right children of 1 1 / \ 2 3 / \ / \ NULL NULL NULL NULL */ root->left->left = newNode(4); /* 4 becomes left child of 2 1 / \ 2 3 / \ / \ 4 NULL NULL NULL / \ NULL NULL */ if(identical(root,dummy) == 0) printf("ientical"); else printf("diff"); return 0; }
static void prune_overrides_by_id (MateComponentUIXml *tree, MateComponentUIXmlData *data, gpointer id) { GSList *l, *next; for (l = data->overridden; l; l = next) { MateComponentUIXmlData *o_data; next = l->next; o_data = matecomponent_ui_xml_get_data (tree, l->data); if (identical (tree, o_data->id, id)) { node_free (tree, l->data); data->overridden = g_slist_remove_link (data->overridden, l); g_slist_free_1 (l); } } }
int main() { #ifdef LOCAL freopen("input.in", "r", stdin); freopen("output.out", "w", stdout); #endif int convert[12][6] = { {1,2,3,4,5,6}, {1,3,5,2,4,6}, {1,5,4,3,2,6}, {1,4,2,5,3,6}, {5,1,3,4,6,2}, {5,3,6,1,4,2}, {5,6,4,3,1,2}, {5,4,1,6,3,2}, {3,2,6,1,5,4}, {3,1,2,5,6,4}, {3,5,1,6,2,4}, {3,6,5,2,1,4} }; char line[15]; while(scanf("%s", line)>0) { char temp[6]; int id = 0; for(int i = 0; i < 12; i++) { for(int j = 0; j < 6; j++) { temp[j] = line[convert[i][j]-1]; } if(identical(temp, line+6)) { printf("TRUE\n"); id = 1; break; } } if(!id) { printf("FALSE\n"); } } return 0; }
int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) { struct atm_dev_addr **walk,*this; int error; error = check_addr(addr); if (error) return error; down(&local_lock); for (walk = &dev->local; *walk; walk = &(*walk)->next) if (identical(&(*walk)->addr,addr)) break; if (!*walk) { up(&local_lock); return -ENOENT; } this = *walk; *walk = this->next; kfree(this); up(&local_lock); notify_sigd(dev); return 0; }
int main(){ int a[]={20,8,22,4,12,10,14}; int n=sizeof(a)/sizeof(a[0]); int i; node *root1=NULL,*root2=NULL; for(i=0;i<n;i++) root1=insert(root1,a[i]); for(i=0;i<n;i++) root2=insert(root2,a[i]); //root1->left->left=createNode(19); printf("\nInorder traversals are...\n"); inorder(root1); printf("\n"); inorder(root2); if(identical(root1,root2)) printf("\nYes the trees are identical"); else printf("\nNo the trees are not identical!!!"); printf("\n"); return 0; }
//************************************* uint8_t vidHardPDRemoval::configure (AVDMGenericVideoStream * in) { _in=in; #define PX(x) &(_param->x) diaElemUInteger thresh(PX(threshold),QT_TR_NOOP("_Threshold:"),0,99, QT_TR_NOOP("If value is smaller than threshold it is considered valid." " Smaller value might mean more false positive")); diaElemUInteger noise(PX(noise),QT_TR_NOOP("_Noise:"),0,99,QT_TR_NOOP("If pixels are closer than noise, they are considered to be the same")); diaElemUInteger identical(PX(identical),QT_TR_NOOP("_Identical:"),0,99,QT_TR_NOOP("If metric is less than identical, images are considered identical")); diaElemToggle show(PX(show),QT_TR_NOOP("_Show metrics"),QT_TR_NOOP("Show metric in image (debug)")); diaElem *elems[]={&thresh,&noise,&identical,&show}; if( diaFactoryRun(QT_TR_NOOP("Hard IVTC Removal"),sizeof(elems)/sizeof(diaElem *),elems)) { _lastRemoved=0xFFFFFFF; return 1; } return 0; }
int main(){ struct node *root1 = newnode(1); struct node *root2 = newnode(1); root1->left = newnode(2); root1->right = newnode(3); root1->left->left = newnode(4); root1->left->right = newnode(5); root2->left = newnode(2); root2->right = newnode(3); root2->left->left = newnode(4); root2->left->right = newnode(5); if(identical(root1, root2)) printf("Both tree are identical."); else printf("Trees are not identical."); printpostorder(root1); printf("%s", "\n"); return 0; }
int atm_del_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) { unsigned long flags; struct atm_dev_addr **walk,*this; int error; error = check_addr(addr); if (error) return error; spin_lock_irqsave(&dev->lock, flags); for (walk = &dev->local; *walk; walk = &(*walk)->next) if (identical(&(*walk)->addr,addr)) break; if (!*walk) { spin_unlock_irqrestore(&dev->lock, flags); return -ENOENT; } this = *walk; *walk = this->next; kfree(this); spin_unlock_irqrestore(&dev->lock, flags); notify_sigd(dev); return 0; }
bool identical(const Meta_Class* mc1, const Meta_Class* mc2) { if (!_identical_base(mc1, mc2)) return false; for (size_t i = 0; i < mc1->num_meta_features; i++) if (mc1->locals[i].local != mc2->locals[i].local) return false; if (!mc1) return true; if (mc1->super_meta_class && mc2->super_meta_class) { if (!identical(mc1->super_meta_class, mc2->super_meta_class)) return false; } if (mc1->num_keys != mc2->num_keys) return false; // Identical: return true; }
int atm_add_addr(struct atm_dev *dev,struct sockaddr_atmsvc *addr) { struct atm_dev_addr **walk; int error; error = check_addr(addr); if (error) return error; down(&local_lock); for (walk = &dev->local; *walk; walk = &(*walk)->next) if (identical(&(*walk)->addr,addr)) { up(&local_lock); return -EEXIST; } *walk = kmalloc(sizeof(struct atm_dev_addr),GFP_KERNEL); if (!*walk) { up(&local_lock); return -ENOMEM; } (*walk)->addr = *addr; (*walk)->next = NULL; up(&local_lock); notify_sigd(dev); return 0; }
bool conflict(const vclock& o) { return concurrent(o) && !identical(o); }
bool operator != (const vclock& o) const { return !identical(o); }
/** @brief NA aware equality operator. * * Returns NA if either or both operands are NA. Otherwise returns * whether or not the two values are equal. */ Logical equals(Logical other) const { return (isNA() || other.isNA()) ? NA() : identical(other); }
int MaskAuto::operator==(MaskAuto &that) { return identical((MaskAuto*)&that); }
} } static void merge (MateComponentUIXml *tree, MateComponentUINode *current, MateComponentUINode **new); static void override_node_with (MateComponentUIXml *tree, MateComponentUINode *old, MateComponentUINode *new) { MateComponentUIXmlData *data = matecomponent_ui_xml_get_data (tree, new); MateComponentUIXmlData *old_data = matecomponent_ui_xml_get_data (tree, old); gboolean same, transparent, override; /* Is it just a path / grouping simplifying entry with no content ? */ transparent = matecomponent_ui_node_transparent (new); same = identical (tree, data->id, old_data->id); g_assert (data->id); override = !same && !transparent; if (override) { g_signal_emit (tree, signals [OVERRIDE], 0, new, old); data->overridden = g_slist_prepend (old_data->overridden, old); prune_overrides_by_id (tree, data, data->id); } else { if (transparent) data->id = old_data->id;
int Edit::operator==(Edit &edit) { return identical(edit); }
int KeyFrame::operator==(Auto &that) { return identical((KeyFrame*)&that); }
int KeyFrame::operator==(KeyFrame &that) { return identical(&that); }