1.0.16 • Published 1 year ago

@softnami/quicksort v1.0.16

Weekly downloads
6
License
MIT
Repository
github
Last release
1 year ago

Quicksort:

Author: Hussain Mir Ali

Hire me, I can build your next project.

This is a module for the Quicksort algorithm and helps you sort arrays. It is built with TypeScript, is light weight and has no dependencies.

import Quicksort from '@softnami/quicksort';

let arry: number[] = [];

//generating ramdom data for demo
for (let i = 0; i < 10; i++) {
  arry[i] = Math.floor(Math.random() * 5 + 0);
}


//shuffling the array of numbers
for (let i = 0; i < 10; i++) {
  let randomindex = Math.floor(Math.random() * 9 + 0);
  let temp = arry[i];
  arry[i] = arry[randomindex];
  arry[randomindex] = temp;
}

console.log('UnsortedArray', arry);

/*UnsortedArray [
  4, 4, 1, 2, 1,
  4, 3, 2, 2, 4
]*/

let sorter: Quicksort = new Quicksort();
            sorter.sort(arry);

console.log('Sorted Array', arry);

/*Sorted Array [
  1, 1, 2, 2, 2,
  3, 4, 4, 4, 4
]*/
1.0.16

1 year ago

1.0.15

1 year ago

1.0.14

1 year ago

1.0.13

1 year ago

1.0.11

2 years ago

1.0.10

2 years ago

1.0.12

2 years ago

1.0.9

2 years ago

1.0.8

2 years ago

1.0.7

2 years ago

1.0.6

2 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.3

4 years ago

1.0.2

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago