• 2022-06-29
    下列文法哪个是左递归的?
    A: G[S]: S->aSb|a
    B: G[S]: S->Sa|a
    C: G[S]: S->aS|a
    D: G[S]: S->Ab|a A->Bb|c B->Sc|d
  • B,D

    内容

    • 0

      下列文法中,生成的语言是[img=219x36]1803958e27bf0a1.png[/img]的是 A: G(S): S → ABCD A → aA | a B → bB | b C → cC | c D → dD | d B: G(S): S → AC A → aAb | ab C → cCd | cd C: G(S): S → aSd | A A → bAc | bc D: G(S): S → aSb | A A → cAd | cd

    • 1

      下列文法中,生成的语言是[img=219x36]18036d67930bcbe.png[/img]的是 A: G(S): S → ABCD A → aA | a B → bB | b C → cC | c D → dD | d B: G(S): S → AC A → aAb | ab C → cCd | cd C: G(S): S → aSd | A A → bAc | bc D: G(S): S → aSb | A A → cAd | cd

    • 2

      二叉排序树采用二叉链表存储,结点结构为:lchild|data|rchild,指针lchild和rchild分别指向结点的左右孩子结点。令T指向根结点,则求T的左子树上最大的结点算法的核心语句是( )。 A: if (T) { s=T->lchild;if (s) { while(s->rchild) s=s->rchild; }}return s; B: if (T) { s=T->rchild;if (s) { while(s->rchild) s=s->rchild; }}return s; C: if (T) { s=T->rchild;if (s) { while(s->lchild) s=s->lchild; }}return s; D: if (T) { s=T->lchild;if (s) { while(s->lchild) s=s->lchild; }}return s;

    • 3

      在循环双链表的P所指节点之后插入s所指节点的操作是( ) A: p->next=s; s->prior=p; p->next->prior=s; s->next=p->next; B: p->next=s; p->next->prior=s; s->prior=p; s->next=p->next; C: s->prior=p; s->next=p->next; p->next=s; p->next->prior=s; D: s->prior=p; s->next=p->next; p->next=s;p->next->prior=s;

    • 4

      在循环双链表的p所指结点之后插入s结点的操作是( ) A: p->next=s; s->pre=p; p->next->pre=s; s->next=p->next; B: p->next=s; p->next->pre=s; s->pre=p; s->next=p->next; C: s->pre=p; s->next=p->next; p->next->pre=s; p->next=s; D: s->pre=p; s->next=p->next; p->next=s; p->next->pre=s;