Browsing posts in: algorithms

Check if Tree is a Binary Search Tree

A Binary Search Tree is the tree that the key in each node must be greater than or equal to any key stored in the left sub-tree, and less than or equal to any key stored in the right sub-tree.

Binary Search Tree

Binary Search Tree

source: wikipedia

 

 

 


Detect a Cycle in a Linked List

This is one way of how to detect if a Linked List is a cyclic or not. The basic idea is to make 2 pointers to the head and then make one of them move slow (one hop at a time) and the other move faster (2 hops at a time). They will be in a loop until they collide which means there is a cycle!

 


Do we need to know Algorithms as programmers?

There are two different kinds of programmers. The ones who went to school and spent some years learning skills like science, maths , physics and algebra, and there are others who learned “coding” to do their day to day jobs. The second group are most likely like learning stuff by themselves, and did not have the opportunity to go to school. Algorithms are done at school most of the time and most of the classes used some kind of programming languages to teach algorithms.  That doesn’t mean that self taught programmers don’t know about them but these things can be learned from the books.

When it comes to hiring software engineers from a pool of many skilled and junior applicants, some these skills (algorithms) are counted in most places. That does not mean that you will be using algorithms in your daily front end JavaScript job. Some take it as a deep learning of computer science.

So, is it important to know it? yes it is but you can also get a job without them. However, the top 5 silicon valley companies for sure will ask about the algorithms. As a software engineer, i think you should know and have a good knowledge about them.

At the end , algorithms are there to make things better, and when it comes to technology, we talk speed/time and space. Whats the best way and more effecient way to solve a problem. So, yes whatever you do in the tech industry and wherever you are coming from, you need to know the basics of the Big O and other algorithms.

There are companies that made it to the market just because they had smart people to create great algorithms to transfer bits from point A to point B.