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...
I'm excited to invite you to participate in101 Hack 47. The contest starts at1500 UTC, March 21.Note the unusual timing! All problems have been prepared by me. You might have seen some problems and contests set by me on various platforms. This is my third round on HackerRank, after101...
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[...
Using TreeMap is a bad idea, since it has O(log(n)) insert and contains (it's a binary search tree underneath). This means it's as good/bad as using sort. You want to use HashMap, since this has O(1) put and contains.
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...