![](https://img-blog.csdnimg.cn/20201014180756757.png?x-oss-process=image/resize,m_fixed,h_64,w_64)
数据结构
进击的武德
这个作者很懒,什么都没留下…
展开
-
二叉树
先序遍历非递归 //https://leetcode-cn.com/problems/binary-tree-preorder-traversal/ public List<Integer> preorderTraversal(TreeNode root) { if(root==null){ return new ArrayList<>(); } List<Integer> list=new A原创 2021-02-03 18:07:20 · 76 阅读 · 0 评论 -
链表I
寻找第k个链表结点的值 快慢双指针 //https://leetcode-cn.com/problems/kth-node-from-end-of-list-lcci/submissions/ class Solution { public int kthToLast(ListNode head, int k) { ListNode slow=head; ListNode fast=head; while (fast!=null){原创 2021-02-02 15:40:21 · 44 阅读 · 0 评论 -
二分查询
二分模板 /* 二分模板 */ public class BinaryTemplate { public static void main(String[] args) { int[] nums=new int[]{1,2,3,4,5,6}; int i = binarySearch(nums, 7); System.out.println(i); } /* nums是有序无重复的 */ public s原创 2021-02-01 19:01:33 · 134 阅读 · 0 评论