Skip to main content
The 2025 Developer Survey results are in. Explore insights into technology and tools, careers, community and more. View results.

All Questions

Filter by
Sorted by
Tagged with
0 votes
1 answer
298 views

bubble sort algorithm with nested loops performs better than with one loop JS

Here are 2 bubble sort algorithms: 1: ...
Ben_Sven_Ten's user avatar
0 votes
1 answer
145 views

Six different, concise (and hopefuly readable), sorting algorithms using ES6+ idioms, with some basic unit testing

I'm practicing js, unit testing, and algorithms, so implementing some of the common sorting algorithms and doing some basic unit testing on them seemed like a good exercise. I'm also trying to use ...
NPN328's user avatar
  • 771
0 votes
1 answer
215 views

A New Sorting Algorithm

I have designed an Algorithm for sorting numbers. This algorithm works by sorting an array of any length with random, non-repeating whole numbers in a linear manner by ascending order. Under the ...
Sam Caut's user avatar
4 votes
1 answer
732 views

Performant Sort function for big arrays

In sort(arr), I want to sort an array. Children must be beneath their parent. And children of the same parent are sorted using ...
Helix112's user avatar
  • 143
5 votes
1 answer
88 views

Visualized bubble sort

Recently I created a small app using JavaScript, and I would love for some JavaScript developers if they have the time of day, to tell me their opinions so I can grow and improve. I'm mostly working ...
vukojevicf's user avatar
6 votes
2 answers
449 views

Selection Sort Algorithm (Node.js)

I wanted to implement a selection sort and wanted to make sure that I'm doing it correctly. I wanted to do it in a way that's efficient and use recursion. Please let me know if I am doing this ...
Christopher Chen's user avatar
8 votes
5 answers
317 views

Sort a list of pairs representing an acyclic, partial automorphism

I have this sample data: let trips = [ { from: "DEN", to: "JFK" }, { from: "SEA", to: "DEN" }, { from: 'JFK', to: 'SEA' }, ]; ...
Shivam Bhalla's user avatar
4 votes
2 answers
388 views

Possibly bubble sort algorithm

I'm trying to figure out what to call this sorting algorithm: ...
Ademola Adegbuyi's user avatar
6 votes
2 answers
3k views

Minimum swaps algorithm terminated due to timeout

I have been trying to solve this question. Given an unordered array consisting of consecutive integers [1, 2, 3, …, n], find the minimum number of two-element swaps to sort the array. I was able ...
Ugur Yilmaz's user avatar
3 votes
2 answers
1k views

Merge the two sorted array of numbers into single array

I have written a code were I pass two sorted array of numbers from command line, and out is one array with numbers sorted. the code is as follows, ...
Rahul Shivsharan's user avatar
1 vote
2 answers
193 views

Is there a better way to write insertion sort?

Background I am doing an insertion sort and I would like it to be as efficient as the algorithm allows. Code After much research, this is what I made: ...
Flame_Phoenix's user avatar
4 votes
1 answer
793 views

Radix sort implementation in JS (LSD)

I have written LSD radix sort implementation in JavaScript (6 functions in total). It sorts positive and negative integers: ...
sch's user avatar
  • 143
1 vote
0 answers
698 views

Compute the minimum distance between two points in a 2-D plane

I have tried to calculate the minimum distance between the two points in a 2D plane. I have used the divide and conquer strategy to attain the complexity of n logn. ...
Suhail Gupta's user avatar
2 votes
2 answers
496 views

Merge sort implementation using divide-and-conquer

I was told in an interview to write a program for implementing merge sort on the concept of divide-and-conquer. ...
Rahul Shivsharan's user avatar
2 votes
1 answer
103 views

If given two sorted arrays where first containing -1, merge into one sorted array

If given two arrays arrayOne = [3,6,-1,11,15,-1,32,34,-1,42,-1] arrayTwo = [1,10,17,56] Both the array's are sorted but array1 consists -1 in between the ...
Rahul Shivsharan's user avatar

15 30 50 per page