In a world where AI does everything anyway, why study algorithms?
Thoughts on studying algorithms
Thoughts on studying algorithms
I recently ran into A, a former colleague. We used to work together on the same team as developers for a long time.
We started by catching up on what each of us has been up to, and then moved on to discussing how we can survive in the age of AI. One of the things I mentioned was that I’ve been studying LeetCode algorithms, and this was the response I got:
“Why are you doing that? You don’t need to study algorithms anymore. AI will handle it anyway. I don’t think there’s any need to do algorithms in the future.”
I don’t think that’s wrong. After all, we’re in an era where AI can write the algorithm code itself.
However, I didn’t start this algorithm study group simply because “I felt like it.” An algorithm is a design method that involves finding the interpretation between the given input and output. So, I wanted to train myself in that process of defining a problem, thinking through the solution, and writing the code. Since algorithm problems tend to follow established patterns, that training might feel a bit outdated, but I didn’t see any reason to downplay its value in the first place.
If you don’t want to hand algorithms over to AI, you shouldn’t just write code when solving problems—you should add comments explaining why you wrote the code that way, and think about how the test cases (TC) and test suites (SC) will turn out as you solve the problem.
Here’s an example of my solution where the code itself is very short, but the comments are longer…. Last Week’s Problem-Solving PR
python# 7기 풀이 # 시간 복잡도: O(n) # - 문자열 s의 전체 문자를 순회할 때 길이 n만큼의 시간 소요 # 공간 복잡도: O(1) # - start, end 등의 변수만 사용 class Solution: def isPalindrome(self, s: str) -> bool: # two pointer로 각 문자열을 비교하며 palindrome인지 체크한다. # 해당 문제의 조건 중 하나가 alphanumeric한 문자만 체크하는 것 start, end = 0, len(s) - 1 # 양 끝의 포인터 인덱스가 같아지기 전까지 루프를 돌린다. while start < end: if not s[start].isalnum(): # s[start] 문자가 alphanumeric하지 않은 경우엔 start 포인터를 오른쪽으로 한 칸 이동 start += 1 continue if not s[end].isalnum(): # s[end] 문자가 alphanumeric하지 않은 경우엔 end 포인터를 왼쪽으로 한 칸 이동 end -= 1 continue if s[start].lower() != s[end].lower(): # 두 문자의 lowercase가 동일하지 않은 경우에는 palindrome이 아니므로 False로 early return 해준다. return False start, end = start + 1, end - 1 # while 루프가 다 돌았다면 조건에 걸리지 않고 palindrome임을 충족하므로 True를 return return True
So, I started this largely with the mindset that this might actually be even more necessary these days. Of course, I’m also doing it because the process of using my brain to solve problems is fun in itself, haha. (+Ah… I’d forgotten everything and thought I needed to study it again, haha... There are various reasons)
I think I felt the same way back in high school when I was studying math hard. I never saw it as a subject where you just memorize formulas, but rather as one where you have to “understand” the formulas and “know how to apply them to problems.”
Just because you have an engineering calculator doesn’t mean you don’t have to study calculus, right? The argument that you don’t need to study algorithms themselves because AI does it all seems similar to this. I thought that if you just dismiss it as “not necessary,” it might actually be a missed opportunity for technology experts. (Of course, I think this is slightly different from non-developers knowing how to use AI. For them, the world of internal implementation is an abstract realm, so they might not understand it.)
It’s true that these days, the boundaries between specialized fields and the areas that define them are becoming blurred. Still, the specialized domain of developers lies in understanding internal implementation—whether from an engineering perspective (including hardware) or in improving workflow efficiency. Even this might eventually be replaced by AI, but as of now, I don’t think we’re quite there yet.
With AI technology advancing by leaps and bounds every day and the scope of what AI can handle growing exponentially, certain skills may become obsolete overnight. Still, I don’t think the fundamentals will ever disappear. Beyond simply solving algorithms, the mental training involved in defining problems and devising solutions during that process—isn’t that the essence of it all?