摘要: ##1 题目描述 ###1.1 英文描述 Given the root of a binary tree, check whether it is a mirror of itself (i.e., symmetric around its center). Example 1: Input: ro 阅读全文
posted @ 2021-05-14 01:11 limaodeng 阅读(131) 评论(0) 推荐(0)
摘要: ##1 题目描述 ###1.1 英文描述 Given a string s, determine if it is a palindrome, considering only alphanumeric characters and ignoring cases. Example 1: Input: 阅读全文
posted @ 2020-08-12 00:54 limaodeng 阅读(160) 评论(2) 推荐(0)
摘要: ##1 题目描述 ###1.1 英文描述 Given an array of integers that is already sorted in ascending order, find two numbers such that they add up to a specific target 阅读全文
posted @ 2020-08-12 00:47 limaodeng 阅读(85) 评论(0) 推荐(0)
摘要: ####一、Java异常 异常的类图 #####Error 1、 Error为严重性问题,总是不可控制的(unchecked)。 2、 经常用来表示系统错误或者底层资源错误。 3、 如果可能的话,应该在系统级被处理。 #####Exception 1、Checked Exception(编译时异常) 阅读全文
posted @ 2020-06-01 00:30 limaodeng 阅读(118) 评论(0) 推荐(0)
摘要: ####递归的三个条件 1、一个问题可以分解为多个子问题进行求解。 2、这个问题分解之后的子问题,除了数据规模不一样之外,其他解题思路完全一样。 3、存在递归终止条件 ####写递归代码的步骤 找到如何将大问题分解为小问题的规律,并基于此写出递推公式,然后再推敲终止条件,最后将递推公式和终止条件翻译 阅读全文
posted @ 2020-04-10 17:03 limaodeng 阅读(279) 评论(0) 推荐(0)
摘要: ####队列的特点 先进先出 ####顺序队列 #####代码实现 package com.datastructure.queue; import java.util.Objects; /** * 数组实现顺序队列 * * @Auther: dlm * @Date: 2020/4/7 19:03 * 阅读全文
posted @ 2020-04-07 19:40 limaodeng 阅读(332) 评论(0) 推荐(0)
摘要: ####栈的内存示意图 ####栈的特点 先进后出,后进先先出。 ####顺序栈代码实现 package com.datastructure.stack; /** * 基于数组实现的顺序栈 * * @Auther: dlm * @Date: 2020/4/7 12:33 * @Description 阅读全文
posted @ 2020-04-07 13:03 limaodeng 阅读(149) 评论(0) 推荐(0)
摘要: ####实例代码 在数组array中查询元素x的下标。 // 在数组array中查询元素x的下标。n表示数组array的长度 int find(int[] array, int n, int x) { int i = 0; int pos = -1; for (; i < n; ++i) { if 阅读全文
posted @ 2020-04-07 10:25 limaodeng 阅读(647) 评论(0) 推荐(0)
摘要: 本文使用链表实现最近最少使用缓存算法。 ####算法思想: 1、访问某元素时,先判断缓存中是否存在该元素。 2、如果存在,则删除该元素,再将该元素插入到链表首部。 3、如果不存在 1)链表已满时,删除末端元素,将该元素插入到链表首部。 2)链表未满时,将该元素插入到链表首部。 ####代码实现 pa 阅读全文
posted @ 2020-04-07 01:21 limaodeng 阅读(291) 评论(0) 推荐(0)
摘要: 本文使用数组实现最近最少使用缓存算法。 ####算法思想: 1、访问某元素时,先判断缓存中是否存在该元素。 2、如果存在,将该元素前面的元素向右移动一位,将该元素移动到数组首位。 3、如果不存在 1)数组已满时,删除末端元素,将所有元素向右移动一位,将新元素插到首位。 2)数组未满时,将所有元素向后 阅读全文
posted @ 2020-04-06 19:12 limaodeng 阅读(1045) 评论(0) 推荐(0)