摘要: #include #include typedef int DataType; #include "LinList.h" void main() { SLNode *head_A,*head_B,*c,*pa,*pb,*pc; int i,j,x; ListInitiate(&head_A);//初始化链表a ListInsert(head_A,... 阅读全文
posted @ 2017-09-24 18:00 Reputation 阅读(2228) 评论(0) 推荐(0)
摘要: //单链表的结点定义 typedef struct Node { DataType data; struct Node *next; }SLNode; //初始化ListInitiate(SLNode **head) void ListInitiate(SLNode **head) { *head=(SLNode *)malloc(sizeof(SLNode)); ... 阅读全文
posted @ 2017-09-24 17:58 Reputation 阅读(453) 评论(0) 推荐(0)
摘要: 1 /*编写程序计算x^n,要求: 2 1输入整数x和n 3 2输出x^n的值 4 3思考算法是否可以进一步提升效率,如何提升? 5 4改进并实现算法,分析时间复杂度 6 */ 7 8 #include 9 using namespace std; 10 /* 11 //原始方法 12 原始方法的时间复杂度为 O(n) 13 double pow(int x,int n) 1... 阅读全文
posted @ 2017-09-21 15:40 Reputation 阅读(722) 评论(0) 推荐(0)