Data Structures Trees: Is This a Binary Search Tree? 30 Medium Solution.java Data Structures Heaps: Find the Running Median 50 Hard Solution.java Data Structures Tries: Contacts 50 Hard Solution.java Algorithms Sorting: Bubble Sort 30 Medium Solution.java Algorithms Sorting: Comparator 35 Medium So...
An AVL tree (Georgy Adelson-Velsky and Landis' tree, named after the inventors) is a self-balancing binary search tree. In an AVL tree, the heights of the two child subtrees of any node differ by at most one; if at any time they differ by more than one, rebalancing is done to re...
Data Structures Trees: Is This a Binary Search Tree? TreesIsThisABinarySearchTree.java Data Structures Heaps: Find the Running Median HeapsFindTheRunningMedian.java Data Structures Tries: Contacts TriesContacts.java Algorithms Sorting: Bubble Sort SortingBubbleSort.java Algorithms Sorting: Comparator...
Data Structures Queues: A Tale of Two Stacks 30 Solution.java Data Structures Trees: Is This a Binary Search Tree? 30 Solution.java Data Structures Heaps: Find the Running Median 50 Solution.java Data Structures Tries: Contacts 50 Solution.java Algorithms Sorting: Bubble Sort 30 Solution.java ...
Key points for this one: - Relate the comparison process to BST search - Reasoning on extreme values: "We can notice that for a fixedthe maximum sum of depths is achieved when every node has just a left child and the minimum sum of depths os achieved when the binary tree is analmost ...
3 The major trick is from another similar HR problem: subarray with max XOR: Build a binary tree bit by bit, and go from MSB to LSB, greedily. In this one, we need one more step before using that trick. We need do "rationally reason" and visualize it: we separate ints into 2 gr...
so he is representing the string saved indp[v]as a segment tree that carries the string hash of a range however finding the minimum between two strings is not that easy hence the hash comes into play he binary search the maximum prefix wherehash1[x][0 - > i] = hash[...
Method 3 can be reduced by a factor of log(N) using modified binary search. Sqrt(n) decomposition. Might require some optimizations to pass the time limit though. →Reply ghoshsai5000 7 years ago,#^| 0 I know it's been 3 years since 2015 ! But, can you tell me how to solve it...
Data Structures Trees: Is This a Binary Search Tree? 30 Solution.java Data Structures Heaps: Find the Running Median 50 Solution.java Data Structures Tries: Contacts 50 Solution.java Algorithms Sorting: Bubble Sort 30 Solution.java Algorithms Sorting: Comparator 35 Solution.java Algorithms Merge Sort...
The Story of a Tree Java Medium 50 Breadth First Search: Shortest Reach Java Medium 55 The Value of Friendship Java Hard 55 Clique Java Medium 60 Dijkstra: Shortest Reach 2 Java Hard 60 Prim's (MST) : Special Subtree Java Medium 60 Roads in Hackerland Java Medium 60 Toll Cost...