Professor Abdul-Quader
Heaps (Intro)
// checking two queries against each other
boolean queriesMatch = true;
String[] firstWords = query.first.split(" ");
String[] secondWords = query.second.split(" ");
if (firstWords.length != secondWords.length) {
  returns.add(false); // add to list we will be returning
}
for (int i = 0; i < firstWords.length; i++) {
    if (wordsAreNotEqual && wordsAreNotSynonymous) {
      queriesMatch = false;
      break;
    }
}
returns.add(queriesMatch);// assume we have a List<Pair> synonyms
// wordsAreNotSynonymous
if (!synonyms.contains(new Pair(firstWords[i], secondWords[i]))) {
  // ...
}OS scheduler problem:
“min”-heap:
![]()
insertremoveMinDiscuss the following problem at your tables:
Given an unsorted list of \(n\) elements, find the \(k\)-th largest element. (If \(k = 0\), find the largest, if \(k = 1\), find the second largest, etc.) Determine the running time of your algorithm (in terms of \(n\) and \(k\)). (Suppose you are given \(k\) as a parameter to your method: so you don’t need to sort the whole list, just find the \(k\)-th largest one.)