binary-trees
Here are 267 public repositories matching this topic...
-
Updated
Oct 26, 2019 - JavaScript
-
Updated
Aug 26, 2017 - TypeScript
-
Updated
Jun 12, 2020 - Python
-
Updated
Nov 25, 2020 - C#
-
Updated
Feb 12, 2019 - Go
-
Updated
Oct 28, 2020 - C++
Given an array A of random integers and an integer k, find and return the kth largest element in the array.
Try to do this question in less than O(nlogn) time.
Input Format :
Line 1 : An integer N i.e. size of the array
Line 2 : N integers which are elements of the array, separated by spaces
Line 3 : An integer k
Output Format :
kth largest element
Input Constraints :
1 <= N, Ai,
-
Updated
Jan 7, 2017 - JavaScript
-
Updated
Nov 26, 2020 - TypeScript
I'm 100% sure I accidentally implemented this wrong for two children nodes — should fix. Algorithm should be something like:
find node to delete
if has two children
_node := max in left subtree || min in right subtree
swap values
delete _node
-
Updated
Oct 10, 2020 - Java
-
Updated
Nov 4, 2020 - Java
-
Updated
Nov 27, 2020 - C++
-
Updated
Sep 17, 2020 - Java
-
Updated
May 21, 2019 - C++
-
Updated
Jan 21, 2020 - C++
-
Updated
Sep 23, 2020 - C#
-
Updated
Dec 7, 2019 - Julia
-
Updated
Mar 12, 2017 - Swift
-
Updated
May 2, 2017
-
Updated
Apr 14, 2018
-
Updated
Aug 5, 2019 - C
-
Updated
Jul 20, 2020 - TypeScript
-
Updated
Oct 15, 2020 - C++
Largest BST
-
Updated
Sep 8, 2019 - C++
-
Updated
Feb 21, 2018 - Python
-
Updated
Dec 18, 2018 - C++
-
Updated
Jan 6, 2018 - C
Improve this page
Add a description, image, and links to the binary-trees topic page so that developers can more easily learn about it.
Add this topic to your repo
To associate your repository with the binary-trees topic, visit your repo's landing page and select "manage topics."
steps to reproduce
Write a loop, from 1 to 80000, each time add a random int to the max heap.
In theory it takes very little time(NlogN, N=80000, <1sec ), but the program does take a long time.
I'v also tested the BinaryHeap in https://github.com/SolutionsDesign/Algorithmia, it performs well, so it is probably due to the bad algorithm.