Skip to content

Commit 5572a76

Browse files
committed
update docs
1 parent 96b4d9f commit 5572a76

File tree

1 file changed

+27
-53
lines changed

1 file changed

+27
-53
lines changed

README.md

Lines changed: 27 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -5,82 +5,56 @@ Package provides the implementation of various statistics distribution such as n
55

66
# Features
77

8-
* Normal Distribution
9-
10-
- cumulativeProbability(Z)
11-
- invCumulativeProbability(p)
8+
In terms of usage, the user has the following benefit of using the sorting algorithms:
129

13-
* Student's T Distribution
10+
* Customizable comparer function for the sorting function
11+
* Allow user to sort a sublist of an array starting and ending at the user-defined indices
1412

15-
- cumulativeProbability(t_df)
16-
- invCumulativeProbability(p)
13+
In terms of supported algorithms for sorting:
1714

18-
* Fisher–Snedecor Distribution
19-
20-
- cumulativeProbabiliyt(F)
21-
22-
* Chi-Square Distribution
23-
24-
- cumulativeProbabiliy(ChiSquare)
15+
* Selection Sort
16+
* Insertion Sort
17+
* Merge Sort
18+
* Quick Sort
19+
* 3-Ways Quick Sort
20+
* Heap Sort
21+
* Shell Sort
2522

2623
# Install
2724

2825
Run the following npm command to install
2926

3027
```bash
31-
npm install js-sort
28+
npm install js-sorting-algorithms
3229
```
3330

3431
# Usage
3532

36-
Sample code is available at [playground](https://runkit.com/cschen1205/js-sort-playground)
33+
Sample code is available at [playground](https://runkit.com/cschen1205/js-sorting-algorithms-playground)
3734

3835
### Using with nodejs
3936

4037
```javascript
4138
jssort = require('js-sort');
4239

43-
//====================NORMAL DISTRIBUTION====================//
44-
45-
var mu = 0.0; // mean
46-
var sd = 1.0; // standard deviation
47-
var normal_distribution = new jssort.NormalDistribution(mu, sd);
48-
49-
var X = 10.0; // point estimate value
50-
var p = normal_distribution.cumulativeProbability(X); // cumulative probability
51-
52-
var p = 0.7; // cumulative probability
53-
var X = normal_distribution.invCumulativeProbability(p); // point estimate value
54-
55-
//====================T DISTRIBUTION====================//
56-
57-
var df = 10; // degrees of freedom for t-distribution
58-
var t_distribution = new jssort.TDistribution(df);
59-
60-
var t_df = 10.0; // point estimate or test statistic
61-
var p = t_distribution.cumulativeProbability(t_df); // cumulative probability
62-
63-
var p = 0.7;
64-
var t_df = t_distribution.invCumulativeProbability(p); // point estimate or test statistic
65-
66-
67-
//====================F DISTRIBUTION====================//
68-
69-
var df1 = 10; // degrees of freedom for f-distribution
70-
var df2 = 20; // degrees of freedom for f-distribution
71-
var f_distribution = new jssort.FDistribution(df1, df2);
72-
73-
var F = 10.0; // point estimate or test statistic
74-
var p = f_distribution.cumulativeProbability(F); // cumulative probability
40+
//====================Simple====================//
7541

42+
var a = [3, 4, 5, 1, 2, 4, 6, 8, 9, 3, 4, 67, 34, 53, 44, 2];
43+
jssort.insertionSort(a);
44+
console.log(a);
7645

77-
//====================Chi Square DISTRIBUTION====================//
46+
//====================Sort with custom comparer function====================//
47+
var a = [[3, 2.3], [4, 3.1], [5, 1.1], [1, 4.2], [2, 4.2], [4, 5.3], [6, 7.4], [8, 5.1], [9, 1.9], [3, 1.2], [4, 3.4], [67, 6.7], [34, 3], [53, 5], [44, 4.2], [2, 0]];
48+
jssort.insertionSort(a, undefined, undefined, function(a1, a2){
49+
return a1[1] - a2[1];
50+
});
51+
console.log(a);
7852

79-
var df = 10; // degrees of freedom for cs-distribution
80-
var cs_distribution = new jssort.ChiSquareDistribution(df);
8153

82-
var X = 10.0; // point estimate or test statistic
83-
var p = cs_distribution.cumulativeProbability(X); // cumulative probability
54+
//====================Sort sub-arrray a[3:10] ====================//
55+
var a = [3, 4, 5, 1, 2, 4, 6, 8, 9, 3, 4, 67, 34, 53, 44, 2];
56+
jssort.insertionSort(a, 3, 10);
57+
console.log(a);
8458

8559

8660

0 commit comments

Comments
 (0)