
数据结构
elorole
细磨专研
展开
-
洛谷 P1996 约瑟夫问题(链表或数组模拟)
题目链接:https://www.luogu.org/problemnew/show/P1996 以下提供两种思路,一种是纯模拟(题目数据小,只有100),一种是链表(貌似还是模拟哈哈) 1.上代码#include <iostream>#include <cstdio>#include <cstring>#include <cmath>...原创 2018-03-31 14:07:17 · 608 阅读 · 0 评论 -
例题6-8 Tree UVa548
题目描述: You are to determine the value of the leaf node in a given binary tree that is the terminal node of a path of least value from the root of the binary tree to any leaf. The value of a path is t...原创 2018-04-02 19:43:16 · 169 阅读 · 0 评论 -
洛谷 P1449 后缀表达式(用数组模拟栈)
题目链接:https://www.luogu.org/problemnew/show/P1449 题目思路:由题目意思可以想到用栈的思想来做,具体操作是遇到数字压入栈,遇到运算符就弹出两个被操作的数并将运算的结果压入栈。最后在栈底元素就是表达式的值。 代码如下:(采用数组模拟栈的方法)#include <iostream>#include <cstdio>#in...原创 2018-04-10 22:41:16 · 265 阅读 · 0 评论 -
洛谷 P1160 队列安排(双向链表)
题目链接:https://www.luogu.org/problemnew/show/P1160 题意:对数组进行插入删除操作,很用以就想到用链表。 本人习惯用数组模拟链表;代码如下:#include <iostream>#include <cstdio>#include <cmath>#include <cstring>#inclu...原创 2018-04-07 12:54:43 · 463 阅读 · 0 评论