数据结构学习
皓月南游
生活不是一种宿命,而是一种选择。
展开
-
C++实现大数计算--复习
今天做到一个用到大数的题目,复习一下。这是我参考的博客->参考来源链接#include <iostream>using namespace std;#include <cstdio>#include <cstring>//大数加法 void calAdd(char* A, char* B, char* res){ int lenA = strlen(A); int lenB = strlen(B); int i = lenA-1, j = le转载 2021-05-21 17:21:33 · 191 阅读 · 0 评论 -
单链表的实现
代码如下:#include "stdio.h"#include "stdlib.h"typedef struct LNode { //定义单链表结点类型 int data; //每个节点存放一个数据元素 struct LNode *next; //指针指向下一个结点} LNode, *LinkList;//初始化一个单链表(带头结点)bool InitList(LinkList &L) { L = (LNode *)malloc(sizeof(LNode));//分配一个头结原创 2020-10-15 18:59:59 · 97 阅读 · 0 评论 -
冒泡排序,插入排序,希尔排序
排序方法:#include "iostream"using namespace std;int a[] = {10, 4, 8, 5, 9, 7, 1};int len = sizeof(a)/sizeof(int);void show(){ for(int i = 0; i < len; i++) cout << a[i] << " "; cout << endl;}//冒泡排序 void msort(int a[]){ for(int原创 2020-10-10 15:59:19 · 65 阅读 · 0 评论