In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-15 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/03 Report--
What this article shares with you is about the sort of insertions. The editor thinks it is very practical, so I share it with you to learn. I hope you can get something after reading this article. Let's take a look at it with the editor.
There are two kinds of insertion sort: simple insertion sort and Hill sort. The time complexity of simple insertion sort is [O (N2) stable sort], and the time complexity of Hill sort is [related to the selection of incremental sequence, unstable sort].
Insert sort
Simple insert sort
A set of sequences to be sorted is divided into ordered and unsorted parts. in the initial state, the sorted sequence contains only the first element, and the element in the unsorted sequence is an element except the first one; then the elements in the unsorted sequence are inserted into the sorted sequence one by one. To and fro, if the number of elements in the unsorted sequence is 0 after NMMI is inserted once, the sorting is completed.
Time complexity: O (N2) stable sorting
Hill ranking
A group of elements to be sorted are divided into several sequences according to a certain interval, and are inserted and sorted respectively. The "interval" set at the beginning is larger, and the interval is gradually reduced in each round of sorting until the interval is 1, that is, the last step is to do a simple insert sort.
Time complexity: unstable sorting related to the selection of incremental sequences
The above are the insertion sort, the editor believes that there are some knowledge points that we may see or use in our daily work. I hope you can learn more from this article. For more details, please follow the industry information channel.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.