This chapter of the content, some have been in the public number in the detailed ideas and steps summarized, some may later find time to analyze it, here will only be listed in the final implementation, the degree of difficulty is not in order, the complexity of the algorithm is not guaranteed to be optimal, left to everyone space to think, of course, this chapter is encoded in C # language , you can use your familiar language to implement these algorithms again Oh ~
If you have any interesting algorithm problem or can not solve the algorithm problem, you can also leave a message to small, let us play the algorithm ~
1. Bubble sort
This is the simplest of all algorithms, the implementation method is as follows:
2. Insert Sort
From the sorting algorithm, this algorithm is also a relatively simple, the implementation method is as follows:
3. Merge two ordered arrays and ensure that the arrays remain sorted after merging
This algorithm can, of course, be done by the above two sorting methods, but a favorable condition of the problem is that two arrays are already ordered state, so the use of this favorable condition will make the algorithm more sophisticated, the implementation of the following ways:
4. The Sum of the
This problem comes from the leetcode, the difficulty degree belongs to the simple, the question
Here's how it's implemented:
5. Add the Numbers
Also comes from Leetcode of an algorithm problem, difficulty degree general bar, topic
Here's how it's implemented:
6. Implementing the String.Split () method using C # encoding
This problem is equivalent to not using the method provided by the class library, but to implement this method in the class library, the implementation of a number of ways, the recommended way is as follows:
7. Implementing the String.Replace () method using C # encoding
Similar to the above questions, but also the implementation of the method of the library provided, where the use of StringBuilder, but does not guarantee that the method is optimal ~ Everyone can think for themselves:
This time the collection is mainly these algorithms, the difficulty is not really big, the key to see whether they can understand the logic of it ~
Want to be the first to see this series of updates and more exciting content can scan the following QR code attention to the public number: leaning building to listen to the rain and the moon
Common algorithm problem compilation (I.)