Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

//main.cpp #include #include #include using namespace std; vector zigZag(vector v1, vector v2){ //write your code here return result; } int main(){ vector v1, v2; v1

image text in transcribed

//main.cpp

#include

#include

#include

using namespace std;

vector zigZag(vector v1, vector v2){

//write your code here

return result;

}

int main(){

vector v1, v2;

v1 = {50,40,20,30,10};

v2 = {1,2,3,4,5};

vectoranswer = zigZag(v1,v2);

cout

for (int i =0; i

cout

}

return 0;

}

The Problem Task: you need to merge two vectors using two priprity queues to form a zig-zag vector. The zigzag vector should have the sorted vectors interspersed with each other. Example output: vec1 50,30, 20,40, 10 vec2 8,6,7,9,5 result 150,9, 40,8, 30,7, 20,6, 10,5 Compile and Test A complete Makefile and a main. cpp file containing one simple test has been provided for you. To compile and run, run: make ./main

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

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions