方法思路是先比较链表一和链表二的第一个元素的值,将值较小的连接到主链表上,假定链表一的值小,那么链表一的指针后移,让链表一的第二个元素和链表二的第一个元素比较,以此类推。 public class MergeLinkedList { public static void main(String[] Read More
posted @ 2021-04-14 22:17
imissinstagram
Views(99)
Comments(0)
Diggs(0)
单向链表反转的方法代码: public void reverseList(Node head) { //如果单向链表为空,或者只有一个节点,无需反转,直接返回 if (head.next == null || head.next.next == null) { return; } //定义一个辅助指 Read More
posted @ 2021-04-14 15:11
imissinstagram
Views(294)
Comments(0)
Diggs(0)
需要注意以下两点: 如果你使用的是https://github.com/BruceZhaoR/Zh-beamer提供的模版,切记把文件beamer_default.tex里面 \usepackage{xecjk} 改成 \usepackage{xeCJK} 如果你使用macOS且用了https:// Read More
posted @ 2021-04-14 00:30
imissinstagram
Views(171)
Comments(0)
Diggs(0)
环形队列可以用图示阐明: 当用数组去构建环形队列的时候,数组初始化完成后,其实环形队列各位置的索引就已经确定了。所以在写环形队列的增删改查时需要考虑对数组最大容量取模,因为位置8过去马上就成为位置1。 Read More
posted @ 2021-04-14 00:20
imissinstagram
Views(210)
Comments(0)
Diggs(0)
对于链表添加操作,假如不考虑按序号添加,则可以写一个简单的方法: public void add(HeroNode heroNode) { //因为head节点不能动,因此我们需要一个辅助变量遍历 HeroNode temp = head; //遍历链表,找到最后 while (true) { // Read More
posted @ 2021-04-14 00:12
imissinstagram
Views(361)
Comments(0)
Diggs(0)

浙公网安备 33010602011771号