Bubblesort is an example of a very inefficient algorithm. Its best scenario is O(n) while its worst and average scenario are both O(n^2). Its poor efficiency can be explained by its algorithm implementation: it compares swaps two indexes, i and j, for every index in the whole list. Therefore it can been seen as one for loop with another for loop as both indexes are constantly changing. Therefore we can see it as the efficiency of this algorithm would be n x n = n^2
Other efficient sorting algorithms usually have sorting time of O(nlogn) for worst and average case scenarios. For instance, merge sort has a best, average, worst scenario of O(nlogn). Therefore it can been that although the best case scenario case can be seen to be less efficient than that of bubblesort, the scenario that really matters is the average and worst scenarios. It is okay if the algorithm is not the best, but it is very important that it will never be the worst.
For algorithms such as sorting, the structure of the input data also affects the efficiency. For instance, when searching for an element in a list, a linear search will search every element in the list, giving it a O(n) efficiency. However if the list is sorted, we can apply a binary search instead: start in the middle of the list, if the element > middle, then search to the right, if element < middle, search to the left. This will naturally increase the search efficiency.
Algorithm efficiency has very real applications and there are many natural ways in which humans apply these algorithms, even unconsciously. For instance, we tend to use insertion sort. When we search for a word in a dictionary, we would search by looking where we think the letter is first - similar to binary search.
Efficiency of an algorithm is very important and it essential that we ensure the code that we right are efficient for their purposes. If an algorithm takes way too long, even if it works, it may not be the best choice and it would be a better idea to make the algorithm more efficient or simply to look for another solution.