一、单链表 1.1 链表(Linked List)介绍 🔶 链表是有序的列表,但是它在内存中是存储如下: 链表是以节点的方式来存储,是链式存储。 每个节点包含 data 域, next 域:指向下一个节点。 如图:发现链表的各个节点不一定是连续存储。 链表分带头节点的链表和没有头节点的链表,根据实 ...
分类:
其他好文 时间:
2020-06-25 16:02:14
阅读次数:
61
方法1: 哈希表 时间复杂度:O(m+n) 空间复杂度:O(m)或O(n) class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def getIntersectionNode(sel ...
分类:
其他好文 时间:
2020-06-25 15:46:32
阅读次数:
40
经典冒泡排序算法 using System; using System.Threading.Tasks; namespace SingletonDemo { class Program { static void Main(string[] args) { int[] arr = new int[1 ...
分类:
编程语言 时间:
2020-06-25 15:42:50
阅读次数:
53
单链表 两种形式 结构体形式 : 申请新节点太慢 struct List { int data; List *next; } 数组模拟 代码模板 const int N = 1e6 + 10; int e[N], ne[N], head, idx; // 初始化:head存的是头结点下标,用idx分 ...
分类:
其他好文 时间:
2020-06-25 15:24:32
阅读次数:
68
Reversing Linked List Given a constant K and a singly linked list L, you are supposed to reverse the links of every K elements on L. For example, give ...
分类:
其他好文 时间:
2020-06-25 14:13:09
阅读次数:
56
''' 一、迭代器协议:1,对象必须提供一个next()方法 2,执行该方法,要么返回迭代中的下一项,要么引起一个StopIteration异常,以终止跌倒 二、可迭代对象, 实现了迭代器协议的对象 三、for循环的本质就是遵循迭代器协议去访问对象 四、字符串,列表,元组,字典,集合,文件这些均不限 ...
分类:
其他好文 时间:
2020-06-25 13:47:51
阅读次数:
50
v8node.js内存内存泄漏内存管理 原文链接:BlueSun | NodeJS中被忽略的内存 如朴灵说过,Node对内存泄露十分敏感,一旦线上应用有成千上万的流量,那怕是一个字节的内存泄漏也会造成堆积,垃圾回收过程中将会耗费更多时间进行对象扫描,应用响应缓慢,直到进程内存溢出,应用崩溃。 虽然从 ...
分类:
Web程序 时间:
2020-06-25 12:10:33
阅读次数:
117
#include <stdio.h> #include <stdlib.h> #define LEN sizeof(struct node) typedef struct node{ int data; struct node *next; }List; List *selectsort(List ...
分类:
其他好文 时间:
2020-06-25 10:12:54
阅读次数:
53
链表——增删改查 class Node(): def __init__(self, item): self.item = item self.next = None class Link(): def __init__(self): #构造一个空链表 #head存储只能是空或者第一个节点的地址 se ...
分类:
编程语言 时间:
2020-06-25 10:03:37
阅读次数:
83
Next Permutation (M) 题目 Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such a ...
分类:
其他好文 时间:
2020-06-25 09:57:33
阅读次数:
51