Why we need algorithms? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Why we need algorithms?

For example Sorting algorithms: In python we can use sort() method. But these sorting algorithm make same thing like sort() method. but these algorithms use more lines of code. Why we need these algorithms. I am confused please help me.

26th Aug 2020, 3:21 PM
Allamprabhu Hiremath
6 Answers
+ 4
An algorithm is important in optimizing a computer program according to the available resources. . Ultimately when anyone decide to solve a problem through better algorithms than searching for the best combination of program speed and least amount of memory consumption is desired.
28th Aug 2020, 5:02 AM
Priya Sharma :)
Priya Sharma :) - avatar
+ 7
Implementing algorithms yourself not only give you more understanding of how the algorithm works but also gives you more control on algorithm to alter it according to your needs.
26th Aug 2020, 3:23 PM
Arsenic
Arsenic - avatar
+ 6
It is similar to asking why you are taught addition/subtraction when you can always use a calculator.
26th Aug 2020, 3:34 PM
Arsenic
Arsenic - avatar
+ 2
With regards to Sorting Algorithms, there are several contributing factors to selecting the "best" and in order to do so, you need to have a working knowledge of these algorithms; not all sorting algorithms are created equal and knowing when to use which is the key contributing factor to determine "best". Also, knowing Big O Notation will help in identifying which sorting method to go with. They nearly all have cases where they are valuable. Mergesort is excellent when you get into distributed processes. Insertion sort is useful for small lists and is a good base case for the recursive sorts. Even Bubble sort is useful for nearly-sorted lists, especially if you don’t need perfect ordering immediately. Radix sorts are useful for certain types of data.
26th Aug 2020, 3:36 PM
Steven M
Steven M - avatar
+ 2
The type of sorting algorithm you need to use depends on what kind of data hour are sorting. Certain types of data are sorted better using one algorithm than another.
27th Aug 2020, 1:08 PM
DERP
DERP - avatar