solution

package
v0.0.0-...-be7dd33 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 5, 2023 License: MIT Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MergeTwoLists

func MergeTwoLists(l1 *linkedList.ListNode, l2 *linkedList.ListNode) *linkedList.ListNode

合成两个有序链表

func Partition

func Partition(head *linkedList.ListNode, x int) *linkedList.ListNode

给定一个链表和一个特定值 x,对链表进行分隔,使得所有小于 x 的节点都在大于或等于 x 的节点之前。 https://leetcode-cn.com/problems/partition-list/ 我想的是保存最大结点,小的结点放到前面,官方题解是把大结点保存到另一个链表,最后进行拼接

func ReorderList

func ReorderList(head *linkedList.ListNode) *linkedList.ListNode

https://leetcode-cn.com/problems/reorder-list/ 给定一个单链表 L:L→L→…→L__n→L 将其重新排列后变为: L→L__n→L→L__n→L→L__n→…

func ReverseList

func ReverseList(head *linkedList.ListNode) *linkedList.ListNode

func ReverseList2

func ReverseList2(head *linkedList.ListNode, m, n int) *linkedList.ListNode

反转从 m开始到n 节点的顺序

func SortList

func SortList(head *linkedList.ListNode) *linkedList.ListNode

给你链表的头结点head ,请将其按升序排列并返回排序后的链表 用mergeSort

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL