Bloomberg Interview Questions/Q 4

From Software Engineers Wiki
Jump to: navigation, search

Find summation of n records added in past 60 secs.

Items of the type

struct { 
        int i;
        time_t timestamp;
};

needs to be stored in a C++ container. One of the requirement is to calculate summation of 'i' s of these items added in past 60secs.

What container/datastructure will you use. (number of items can be in the order of 10s of thousands.

Answer

Personal tools
Namespaces

Variants
Actions
Navigation
Toolbox