数据结构 线性表
来源:互联网 发布:淘宝开通子账号未认证 编辑:程序博客网 时间:2024/06/07 16:24
#include<cstdio>#include<iostream>#define len 1010using namespace std;typedef struct seqlist{ int data[len]; int length;}seqlist;int x;seqlist *insert(seqlist *p,int pos){ for(int i = p->length-1; i >= pos; i--) p->data[i+1] = p->data[i]; scanf("%d",&p->data[pos]); p->length++; return p;}seqlist *del(seqlist *p,int pos){ for(int i = pos; i < p->length-1; i++) p->data[i] = p->data[i+1]; p->length--; return p;}void edit(seqlist *p,int pos){ scanf("%d",&x); p->data[pos] = x;}int search(seqlist *p,int pos){ return p->data[pos];}int main(){ int n,pos; while(scanf("%d",&n)!=EOF) { seqlist *p,s; p=&s; p->length = n; for(int i = 0; i < p->length; i++) scanf("%d",&p->data[i]); scanf("%d",&pos); p = insert(p,pos); for(int i = 0; i < p->length; i++) printf("%d ",p->data[i]); printf("\n"); p = del(p,pos); for(int i = 0; i < p->length; i++) printf("%d ",p->data[i]); printf("\n"); edit(p,pos); for(int i = 0; i < p->length; i++) printf("%d ",p->data[i]); printf("\n"); printf("%d\n",search(p,pos)); } return 0;}
0 0
- 数据结构拾遗---线性表
- 整理--数据结构--线性表
- 数据结构(线性表)
- 整理--数据结构--线性表
- 数据结构--顺序线性表
- 数据结构之线性表
- 数据结构-线性链表
- 数据结构-线性表
- 复习 [数据结构] ---- 线性表
- 数据结构---线性表
- 数据结构复习-线性表
- 数据结构之线性表
- 数据结构之线性表
- 线性链表---数据结构
- 数据结构—线性表
- 数据结构 线性表
- 数据结构----线性表
- 数据结构之线性表
- 杭电OJ-1000
- 1172 Hankson 的趣味题
- VIM按键布局及配置
- C++程序设计:生存期
- 用Python爬取学院的新闻并通过邮件发送
- 数据结构 线性表
- URL特殊字符需转义
- 洛谷3379 最近公共祖先
- LeetCode OJ---234. Palindrome Linked List
- Maven常用命令
- python+beautifulsoup爬取豆瓣电影TOP250
- 二、创建线程的几种方式
- 阅读论文
- 【拼接最小字典序字符串】(python)