Question
Please answer those 3 questions and explain Question 1: Suppose we have a sorted array ordered by decreasing toxicity. Given another element to add to
Please answer those 3 questions and explain
Question 1: Suppose we have a sorted array ordered by decreasing toxicity. Given another element to add to the sorted array, what is the worst-case asymptotic runtime for adding a single element using the insertion sort algorithm? Does the worst-case asymptotic runtime for single-item insertion improve if we use binary search to find the insertion point?
Question 2: A student points out that the best-case runtime for insertion sort is in (N) on a sorted (or nearly-sorted) array, which is not in (NlogN). Explain why insertion sort does not violate the comparison sorting lower bound.
Question 3: Rather than focus on the most toxic content, suppose we organize content by toxicity level: a range of toxicity values such as [0, 0.25), [0.25, 0.5), [0.5, 0.75), and [0.75, 1]. Each element in a given toxicity level is considered equally important for moderation. Design a constant-time data structure for storing and retrieving content by toxicity level for a constant number of toxicity levelsthere are 4 toxicity levels in the above example.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started