自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(21)
  • 收藏
  • 关注

原创 FCAE110B1118213C密钥问题

记录一个问题解决方案:sudo apt-key adv --keyserver hkp://pool.sks-keyservers.net:80 --recv-keys FCAE110B1118213C

2020-10-13 00:12:33 259

原创 LeetCode 输入两个链表,找出它们的第一个公共节点。

ListNode* getIntersectionNode(ListNode* headA, ListNode* headB){ ListNode* A = headA; ListNode* B = headB; while (A != B) { if (A == NULL) A = headB; else { A = A->next; } if (B == NULL) B = headA; else { B = B->next;

2020-09-20 12:43:49 143

原创 LeetCode 链表中倒数第k个节点

ListNode* getKthFromEnd(ListNode* head, int k){ ListNode* former = head; ListNode* latter = head; for (int i = 0; i < k; i++) { former = former->next; } while (former != NULL) { former = former->next; latter = latter->next; } //

2020-09-19 21:57:14 103

原创 LeetCode 剑指 Offer 25 合并两个排序的链表

ListNode* mergeTwoLists(ListNode* l1, ListNode* l2){ int num1 = 0; int num2 = 0; ListNode* head = new ListNode(0); ListNode* currHead = head; //声明一个指向head结点的指针 while (l1!=NULL && l2!=NULL) { if (l1->val <= l2->val) { currHead

2020-09-19 16:58:39 77

原创 LeetCode03题,无重复字符最长子串

int lengthOfLongestSubstring(string s) { if (s.size() == 0) return 0; unordered_set<char> lookup; int maxStr = 0; int left = 0; for (int i = 0; i < s.size(); i++) { while (lookup.find(s[i]) != lookup.end()) { lookup.erase(s[left]); le

2020-09-19 12:58:45 96

原创 LeetCode 反转链表

LeetCode 反转链表#include <iostream>#include <cstring>#include <string>using namespace std;struct ListNode { int val; ListNode* next; ListNode(int x) : val(x), next(NULL) {}};void PrintList(ListNode* p){ while (p != NULL) { cou

2020-09-17 13:45:26 62

原创 LeetCode题目二 两数相加

给出两个 非空 的链表用来表示两个非负的整数。其中,它们各自的位数是按照 逆序 的方式存储的,并且它们的每个节点只能存储 一位 数字。如果,我们将这两个数相加起来,则会返回一个新的链表来表示它们的和。您可以假设除了数字 0 之外,这两个数都不会以 0 开头。来源:力扣(LeetCode)链接:https://leetcode-cn.com/problems/add-two-numbers#include <iostream>#include <cstring>#incl

2020-09-15 21:53:28 69

原创 LeetCode题目一 两数之和

LeetCode题目一 两数之和#include<iostream>#include<vector>#include<unordered_map>using namespace std;vector<int> twoSum(vector<int>& nums, int target) { vector<int> res; for (int i = 0; i < nums.size(); i++){

2020-06-15 16:44:48 91

原创 单链表+不带头节点

// 单链表(不带头结点).cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#includeusing namespace std;templateclass T>struct Node{ T data; Node *next;};templateclass T>class LinkList{public: Li

2018-01-17 12:34:28 241

原创 Prim+邻接矩阵储存

// TEXT.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include#include#includeusing namespace std;struct GraphNode //图结点{ string vertexName; //顶点名称 bool visited; //访问标记

2018-01-17 12:23:35 333

原创 栈+链式

// LinkStackMain.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include //引用输入输出流using namespace std;template class T>struct Node{ T data; Node *next; //此处也可以省略};template class T

2018-01-17 12:22:57 170

原创 队列+链式

// LinkQueueMain.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#includeusing namespace std;templateclass T>struct Node{ T data; Node *next;};templateclass T>class LinkQueue{public:

2018-01-17 12:22:24 153

原创 Kruskal算法+邻接矩阵

// Kruskal.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include#include#includeusing namespace std;struct EdgeNode{ int from; int to; int weight; friend bool operator//自

2018-01-17 12:21:44 2278

原创 哈夫曼树+哈夫曼编码

// HuffmanTree.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#includeusing namespace std;struct element{ int weight; char f; int lchild, rchild, parent;};void Select(element

2018-01-17 12:20:54 441

原创 图+链式

// Graph.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include#include #include #include using namespace std;struct ArcNode//定义弧表结点{ int adjVex;//邻接点域 int weight;//弧的权值 ArcN

2018-01-17 12:19:41 249

原创 栈+线性

// EXP2.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include //引用输入输出流using namespace std;const int StackSize = 10; //10只是示例性的数据,可以根据实际问题具体定义template class T> //定义模板类SeqStackclass

2018-01-17 12:18:50 220

原创 关键路径+拓扑排序+递归遍历顶点+广度优先遍历图+邻接储存

// CriticalPath.cpp : 定义控制台应用程序的入口点。//#include"stdafx.h"#include#include#include #include #include using namespace std;struct ArcNode//定义弧表结点{ int adjVex;//邻接点域 int weight;//弧的权值

2018-01-17 12:17:07 469

原创 循环队列

// CircleQueueMain.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#includeusing namespace std;const int QueueSize = 100; //定义存储队列元素的数组的最大长度 template class T> //定义模板类 CirQueue class CirQueu

2018-01-17 12:15:09 252

原创 二叉树(前序遍历+中序遍历+后序遍历)递归

// BinaryTree.cpp : 定义控制台应用程序的入口点。//#include "stdafx.h"#include#include #includeusing namespace std;template class T>struct BiNode //二叉树的结点结构{ T data; BiNode *lchild, *rchild;};t

2018-01-16 22:59:34 578

原创 平衡二叉树AVLTree

// AVLTree.cpp : 定义控制台应用程序的入口点。//#include"stdafx.h"#include iostream>using namespace std;template class T>struct AVLTreeNode{ T data;//平衡二叉树结点值 int BF;//结点平衡因子 //平衡二叉树结点左右孩子指

2018-01-16 22:46:33 289

原创 单链表 尾插入法

数据结构 单链表+尾插入构造函数

2017-10-19 21:22:41 1130

空空如也

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除