随笔分类 - 数据结构与算法
摘要:数据结构与算法3- 二叉搜索树 小书匠 数据结构与算法 算法工程师 1. 二叉搜索树的定义: 二叉搜索树是一颗二叉树,可以为空。满足以下性质: 非空左子树的所有键值小于其根节点的键值 非空右子树的所有键值大于其根节点的键值 2. 二叉搜索树的基本操作: 查找最小值:在树的最左分支的端节点上 查找最大
阅读全文
摘要:数据结构与算法2-二叉树 小书匠 算法工程师 数据结构与算法 1. 二叉树 定义:一颗二叉树由一个根节点和左右两个子树组成 结构变体: 满二叉树:所有分支节点都存在左子树和右子树,而且所有的叶子节点都在同一层 完全二叉树:二叉树的叶子节点只出现在最下层和次下层,而且最下层的叶节点集中在树的左部 树节
阅读全文
摘要:数据结构与算法1- 线性表与散列表 小书匠 算法工程师 数据结构与算法 1. 链表 java.util.LinkedList<> 既实现了List<> 接口,又实现了Deque<> 接口 2. 队列和栈 java.util.ArrayDeque<> * 单端队列API: * boolean offe
阅读全文
摘要:Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example: Example:
阅读全文
摘要:Given a string, find the length of the longest substring without repeating characters. Examples: Given "abcabcbb", the answer is "abc", which the leng
阅读全文
摘要:Given a string containing just the characters '(', ')', '{', '}', '[' and ']', determine if the input string is valid. The brackets must close in the
阅读全文
摘要:Given an array of strings, group anagrams together. For example, given: ["eat", "tea", "tan", "ate", "nat", "bat"], Return: Note: All inputs will be i
阅读全文
摘要:The count-and-say sequence is the sequence of integers with the first five terms as following: 1 is read off as "one 1" or 11.11 is read off as "two 1
阅读全文
摘要:Given an arbitrary ransom note string and another string containing letters from all the magazines, write a function that will return true if the rans
阅读全文
摘要:Write a function that takes a string as input and returns the string reversed.
阅读全文
摘要:Implement strStr(). Returns the index of the first occurrence of needle in haystack, or -1 if needle is not part of haystack. 非常容易的一道题目,注意各种特殊情况,先列举出c
阅读全文
摘要:Given a sorted integer array without duplicates, return the summary of its ranges. For example, given [0,1,2,4,5,7], return ["0->2","4->5","7"]. 这个题目不
阅读全文
摘要:Given an array of n integers where n > 1, nums, return an array output such that output[i] is equal to the product of all the elements of nums except
阅读全文
摘要:Given n non-negative integers a1, a2, ..., an, where each represents a point at coordinate (i, ai). n vertical lines are drawn such that the two endpo
阅读全文
摘要:Given an integer array of size n, find all elements that appear more than ⌊ n/3 ⌋ times. The algorithm should run in linear time and in O(1) space. 第一
阅读全文
摘要:Given an array of size n, find the majority element. The majority element is the element that appears more than ⌊ n/2 ⌋ times. You may assume that the
阅读全文
摘要:Given an array nums containing n + 1 integers where each integer is between 1 and n (inclusive), prove that at least one duplicate number must exist.
阅读全文
摘要:Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of
阅读全文
摘要:Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possib
阅读全文
浙公网安备 33010602011771号