Documentation
¶
Index ¶
- func HasCycle(head *ListNode) bool
- type ListNode
- func DeleteDuplicates(head *ListNode) *ListNode
- func DeleteDuplicates2(head *ListNode) *ListNode
- func DetectCycle(head *ListNode) *ListNode
- func GetIntersectionNode(headA, headB *ListNode) *ListNode
- func MergeInBetween(list1 *ListNode, a int, b int, list2 *ListNode) *ListNode
- func NewList(vals []int) *ListNode
- func OddEvenList(head *ListNode) *ListNode
- func Partition(head *ListNode, x int) *ListNode
- func RemoveElements(head *ListNode, val int) *ListNode
- func ReverseBetween(head *ListNode, left int, right int) *ListNode
- func ReverseList(head *ListNode) *ListNode
- func SwapPairs(head *ListNode) *ListNode
- type Node
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type ListNode ¶
ListNode represents singly-linked list.
func DeleteDuplicates ¶
DeleteDuplicates deletes all duplicates such that each element appears only once. Return the linked list sorted as well
func DeleteDuplicates2 ¶
DeleteDuplicates2 deletes all nodes that have duplicate numbers, leaving only distinct numbers from the original list. Return the linked list sorted as wel
func DetectCycle ¶
DetectCycle returns the node where the cycle begins. If there is no cycle, it returns nil.
func GetIntersectionNode ¶
func MergeInBetween ¶
MergeInBetween removes nodes that index between a, b in list1, and put list2 in their place.
func OddEvenList ¶
func Partition ¶
Partition partitions list such that all nodes less than x come before nodes greater than or equal to x.
func RemoveElements ¶
RemoveElements removes elements which value is val from head.
func ReverseBetween ¶
ReverseBetween reverse the nodes of the list from position left to position right, and return the reversed list