Diego
BAN USER- 5of 5 votes
AnswersGiven a self-balancing tree (AVL), code a method that returns the median.
- Diego in United States
(Median: the numerical value separating the higher half of a data sample from the lower half. Example: if the series is
2, 7, 4, 9, 1, 5, 8, 3, 6
then the median is 5.)| Report Duplicate | Flag | PURGE
Facebook iOS Developer Trees and Graphs - 3of 3 votes
AnswersCreate the data structure for a component that will receive a series of numbers over the time and, when asked, returns the median of all received elements.
(Median: the numerical value separating the higher half of a data sample from the lower half. Example: if the series is
2, 7, 4, 9, 1, 5, 8, 3, 6
then the median is 5.)
Model the data structure for a component that would have these two methods:@interface SampleHandler { - (void)addNumber:(NSNumber*)number; - (NSNumber*)median; }
Justify your decisions. Calculate the complexity of each method.
- Diego in United States| Report Duplicate | Flag | PURGE
Facebook iOS Developer Data Structures