## 页首HTML代码 ```html

线性表

数据结构

代码--线性表

image

    
#define N 10
typedef struct Node
{
 int data;
 struct Node*next;
}NODE;
int Get_Data(int i);		//定义省略
Node*Create_u()
{
 int i;
 NODE*p,*Head=NULL;
 for(i=0;i<N;i++)
 {
  	VP=New NODE;
  	P->Data=Get_Data(i);
     _______①_________;
  	________②________;
 }
 return Head;
}

①:p->next=Head

②:Head=p

image

    N个结点链表,每个结点中存放一个字符,判断链表存放的字符是否中心对称,即a b c c b a或a b c b a,补充程序:
typedef struct Node
{
 	int data;
 	struct Node*next;
}NODE;

bool Is_symmeic(NODE*head,*int n)
{
 	char D[N];
 int i,d;
 ____①______;
 for(i=0; i<d; i++)
 {
  		D[i]=head->data;
 		head=head->next;
 }
 	if(_____②_____)
{
  		head=head->next;
 	}
 	while(head)
 	{
  		______③_________;
  		if(D[i]!=head->data)
  		{
   			return false;
  		}
 		 head=head->next;
 	}
 	return true;
}

①:NODE*head=head

②:n % 2 == 1

③:d--

posted @ 2024-05-05 23:24  一面小镜子  阅读(33)  评论(0)    收藏  举报