void buscar(DEQUE *l){ TIPOCHAVE ch; scanf("%d",&ch); PONT posicao = buscaSeq(ch,l); if (posicao != NULL) printf("Elemento %d encontrado no endereco %d.\n",ch,posicao); else printf("Nao foi possivel encontrar elemento %d.\n",ch); }
bool excluir (TIPOCHAVE ch, LISTA* l) { int ant,i; i = buscaSeq(ch,l,&ant); if (i==NUL) return false; if (ant == NUL) l->inicio = l->A[i].prox; else l->A[ant].prox = l->A[i].prox; l->A[i].prox = l->dispo; l->dispo = i; return true; }
bool inserirOrd(REGISTRO reg, LISTA* l) { if (l->dispo == NUL) return false; int ant,i; i = buscaSeq(reg.chave,l,&ant); if (i!=NUL) return false; i = l->dispo; l->dispo = l->A[l->dispo].prox; l->A[i] = reg; if (ant == NUL) { l->A[i].prox = l->inicio; l->inicio = i; } else { l->A[i].prox = l->A[ant].prox; l->A[ant].prox = i; } return true; }