- 有哪些排序算法,其中哪些是稳定的?什么是稳定?
排序算法有:冒泡排序、选择排序、插入排序、希尔排序、堆排序、归并排序、快速排序等。其中稳定的是:冒泡排序,选择排序,插入排序和归并排序。稳定指的是:在一个待排序的记录序列中,如果存在有多个相同的关键字记录,若经过排序,这些关键字之间的相对次序保持不变,我们就说这种排序方法是稳定的,否则就是不稳定的。
more >>敲石101下
排序算法有:冒泡排序、选择排序、插入排序、希尔排序、堆排序、归并排序、快速排序等。其中稳定的是:冒泡排序,选择排序,插入排序和归并排序。稳定指的是:在一个待排序的记录序列中,如果存在有多个相同的关键字记录,若经过排序,这些关键字之间的相对次序保持不变,我们就说这种排序方法是稳定的,否则就是不稳定的。
more >>A robot is located at the top-left corner of a m x n grid (marked ‘Start’ in the diagram below).
The robot can only move either down or right at any point in time. The robot is trying to reach the bottom-right corner of the grid (marked ‘Finish’ in the diagram below).
How many possible unique paths are there?
more >>Given an array of non-negative integers, you are initially positioned at the first index of the array.
Each element in the array represents your maximum jump length at that position.
Determine if you are able to reach the last index.
more >>Suppose an array sorted in ascending order is rotated at some pivot unknown to you beforehand.
(i.e., [0,1,2,4,5,6,7]
might become [4,5,6,7,0,1,2]
).
You are given a target value to search. If found in the array return its index, otherwise return -1
.
You may assume no duplicate exists in the array.
Your algorithm’s runtime complexity must be in the order of O(log n).
more >>Write an efficient algorithm that searches for a value in an m x n matrix. This matrix has the following properties:
Given an array of integers nums
sorted in ascending order, find the starting and ending position of a given target
value.
Your algorithm’s runtime complexity must be in the order of O(log n).
If the target is not found in the array, return [-1, -1]
.
A peak element is an element that is greater than its neighbors.
Given an input array nums
, where nums[i] ≠ nums[i+1]
, find a peak element and return its index.
The array may contain multiple peaks, in that case return the index to any one of the peaks is fine.
You may imagine that nums[-1] = nums[n] = -∞
.
Find the kth largest element in an unsorted array. Note that it is the kth largest element in the sorted order, not the kth distinct element.
more >>Given a non-empty array of integers, return the k most frequent elements.
For example,
Given [1,1,1,2,2,3]
and k = 2, return [1,2]
.
tag:
缺失模块。
1、请确保node版本大于6.2
2、在博客根目录(注意不是yilia根目录)执行以下命令:
npm i hexo-generator-json-content --save
3、在根目录_config.yml里添加配置:
jsonContent: meta: false pages: false posts: title: true date: true path: true text: false raw: false content: false slug: false updated: false comments: false link: false permalink: false excerpt: false categories: false tags: true