摘要:
二叉树的定义不多赘述,先贴上二叉树的代码 前序遍历 递归实现: 非递归实现: 中序遍历 递归实现: 非递归实现: 后序遍历 递归实现: 非递归实现: 注:不论是递归还是非递归方法,遍历整棵树的时间复杂度都是O(N),额外的空间复杂度都是O(L),N为二叉树的节点数,L为二叉树的层数。 阅读全文
posted @ 2018-09-20 21:09
天地鸥
阅读(156)
评论(0)
推荐(0)
摘要:
快速排序的核心实现是,取一个基准数,使得数的左边小于它,数的右边大于它。 然后再对两边进行相同的递归操作。 阅读全文
posted @ 2018-09-20 13:35
天地鸥
阅读(102)
评论(0)
推荐(0)
摘要:
Given a string s, find the longest palindromic substring in s. You may assume that the maximum length of s is 1000. Example 1: Example 2: 使用boolean创建一 阅读全文
posted @ 2018-09-20 10:39
天地鸥
阅读(1209)
评论(1)
推荐(0)
摘要:
Given an integer array nums, find the contiguous subarray (containing at least one number) which has the largest sum and return its sum. Example: Foll 阅读全文
posted @ 2018-09-20 09:32
天地鸥
阅读(142)
评论(0)
推荐(0)

浙公网安备 33010602011771号