
算法
原力与你同在
我,最后的绝地武士
展开
专栏收录文章
- 默认排序
- 最新发布
- 最早发布
- 最多阅读
- 最少阅读
-
给定一个二叉树,BFS遍历
public static Queue<Integer> bfs(TreeNode root){ Queue<Integer> queue=new LinkedList<>(); Queue<TreeNode> help=new LinkedList<>(); help.offer(root); while (!help.isEmpty()){ TreeNod.原创 2022-03-20 10:20:36 · 590 阅读 · 0 评论 -
给定一个数组,返回对应的链表存储
public static ListNode buildLinks(int[] arr) { ListNode head = null; for (int e : arr) { head = buildLink(head, e); } return head; } public static ListNode buildLink(ListNode head, int v) { if (hea.原创 2022-03-20 09:59:27 · 488 阅读 · 0 评论 -
给定一个数组,返回对应的二叉树结构
例如:给定数组[1,2,2,3,4,4,3] 返回为: 代码如下: public static TreeNode buildTree(Integer[] arr){ if(arr.length==1) return new TreeNode(arr[0]); Queue<TreeNode> queue=new LinkedList<>(); TreeNode root=new TreeNode(arr[0]); que原创 2022-03-20 09:56:21 · 202 阅读 · 0 评论 -
匈牙利命名和驼峰命名相互转换java
// 大小写ASCII码固定差距 static int gap = 'a'-'A'; public static void main(String[] args) { String str = "person_first_name"; String result = parseStrToCammeCase(str); System.out.println(result); System.out.println(parseCa原创 2022-02-14 10:34:20 · 312 阅读 · 0 评论 -
KMP算法Java实现
KMP算法JAVA实现原创 2021-12-07 18:31:54 · 370 阅读 · 1 评论