Finding the Largest Element in an Array

Finding the Largest Element in an Array

We are given an integer array of size N or we can say number of elements is equal to N. We have to find the largest/ maximum element in an array. The time complexity to solve this is linear O(N) and space compexity is O(1). Our efficient approach can be seen as the first step of insertion sort. In fact, this can be extended to find the k-th largest element which will take O(K * N) time and using this to sort the entire array will take O(N^2) time.If we have extra information, we can take its ad...

 •  0 comments  •  flag
Share on Twitter
Published on May 30, 2020 17:11
No comments have been added yet.