Пример #1
0
///교정(revision) 단어 사전에서 삭제
int tw2_rev_word_delete (BTREE* rs)
{
	char akey1[ASIZE], *pkey1;
	int	 c, cnt=0;
	register int i;
	bool deleted;

	while (1) {
		printf ("Word1: ");
		i = 0;
		while ((c = getchar()) != (int)'\n' && i < ASIZE-2)
			akey1[i++] = c;
		akey1[i] = '\0';

		if (i < 2 || i == ASIZE-2) break;
		pkey1 = str_lower (akey1);	//소문자로 변환
		pkey1 = str_trim (pkey1);	//앞뒤 whitespace 잘라냄
		if (! *pkey1) break;

		//리프노드로 이동하여 삭제
		//deleted = false;
		rs->root = bpt_delete (rs, pkey1, &deleted);
		if (deleted) {
			printf ("** Deleted.\n");
			cnt++;
		}
	} //while
	return cnt;
}
Пример #2
0
void  bpt_delete_check(bpt* b, long* xs, long n)
{
	long i;
	void* ptr;

	for (i = 0; i < n; i++) {
		ptr = bpt_delete(b, (void*) xs[i]);
		assert("delete failed:" && ptr && xs[i] == (long) ptr);
	}
}