Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

177
Views
Cómo escribir una clasificación de combinación con JavaScript en Vue.Js

Intento hacer una ordenación de combinación simple con JavaScript en Vue.Js. Estas son las funciones que creé. Pero la salida no puede ordenar la matriz de forma ascendente.

 mergeSort(arr) { if (arr.length <= 1) { this.data.arrNum = arr; } console.log("arr", arr); let mid = Math.floor(arr.length / 2); let left = arr.slice(0, mid); console.log("left", left); let right = arr.slice(mid); console.log("right", right); this.merge(left, right); }, merge: function (left, right) { var leftIndex = 0; var rightIndex = 0; var results = []; while (leftIndex < left.length && rightIndex < right.length) { if (left[leftIndex] < right[rightIndex]) { results.push(left[leftIndex]); leftIndex++ } else { results.push(right[rightIndex]); rightIndex++; } } results = results .concat(left.slice(leftIndex)) .concat(right.slice(rightIndex)); this.data.arrNum = results; }, } };

Muestra Matriz original Antes de ordenar Salida Después de ordenar

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!