Class Moderator


  • public class Moderator
    extends Object
    Simulate a content moderation priority queue with "streaming" data.
    • Constructor Detail

      • Moderator

        public Moderator()
    • Method Detail

      • addComments

        private static void addComments​(MinPQ<String> pq,
                                        Scanner scanner,
                                        int n)
        Adds up to N comments from the scanner to the priority queue with negated weights.
        Parameters:
        pq - the destination priority queue.
        scanner - the input scanner.
        n - the number of comments to read from the scanner.