Showing posts with label Binary Search Tree. Show all posts
Showing posts with label Binary Search Tree. Show all posts

Monday, December 5, 2016

Find Second Largest Element in an Array

Following shows various ways (all in O(N) ) to find the second largest number in an array.
I got the idea of using Bubble/Selection sort from here: http://stackoverflow.com/a/18093966/3381625
Quick Select can also be used to do this task.