Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Activity: Frequency count Graded Playground Autograder This is due on Tuesday, January 3 0 , 2 0 2 4 at 2 3 : 5 9

Activity: Frequency count
Graded Playground Autograder
This is due on Tuesday, January 30,2024 at 23:59 CST
You have not attempted this activity. You currently have 0% for this activity.
In this question, you will count how often specific numbers appear in a 2D vector and store that information in a map. Your solution will require the application of multiple lesson topics you have seen so far!
You will finish implementing the function FrequencyCount. This function takes in a 2D vector of ints called data_set and a vector of specific numbers to count in that 2D vector called numbers_of_interest . This function returns a map where the keys are the specific numbers and values are those specific number's counts.
std::map FrequencyCount(
const std::vector>& data_set,
const std::vector& numbers_of_interest);
Example
std::vector> data_set{
{1,2,4,7},{4,-1}}; // declares + initializes a non-rectangular 2D vector of ints
std::vector numbers_of_interest{
4,7,11}; // declares + initializes a vector of ints
The function, given the above inputs, should return a map that looks like:
{{4,2},{7,1},{11,0}}
where each tuple (i.e.,{4,2}) is a {key, value} pair. So given the entry {4,2},4 maps to 2. In the context of this problem, that means that 4 was counted 2 times in the data set!
Things to Note
There will be no duplicate values in numbers_of_interest.
data_set does NOT have to be rectangular (see example above).
Helpful Tips
Here is some code reminding you how to interact with a 2D vector:

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Navigating The Supply Chain Maze A Comprehensive Guide To Optimize Operations And Drive Success

Authors: Michael E Kirshteyn Ph D

1st Edition

B0CPQ2RBYC, 979-8870727585

More Books

Students also viewed these Databases questions