基本排序算法实现
本文介绍一些常见的基本排序算法的实现,以及相应的时间空间负责度分析。包括冒泡排序、插入排序、选择排序、归并排序、快速排序、堆排序这六种比较排序算法,以及计数排序这种线性时间排序算法。算法基于 C++ 语言实现。
本文介绍一些常见的基本排序算法的实现,以及相应的时间空间负责度分析。包括冒泡排序、插入排序、选择排序、归并排序、快速排序、堆排序这六种比较排序算法,以及计数排序这种线性时间排序算法。算法基于 C++ 语言实现。
Given a linked list, determine if it has a cycle in it.
Follow up:
Can you solve it without using extra space?
Given a binary tree, determine if it is height-balanced.
For this problem, a height-balanced binary tree is defined as:
a binary tree in which the depth of the two subtrees of every node never differ by more than 1.
Given a binary tree, return the bottom-up level order traversal of its nodes’ values. (ie, from left to right, level by level from leaf to root).
For example:
Given binary tree [3,9,20,null,null,15,7]
,