forked from TamimEhsan/AlgorithmVisualizer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdetails.jsx
More file actions
115 lines (107 loc) · 4.68 KB
/
Copy pathdetails.jsx
File metadata and controls
115 lines (107 loc) · 4.68 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
import React, {Component} from 'react';
class Details extends Component {
Switcherr = () => {
switch (this.props.algo) {
case 0:
return <div className='row bg-info m-0 p-2'>
<div className='col-3 card me-1 bg-light '>
The Fibonacci sequence, in which each number is the sum of the two preceding ones. The sequence
commonly starts from 0 and 1
</div>
<div className='col-3 card me-1 bg-light '>
N = Nth fibonacchi Number
</div>
<div className='col-3 bg-light '>
function = nCr(n,r)
</div>
<div className='col-3 card me-1 bg-light'>
Fib(0) = 0 <br/>
Fib(1) = 1 <br/>
Fib(n) = Fib(n-1) + Fib(n-2)
</div>
</div>;
case 1:
return <div className='row bg-info m-0 p-2 '>
<div className='col-3 card me-1 bg-light'>
In mathematics, the binomial coefficients are the positive integers that occur as coefficients
in the binomial theorem. It is the coefficient of
the x^k term in the polynomial expansion of the binomial power (1+x)^n
</div>
<div className='col-3 card me-1 bg-light'>
nCr = n! / ( k! * (n-k)! )
</div>
<div className='col-3 card me-1 bg-light'>
function = nCr(n,r)
</div>
<div className='col-3 card me-1 bg-light'>
nCr(a,a) = 1 <br/>
nCr(a,0) = 1 <br/>
nCr(n,r) = nCr(n-1,r-1)+nCr(n-1,r)
</div>
</div>;
case 2:
return <div className='row bg-info m-0 p-2 '>
<div className='col-3 card me-1 bg-light '>
In combinatorial mathematics, a derangement is a permutation of the elements of a set, such that
no element appears in its original position.
</div>
<div className='col-3 card me-1 bg-light '>
N = Nth Derangement
</div>
<div className='col-3 card me-1 bg-light '>
function = der(n)
</div>
<div className='col-3 card me-1 bg-light '>
der(0) = 1 <br/>
der(1) = 0 <br/>
der(n) = (n-1) * ( der(n-1) + der(n-2) )
</div>
</div>;
case 3:
return <div className='row bg-info m-0 p-2 '>
<div className='col-3 card me-1 bg-light '>
N = Number
P = Power
</div>
<div className='col-3 card me-1 bg-light '>
function = bigmod(n,p)
</div>
<div className='col-3 card me-1 bg-light '>
bigmod(a,0) = 1 <br/>
bigmod(a,1) = a <br/>
bigmod(n,p) = bigmod(n,p/2)^2; p is even <br/>
bigmod(n,p) = bigmod(n,(p-1)/2)^2 * n ; p is odd
</div>
</div>;
case 4:
return <div className='row bg-info m-0 p-2 '>
<div className='col-3 card me-1 bg-light '>
a Stirling number of the second kind (or Stirling partition number) is the number of ways to
partition a set of n objects into k non-empty subsets
</div>
<div className='col-3 card me-1 bg-light '>
N = Row
R = Column
</div>
<div className='col-3 card me-1 bg-light '>
function = stir2(n,r)
</div>
<div className='col-3 card me-1 bg-light '>
stir2(a,a) = 1 <br/>
stir2(0,a) = 0 <br/>
stir2(n,r) = stir2(n-1,r) * r + stir2(n-1,r-1)
</div>
</div>;
default:
return <b>Henlo</b>;
}
}
render() {
return (
<div>
{this.Switcherr()}
</div>
);
}
}
export default Details;