Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I need some help with this Software Engineering question! #include using namespace std; string ltrim(const string &); string rtrim(const string &); // Complete the

Hi, I need some help with this Software Engineering question!

image text in transcribed

#include

using namespace std;

string ltrim(const string &);

string rtrim(const string &);

// Complete the recentlyAccessedLog function below.

vector recentlyAccessedLog(vector eids, int buffer_size) {

}

int main()

{

ofstream fout(getenv("OUTPUT_PATH"));

string eids_count_temp;

getline(cin, eids_count_temp);

int eids_count = stoi(ltrim(rtrim(eids_count_temp)));

vector eids(eids_count);

for (int i = 0; i

string eids_item;

getline(cin, eids_item);

eids[i] = eids_item;

}

string buffer_size_temp;

getline(cin, buffer_size_temp);

int buffer_size = stoi(ltrim(rtrim(buffer_size_temp)));

vector res = recentlyAccessedLog(eids, buffer_size);

for (int i = 0; i

fout

if (i != res.size() - 1) {

fout

}

}

fout

fout.close();

return 0;

}

string ltrim(const string &str) {

string s(str);

s.erase(

s.begin(),

find_if(s.begin(), s.end(), not1(ptr_fun(isspace)))

);

return s;

}

string rtrim(const string &str) {

string s(str);

s.erase(

find_if(s.rbegin(), s.rend(), not1(ptr_fun(isspace))).base(),

s.end()

);

return s;

}

You are software engineer who is working on Iaaccess control system. Your task is to develop a recently-accessed-log to hold employee IDs (strings) uniquely in Last-In-First Out order . A recently-accessed-log is initially empty. The most recently added employee ID is first, the least recently added employee ID is last. Employee IDs in the list are unique, so duplicate insertions are moved rather than added. Null insertions (empty strings) are not allowed. .A bounded capacity can be specified, so there is an upper limit to the number of Employee IDs contained, with the least recently added Employee IDs dropped on overflow. Example1: Lets assume our input array of employee IDs is ("Eva", "Maxim", "Sophia" and buffer_size is 5. The array size is buffer-size, hence the output should be ('Sophia Input: String array and integer number Output: String array You are software engineer who is working on Iaaccess control system. Your task is to develop a recently-accessed-log to hold employee IDs (strings) uniquely in Last-In-First Out order . A recently-accessed-log is initially empty. The most recently added employee ID is first, the least recently added employee ID is last. Employee IDs in the list are unique, so duplicate insertions are moved rather than added. Null insertions (empty strings) are not allowed. .A bounded capacity can be specified, so there is an upper limit to the number of Employee IDs contained, with the least recently added Employee IDs dropped on overflow. Example1: Lets assume our input array of employee IDs is ("Eva", "Maxim", "Sophia" and buffer_size is 5. The array size is buffer-size, hence the output should be ('Sophia Input: String array and integer number Output: String array

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

More Books

Students also viewed these Databases questions