线性表
- 2021-9-14【数据结构/严蔚敏】【顺序表】【代码实现算法2.1-2.7】
- 2021-9-18【数据结构/严蔚敏】【单链表】【代码实现算法2.8-2.12】
- 2021-9-18【数据结构/严蔚敏】【静态链表】【代码实现算法2.13-2.17】
- 2021-9-19【数据结构/严蔚敏】【双向链表】【代码实现算法2.18-2.19】
- 2021-9-19【数据结构/严蔚敏】【带头结点的线性表】【代码实现算法2.20-2.21】
- 2021-9-19【数据结构/严蔚敏】【一元多项式的表示及相加、相减、相乘】【代码实现算法2.22-2.23】
- 2021-9-23【数据结构】【单链表逆置】
- 2021-9-23【数据结构】【顺序表逆置】
栈&队列
- 2021-9-22【数据结构/严蔚敏】【顺序栈&链式栈&迷宫求解&表达式求值】【代码实现算法3.1-3.5】
- 2021-9-27【数据结构/严蔚敏】【链队列】
- 2021-9-28【数据结构/严蔚敏】【循环队列】
串
二叉树
持续更新中,尽请期待!!!
#include<iostream>
using namespace std;
typedef char datatype;
typedef struct node
{
datatype data;
struct node *next;
} Lnode, *linklist;
void creat(linklist &head)
{
char ch;
linklist s,r;
head = new Lnode;
r=head;
while((ch=getchar())!='*')//到“ * ”结束
{
s = new Lnode;
s->data=ch;
r->next=s;
r=s;
}
r->next=NULL;
}
void invert(linklist &head)
{
linklist p, q, r;
p=head->next;
q=p->next;
while(q!=NULL)
{
r=q->next;
q->next=p;
p=q;
q=r;
}
head->next->next=NULL;
head->next=p;
}
void print(linklist &head)
{
linklist p=head->next;
while(p!=NULL)
{
cout<<p->data<<" ";
p=p->next;
}
cout<<endl;
}
int main()
{
linklist head;
creat(head);
print(head);
invert(head);
print(head);
return 0;
}