Wednesday's data structures must homework

1—5: CAACC

6-8: BCB

9: (1)F、C

    (2)B、I、A、G

10: A

11—14: BBBC

 

algorithm design

Palindrome judge

#include <stdio.h>
#include <string.h>

#define LENGTH 20
int main()
{
    printf("请输入字符序列:\n");
    char a;
    char arr[LENGTH];
    int size=-1;
    scanf("%c", &a);
    while(a!='@')
    {
        arr[++size]=a;
        scanf("%c", &a);
    }
    getchar();
    for ( int I = 0 ; I <(size + . 1 ) / 2 ; I ++ ) 
    { 
        IF (! ARR [I] = ARR [size- I]) 
        { 
            the printf ( " not a palindrome " );
             return  0 ; 
        } 
    } 
    the printf ( " palindromic " );
     return  0 ; 
}

Insert queue

void EnQueue(Lnode *rear, ElemType e)
{
  Lnode *p;
  p->data=e;
  p->next=rear->next;
  rear->next=p;
  rear=p;
}

 

Guess you like

Origin www.cnblogs.com/angoli/p/12652976.html