文章分类 - 算法
算法
摘要:
二叉树的层序遍历-广度优先搜索 class Solution { public List<List<Integer>> levelOrder(TreeNode root) { if(root == null){ return null; } List<List<Integer>> list = ne
阅读全文
二叉树的层序遍历-广度优先搜索 class Solution { public List<List<Integer>> levelOrder(TreeNode root) { if(root == null){ return null; } List<List<Integer>> list = ne
阅读全文
摘要:
常见排序算法 冒泡 /** * 冒泡排序 时间复杂度 */ public static void sort1(int[] nums) { for (int i = 0; i < nums.length - 1; i++) { for (int j = 0; j < nums.length - i -
阅读全文
常见排序算法 冒泡 /** * 冒泡排序 时间复杂度 */ public static void sort1(int[] nums) { for (int i = 0; i < nums.length - 1; i++) { for (int j = 0; j < nums.length - i -
阅读全文
摘要:
class Solution { /** * 前序遍历 中 左 右 */ public List<Integer> preorderTraversal(TreeNode root) { List<Integer> result = new ArrayList<Integer>(); preorder
阅读全文
class Solution { /** * 前序遍历 中 左 右 */ public List<Integer> preorderTraversal(TreeNode root) { List<Integer> result = new ArrayList<Integer>(); preorder
阅读全文
摘要:
/** * 翻转链表非递归 */ public ListNode q1(ListNode head){ ListNode left =null; ListNode right =head; ListNode right2=head; while(right!=null){ right2 = righ
阅读全文
/** * 翻转链表非递归 */ public ListNode q1(ListNode head){ ListNode left =null; ListNode right =head; ListNode right2=head; while(right!=null){ right2 = righ
阅读全文

浙公网安备 33010602011771号