How to get started with algorithms?

So here is the thing I have started learning algorithms but there are few things that I can’t understand.

  1. How many algorithms should a programmer know? I mean there are a lot of algorithms so it would be great if I focus only on the ones that are most useful.

  2. How should I learn an algorithm? I mean I know that I need to learn how an algorithm works and should be able to code that. But my question is after learning the idea behind an algorithm how should I go further?

3)And where are algorithms used in a programmer’s life? So I started learning Python and on the way I started creating various side projects for fun. For example I created a Twitter bot that tweets every hour. Apart from that I have also worked with Flask and have created couple of websites. But I never encountered the need to use alogrithms. So my question is when do we need to implement these algrithms ?

I’m not sure whether I understand what you are getting at.

A simple algorithm would be converting degrees Centigrade to Fahrenheit, for example.

F = C * 9 / 5 + 32

You would use it when you need it. It is not something I would consider trying to remember, just work it out, or look it up, when I need to use it.

1 Like

I’m not sure what you mean by “algorithm”. To me it means “a Math formula”.

Will you need to use them in programming? Most certainly. Computers at their core work in binary, and you will eventually need to write code that manipulates the bits and bytes even though you may not need to ever write machine language code.

How many algorithms should a programmer know?
Short answer, as many as he needs to use.

Some are common and examples can be easily found. Many need to be put together custom depending on what’s being worked with and what’s wanted to be done with it.

This takes some ability at both Math and Logic more than it being a memorization thing.

1 Like

Thanks for taking out time to reply. So by algorithms I mean sorting algorithms like bubble sort, heap sort, insertion sort etc. And does a programmer always know all these popular algorithms?

It depends on what sort of programming you’re doing and what language your using. Many languages have a built-in sort function. I can’t remember the last time I used a bubble sort!

Well, I am learning python. Yes, I do agree that a lot of languages have built in function of sorting. But I was reading on the internet and a lot of people said that a programmer must know sorting algorithms which is why I was asking you guys.

Ah, well it must be true then! :rofl:

Others may use these algorithms, I don’t. I don’t often need to sort anything though.

1 Like

I am working with code that does a fair amount of sorting now. And I have written a good number of ORDER BY queries.

IMHO it is not as important that I know all the “behind the scene” details as much as it is for me to know how to use available sort functions and craft ORDER BY queries to get the results I want to get as efficiently as possible.

The more knowledge a programmer has of the machine code involved can’t hurt, and of course if you are writing machine code then yes, you would need to know much more. But for programmers writing high level code I think a general awareness would be sufficient.

1 Like

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.