
数据结构
anniewwy
这个作者很懒,什么都没留下…
展开
-
Two Stacks In One Array
6-1 Two Stacks In One Array (20 分)Write routines to implement two stacks using only one array. Your stack routines should not declare an overflow unless every slot in the array is used.Format of f...原创 2018-11-08 19:22:20 · 358 阅读 · 0 评论 -
Quick Power
6-3 Quick Power (10 分)The function Power calculates the exponential function Nk. But since the exponential function grows rapidly, you are supposed to return (Nk)%10007instead.Format of func...原创 2018-11-08 22:49:07 · 2575 阅读 · 0 评论 -
二分查找中mid取值注意
如果用mid=(left+right)/2,在运行二分查找程序时可能溢出超时。因为如果left和right相加超过int表示的最大范围时就会溢出变为负数。所以如果想避免溢出,不能使用mid=(left+right)/2,应该使用mid=left+(right-left)/2。...原创 2019-03-25 09:44:27 · 3177 阅读 · 0 评论 -
数据结构课程设计——图结构
目录存储结构图的遍历相关算法及其应用存储结构邻接矩阵邻接表图的遍历深度优先遍历bool edg[100][100];bool visited[100];memset(edg, 0, sizeof(edg));memset(visited, 0, sizeof(visited));vector<int> result;int num;//节...原创 2019-05-20 11:12:43 · 1796 阅读 · 0 评论 -
DFS&BFS模板
#include <iostream>#include <cstdio>#include <cmath>#include <algorithm>#include <cstring>#include <vector>#include <queue>using namespace std;bool ...原创 2019-05-13 10:57:27 · 140 阅读 · 0 评论 -
690. Employee Importance
You are given a data structure of employee information, which includes the employee'sunique id, hisimportance valueand hisdirectsubordinates' id.For example, employee 1 is the leader of employe...原创 2019-05-28 18:11:25 · 149 阅读 · 0 评论