In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-27 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/03 Report--
This article mainly explains "what are the basic algorithms of php". Interested friends may wish to have a look. The method introduced in this paper is simple, fast and practical. Let's let the editor take you to learn what are the basic algorithms of php.
Four basic algorithms of php: bubbling, selection, insertion and fast sorting
Many people say that the algorithm is the core of the program, a program is better than bad, the key is the pros and cons of the program algorithm. As an entry-level phper, although I have little contact with algorithms. But I think we still need to master the four basic algorithms of bubble sorting, insertion sorting, selection sorting and fast sorting. Here is an analysis of the four methods according to my own understanding.
Requirements: use bubble sort method, fast sort method, select sort method, insert sort method to sort the values in the following array according to the order from small to small.
$arr (1 arr 43 5 4 6 2 21 6 6 7 8 36 6 7 6 39)
1. Bubbling sorting method
* thought analysis: the method, as its name suggests, is like bubbling, with the largest number coming out of the array at a time.
* for example: 2Jing 4jue 1 / / the first bubble is 4
The second bubble is 2.
* 1pr 2pm 4 / / that's what happened in the end.
* Code implementation:
The copy code is as follows:
$arr=array (1 arr=array 43 5 4 6 2 21 6 6 7 8 36 6 7 6 39)
Function getpao ($arr)
{
$len=count ($arr)
/ / set an empty array to receive bubbles.
/ / the cycle of this layer controls the number of wheels that need to bubble.
For ($iSuppli.
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.