Time complexity:
Construction: O(N * logK)
Adding: O(logK)
Space Complexity:
O(K) (can be reduced to O(1) by reusing memory of the existing array
Problem Link : https://leetcode.com/problems/kth-lar...
C++ Code Link : https://github.com/Ayu-99/Data-Struct...
Java Code Link : https://github.com/Ayu-99/Data-Struct...
Please like, share and subscribe if you found the video useful. Feel free to ask in comments section if you have any doubts. :)
#DataStructuresAndAlgorithms
#KthLargestElementInAStream
#interviewpreparation
Kth Largest Element in a Stream solution
Kth Largest Element in a Stream Leetcode
Kth Largest Element in a Stream C++
Kth Largest Element in a Stream Java
Kth Largest Element in a Stream Python
🔥🔥🔥🔥👇👇👇
Join telegram channel for more updates on placement preparation : https://t.me/AyushiSharmaDiscussionGroup
Checkout the series: 🔥🔥🔥
👉Interview Experiences : • Interview Experiences
👉 Array: • Arrays
👉 Linked List : • Linked List
👉 Heap : • Heap
👉 Recursion : • Recursion
👉 Stack and Queue : • Stack And Queue
👉 Greedy : • Greedy
👉 Dynamic Programming : • Dynamic Programming
👉 Leetcode contests : • Leetcode contests
👉 Leetcode June Challenge : • Leetcode June Challenge
👉 Leetcode July Challenge : • Leetcode July Challenge
LIKE | SHARE | SUBSCRIBE 🔥🔥😊