Algorithm is a step-by-step procedure for counting or completing a task or problem. Algorithms are used for automatic calculation, data processing and reasoning. Algorithms are the core of programming, where all instructions from beginning to end are implemented using a programming language.
In the world of programming, sorting is a part that cannot be eliminated. The main purpose of the sorting process is to sort the data, both from the lowest or highest. This indirectly will make the data more structured, neat and organized. Many popular algorithms for sorting data, such as: insertion sort, selection sort, merge sort, heap sort, quick sort, bubble sort, shell sort, comb sort, counting sort, bucket sort, radix sort.
- Bubble Sort
Bubble sort is probably the most popular and simple sorting method used. The ordering process is done by comparing each value in a list in pairs, then exchanging values if needed, and repeating them until the end of the list in sequence, so, there are no more values that can be exchanged.
The steps are:
- Compare the values in the 1st data with the 2nd data.
- If the value of the 1st data is greater than the 2nd data then change its position.
- Then the larger data is compared again with the 3rd data.
- If the third data is smaller than the second data, change its position, and so on until all the data is sorted.
- Selection Sort
The principle of the selection sort algorithm is to choose the element with the lowest value and swap the element with the first element. The value of i starts from 1 to n, where n is the total number of elements minus 1.
The steps are:
- Checking starts from the 1st data to the n data.
- Determine the number with the smallest index of the data number.
- Exchange the numbers with the smallest index with the first number (i = 1) from the data numbers.
- Perform steps 2 and 3 for the next number (i = i + 1) until you get the appropriate data.
- Insertion Sort
The principle of insertion sort algorithm basically divides the data to be sorted into two parts, one part that has not been sorted and the other one has been sorted. The first element is taken from the part of the list that has not been sorted and then placed according to its position in another part of the list that has been sorted. This step is repeated until there are no elements left in the list that have not been sorted.
The steps are:
- Compare the 2nd data with the 1st data, if the 2nd data is smaller then change the position, if not leave it alone.
- The 3rd data is compared with the 1st and 2nd data, if the 3rd data is smaller then change the position again
- The 4th data is compared with the 3rd, 2nd and 1st data, if the 4th data is smaller than the third then put the 4th data to the front position. And so on until there is no more data that can be moved.
The history of python is a programming language which developed by Guido van Rossum in 1990. The last version of python is 1.6 in 2000. Python always continued until now.
In 1995 Guido moved to Virginia America for continued his project. python is programming language that is easier to use rather than c or c++. The developers often use this language because makes work easier with the short steps. In this language a lot of features provided but just use a little bit code programming. The advantages of this program are:
- so much library can use and comprehensive
- increasing the developer productivity
Short syntax can make developer more productive. They must not waste a lot of time to make some applications
- Can support IoT
IoT is the concept which intention to maximize the function of internet network.
- Cross platform
It means that python can use in many operating system. Python can use in Linux, windows, UNIX, Mac operating system, etc.
And the weaknesses of python are:
- Slow execution
Python is language that uses the compiler to run the program. So, if we run the program python slower than others.
- Weak in computing mobile.
Python platforms are better used on servers or desktops, but are weak when used for mobile computing.
- Run time error
In this language, the developers don’t need to declare the variable type, so it can cause the possibility an error when run time.
- Difficulties in other language.
People who are accustomed using this language will find the difficulties to use another language. It because python provides an extensive library which makes the developers a little bit gets the problem.
- Easy to learn
This program has a little bit keyword. Structure that is easy to understand so makes it easier for someone to learn.
Python was developed as an open source project and can be used by anyone for free.
Who are python users?
- Google is a big company that uses a lot of Python code in its search engine.
- Youtube, the largest and most popular video site in the world, most of the code is written in Python
- Facebook, the largest social media in the world, uses Tornado, a Python framework to display the timeline.
- Instagram, who does not know. Instagram uses Django, the python framework as a server-side processing engine from the application.
- Pinterest, many use python to build applications.
- Dropbox, maybe you are a user of this service. Dropbox uses python both on the server side and on the user’s service side.etc