摘要:
Sort a linked list using insertion sort. 思路: 怎么判断链表开始? 怎么判断链表结束? 定义dummy假的头节点,这样的话直接就有了链表头dummy.next 怎么将curr指向的节点插入到in指向的位置? 四步就可以完成:ListNode *tmp = c 阅读全文
摘要:
Given a linked list and a value x, partition it such that all nodes less than x come before nodes greater than or equal to x. You should preserve the 阅读全文
摘要:
You are given two linked lists representing two non-negative numbers. The digits are stored in reverse order and each of their nodes contain a single 阅读全文
摘要:
Given a singly linked list where elements are sorted in ascending order, convert it to a height balanced BST. 题目:将升序的链表,转化为BST(note:此BST要求是高度平衡,就是树种左右 阅读全文
摘要:
Given a singly linked list L: L0→L1→…→Ln-1→Ln,reorder it to: L0→Ln→L1→Ln-1→L2→Ln-2→… You must do this in-place without altering the nodes' values. For 阅读全文
摘要:
Given a singly linked list, group all odd nodes together followed by the even nodes. Please note here we are talking about the node number and not the 阅读全文