Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int main(int argc, char *argv[]) {
- TipoArvore a = NULL;
- TipoChave c,b,vetor[95],m;
- b = 'f';
- int i = 0, j, k, n;
- int min = 32, max = 126;
- while(b != '9') {
- scanf("%c", &b);
- vetor[i] = b;
- i++; // o contador esta sendo acrescido 2 vezes antes de dar scanf denovo... DISNEY
- printf("\n%d", i);
- }
- scanf("%c", &m); // Ta pulando esse scanf aqui.
- for(j = 0; j < i; j = j+2) {
- c = vetor[j];
- printf("Inserindo chave: %c\n", c); //esta printando esse printf duas vezes
- a = Insere(c, &a);
- Pesquisa(c,a);
- }
- Pesquisa(m,a);
- }
- ==========================================================================================
- Inserção na Patricia
- ==========================================================================================
- TipoArvore Insere(TipoChave k, TipoArvore *t)
- { TipoArvore p;
- int i;
- if (*t == NULL)
- return (CriaNoExt(k));
- else
- { p = *t;
- while (!EExterno(p))
- { if (Bit(p->NO.NInterno.Index, k) == 1)
- p = p->NO.NInterno.Dir;
- else p = p->NO.NInterno.Esq;
- }
- /* acha o primeiro bit diferente */
- i = 1;
- while ((i <= D) & (Bit((int)i, k) == Bit((int)i, p->NO.Chave)))
- i++;
- if (i > D)
- { printf("Erro: chave ja esta na arvore\n"); return (*t); }
- else return (InsereEntre(k, t, i));
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement