void mid_thread_trav(Node *root){ root = find_left(root); while (root != NULL){ printf("%c ", root->data); if (root->right->tag == CHILD){ root = root->right->child; root = find_left(root); } else if(root->right->tag == LINK){ root = root->right->child; } } }
/** @return the next smallest number */ int next() { TreeNode *t = s.top(); s.pop(); if(t->right) find_left(t->right); return t->val; }
int main() { int max; int left; printf("\033[40;33mplease input the num of people:\033[0m\n"); scanf("%d",&max); /* 输入人数 */ int a[max]; left = find_left(a,max); /* 函数调用 */ printf("\033[40;33mthe last one's num is %d.\033[0m\n",left); return 0; }
int main(int argc, const char *argv[]) { #ifdef DB fp = fopen("input", "r"); #endif int n, len, i, flag; long long x, y; char *p; /* polynomial */ while (fgets(expr, SIZE, fp) != NULL) { len = strlen(expr) - 1; /* '\n' followed */ for (p = find_left(expr + len - 1), n = 0; p >= expr; ) { sscanf(p, "%lld", &polynomial[n++]); if (p - 1 <= expr) break; p = find_left(p - 1); } /* x0 .. xm */ fgets(expr, SIZE, fp); len = strlen(expr) - 1; for (p = expr, flag = 0; p < expr + len; ) { sscanf(p, "%lld", &x); for (i = 0, y = 0; i < n; ++i) { if (i >= 2) x *= x; if (!i) y += polynomial[0]; else y += polynomial[i] * x; } if (!flag) {printf("%lld", y); flag = 1;} else printf(" %lld", y); if (p < expr + len) p = find_right(p); else break; } memset(expr, 0, SIZE); putchar('\n'); } return 0; }
/*** ConvexHull::contains_point * In order to test whether a point is inside a convex hull we can travel once around the outside making * sure that each triangle made from an edge and the point has positive area. */ bool ConvexHull::contains_point(Point p) { return find_left(p) == -1; }
BSTIterator(TreeNode *root) { find_left(root); }