kth element with some analysis

some analysis for good measure tried randomizers but didnt work well....