Linear Search in Java: Advantages and Disadvantages

DSA with Java... Today I learnt about LINEAR SEARCH... just like the name, the search is really done in a linear format. In this search, iteration goes through a collection of elements, one at a time. To find the index of an element, it checks for that element from the beginning of that array. The disadvantage is that it reduces performance for large data sets. Imagine trying to find your show in a big container of shoes and you have to go through one at a time. It's runtime complexity is O(n). The advantage also is that it's fast for small to medium data sets, doesn't need to be sorted, and useful for data structures that don't have random access like LinkedList. what are the real life situations of linear search in building softwares? drop your answers in the comments. cheers 🥂. #softwareengineering #dsa #java #linearsearch

  • text

To view or add a comment, sign in

Explore content categories