When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
12 messages · Page 1 of 1 (latest)
When your question is answered use !solved to mark the question as resolved.
Remember to ask specific questions, provide necessary details, and reduce your question to its simplest form. For tips on how to ask a good question run !howto ask.
void matchNutsAndBolts(std::vector<Nut>& nuts, std::vector<Bolt>& bolts) {
if (n == b) {
for (size_t i = front() + 1; i < back(); ++i) {
for (size_t j = i; j > front() && *j < *(j - 1); --j) {
}
}
}
}
Fixes formatting
skele code if u wanted to see for the cpp
#include <utility>
#include <vector>
#include "match.hpp"
#include "nuts_and_bolts.hpp"
void matchNutsAndBolts(std::vector<Nut>& nuts, std::vector<Bolt>& bolts) {
if (n == b) {
for (size_t i = front() + 1; i < back(); ++i) {
for (size_t j = i; j > front() && *j < *(j - 1); --j) {
}
}
}
}
// implement your solution here.
}
Does your professor care about performance
are you allowed to use std::sort
std::sort uses some form of quicksort
I'm pretty sure you literally just sort the two arrays
@cloud grotto
Please don't delete forum posts. They can be helpful to refer to later and other members can learn from them. In the future you can use !solved to close a post and mark a post as solved.