#Insertion sorting help

12 messages · Page 1 of 1 (latest)

half daggerBOT
#

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.

hard fossil
#

What do you have so far

#

where are you stuck

#

!f

half daggerBOT
#

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) {
      }
    }
  }
}
SolubleSalt
hard fossil
#

Fixes formatting

half daggerBOT
#

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.
}

SolubleSalt
hard fossil
#

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

half daggerBOT
#

@cloud grotto

Please Do Not Delete Posts!

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.