给定一个单链表,把所有的奇数节点和偶数节点分别排在一起。请注意,这里的奇数节点和偶数节点指的是节点编号的奇偶性,而不是节点的值的奇偶性。 请尝试使用原地算法完成。你的算法的空间复杂度应为 O(1),时间复杂度应为 O(nodes),nodes 为节点总数。 示例 1: 输入: 1->2->3->4- ...
分类:
其他好文 时间:
2020-04-19 15:14:33
阅读次数:
60
题目链接:https://leetcode cn.com/problems/diao zheng shu zu shun xu shi qi shu wei yu ou shu qian mian lcof/ 双指针 ...
分类:
编程语言 时间:
2020-04-19 14:46:18
阅读次数:
64
一个分布式系统最多只能同时满足一致性(Consistency)、可用性(Availability)和分区容错性(Partition tolerance)这三项中的两项。 Consistency 一致性是指 “all nodes see the same data at the same time.” ...
分类:
其他好文 时间:
2020-04-19 13:19:17
阅读次数:
70
有时候生产会发现,运行一段时间swap就会飙升,而且不下来,其实内存这个东西,怎么说够用不够用呢,看下swap就行,如果这个swap长时间动态平衡之后又增加,那么估计是有问题。 有关/proc/sys/vm/drop_caches的用法在下面进行了说明/proc/sys/vm/drop_caches(sinceLinux2.6.16)Writingtothisfi
分类:
系统相关 时间:
2020-04-19 13:11:41
阅读次数:
67
内存映射文件的方法 Windows采用MapViewOfFile系统api,Linux则采用mmap相关函数。之前在做大数据查询计算的时候,经常会出现内存不足的情况,malloc无法分配内存了。那时候就经常在想能不能使用硬盘来充当内存,就像swap交换那样,硬盘是非常大的,如果能使用硬盘来当内存也许 ...
分类:
其他好文 时间:
2020-04-19 11:12:46
阅读次数:
69
设置ip、 开启远程 设置静态IP 修改root密码/开启ssh服务 创建分区、格式化、 挂载 分区(选择自己喜欢的类型,对于我们这种辣鸡菜鸟建议一般建立3个挂载点[/boot( 300M),/( 30G),swap(内存x2)]就足够了。这里是lvm方式 格式化、 挂载 修改国内源 开始安装(按需 ...
分类:
系统相关 时间:
2020-04-18 15:33:12
阅读次数:
98
Problem : Given a non negative integer, you could swap two digits at most once to get the maximum valued number. Return the maximum valued number you ...
分类:
其他好文 时间:
2020-04-18 13:33:58
阅读次数:
75
Problem : You are given n pairs of numbers. In every pair, the first number is always smaller than the second number. Now, we define a pair (c, d) can ...
分类:
其他好文 时间:
2020-04-18 10:09:19
阅读次数:
67
我们每个程序员或许都有一个梦,那就是成为大牛,我们或许都沉浸在各种框架中,以为框架就是一切,以为应用层才是最重要的,你错了。在当今计算机行业中,会应用是基本素质,如果你懂其原理才能让你在行业中走的更远,而计算机基础知识又是重中之重。下面,跟随我的脚步,为你介绍一下计算机底层知识。
分类:
其他好文 时间:
2020-04-17 17:18:41
阅读次数:
99
In the wilds far beyond lies the Land of Sacredness, which can be viewed as a tree — connected undirected graph consisting of nn nodes and n?1n?1 edge ...
分类:
其他好文 时间:
2020-04-17 00:11:27
阅读次数:
66