博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
静态链表——sharing
阅读量:4216 次
发布时间:2019-05-26

本文共 605 字,大约阅读时间需要 2 分钟。

在这里插入图片描述

#include
const int maxn = 100010;struct NODE{
char data; int next; bool flag;}node[maxn]; int main(){
for(int i = 0; i < maxn; i++) {
node[i].flag = false; } int s1, s2, n; scanf("%d%d%d", &s1, &s2, &n); int address, next; char data; for(int i = 0; i < n; i++) {
scanf("%d %c %d", &address, &data, &next); node[address].data = data; node[address].next = next; } int p; for(p = s1; p != -1; p = node[p].next) {
node[p].flag = true; } for(p = s2; p != -1; p = node[p].next) {
if(node[p].flag == true) break; } if(p != -1) printf("%05d", p); else printf("/n"); return 0;}

转载地址:http://dhtmi.baihongyu.com/

你可能感兴趣的文章
算法专题训练(2)小偷问题
查看>>
八大排序算法
查看>>
算法专题训练(3)回文字符串
查看>>
机器学习面试题整理
查看>>
Leetcode Math知识点总结
查看>>
集成学习专题之GBDT面试
查看>>
过拟合、欠拟合、正则化
查看>>
LS-PLM学习笔记
查看>>
Leetcode DFS知识点总结
查看>>
Leetcode Array知识点总结
查看>>
Leetcode TwoPointer知识点总结
查看>>
Leetcode Binary Search 知识点总结
查看>>
Leetcode Hash Table知识点总结
查看>>
Leetcode Shell 编程
查看>>
树模型特征重要性评估方法
查看>>
Leetcode Array 知识点总结
查看>>
Leetcode Tree 知识点总结
查看>>
Leetcode String 知识点总结
查看>>
深度学习CTR模型粗略记录
查看>>
深度学习CTR模型读书笔记-阿里十亿级商品嵌入方法
查看>>