User contributions

Jump to navigation Jump to search
Search for contributionsExpandCollapse
⧼-contribs-top⧽
⧼-contribs-date⧽

(newest | oldest) View ( | ) (20 | 50 | 100 | 250 | 500)

  • 18:27, 20 September 2020 diff hist +992 N 4.21Created page with "the general form of this problem is to find the kth largest value. finding the median is when k = n/2. to find the kth largest value, * select a partition element and split..." current
  • 18:26, 20 September 2020 diff hist +900 N 4.19Created page with "1) Finding the maximum element is O(1) in both a max-heap (the root of the heap) and a sorted array (the last element in the array), so for this operation, both data structure..." current
  • 18:25, 20 September 2020 diff hist +539 N 4.17Created page with "Scan through the array to build an out-of-order heap, that is, the first element is indeed the smallest, but necessarily any of the other elements. This takes us O(n). Then ex..." current
  • 18:25, 20 September 2020 diff hist +23 N 4.15Created page with " Back to Chapter 4" current
  • 18:25, 20 September 2020 diff hist +23 N 4.13Created page with " Back to Chapter 4" current
  • 18:24, 20 September 2020 diff hist +3,256 N 4.11Created page with "Note that there can be at most one element which appears more than n/2 (i.e. at least ceil(n/2) ) times in the list. If we now consider the *sorted* version of the list, we'l..." current
  • 18:23, 20 September 2020 diff hist -19 4.9current
  • 18:23, 20 September 2020 diff hist +3,167 N 4.9Created page with "Here the main thing to notice is that we need a O(<math>n^{k-1}logn</math>) solution. <br /> For various values of k, <br /> k Solution Time Complexity <br /> 1 O..."
  • 18:22, 20 September 2020 diff hist +23 N 4.7Created page with " Back to Chapter 4" current
  • 18:21, 20 September 2020 diff hist +250 N 4.5Created page with "O(nlogn) solution: : sort the array first, : scan the array, keep updating a max_so_far counter. O(n) solution: : put each value into hash map with the value as key and fre..." current
  • 18:20, 20 September 2020 diff hist +354 N 4.3Created page with "<pre> Algo - If we create pair of (min1, max2n) (min1, max2n-1)... will provide optimal result 1) Sort the set of 2n element (n log n) 2) Now assign two pointers Start: A[..." current
  • 18:20, 20 September 2020 diff hist +3 4.1current
  • 18:20, 20 September 2020 diff hist +200 N 4.1Created page with "Sort it with your favorite nlogn sorting algo. The bottom half is one team, the top half the other. Or much better , partition it with median as pivot . Time complexity O(n)..."
  • 18:18, 20 September 2020 diff hist +3,540 N 3.45Created page with " == Using a Hashtable == Scan the web page word by word and for each one, except the first, take the pair formed by the previous word + the current one. Use that pair as the..." current
  • 18:16, 20 September 2020 diff hist +786 N 3.43Created page with "<pre> 1) Take two pointers Fast and Slow (Slow jumps one step at a time while Fast two step) 2) While (Fast != NULL) if(Fast == Slow) return true;..." current
  • 18:14, 20 September 2020 diff hist +151 N 3.41Created page with "Create a count sort in magazine until you find all the characters of given string. --Max 06:49, 25 June 2010 (EDT) Back to Chapter 3" current
  • 18:14, 20 September 2020 diff hist +2,155 N 3.39Created page with "== Iterative version with three variables == <pre> Node* ReverseList( Node * List ) { Node *temp1 = *List; Node * temp2 = NULL; Node * temp3 = NULL; while ( temp..." current
  • 18:12, 20 September 2020 diff hist +453 N 3.37Created page with "<pre> bool compare(struct node* a, struct node* b) { // 1. both empty -> true if (a==NULL && b==NULL) return(true); // 2. both non-empty -> compare them else if (a!..." current
  • 18:11, 20 September 2020 diff hist -4 Chapter 3→‎Interview Problems
  • 18:10, 20 September 2020 diff hist +81 N 3.35Created page with "Sort the shirts by color and do a binary search on color. Back to Chapter 3" current

(newest | oldest) View ( | ) (20 | 50 | 100 | 250 | 500)