@@ -95,6 +95,42 @@ console.log (cartesian ([1, 2, 3, 4], ['a', 'b', 'c']));
9595```
9696## Java Implementation
9797
98+ ### C++ Implementation
99+
100+ #### [ Solution 1] ( ./C++/day19a.cpp )
101+
102+ ``` cpp
103+ /*
104+ * @author : dhruv-gupta14
105+ * @date : 15/01/2019
106+ */
107+
108+ #include < bits/stdc++.h>
109+ using namespace std ;
110+
111+ int main () {
112+ int n,m;
113+ cin >> n >> m;
114+ int arr1[n];
115+ int arr2[m];
116+
117+ for(int i=0;i<n;i++)
118+ cin >> arr1[i];
119+
120+ for(int j=0;j<m;j++)
121+ cin >> arr2[j];
122+
123+ for(int l=0;l<n;l++)
124+ {
125+ for(int k=0;k<m;k++)
126+ {
127+ cout << arr1[l] << "," << arr2[k] << endl;
128+ }
129+ }
130+ return 0;
131+ }
132+ ```
133+
98134### [ Solution] ( ./Java/cartesianProd.java )
99135
100136``` java
@@ -169,6 +205,7 @@ int main(){
169205### Python Implementation
170206
171207### [ Solution] ( ./Python/cartesian_product.py )
208+
172209``` python
173210'''
174211@author: aaditkamat
@@ -201,6 +238,7 @@ def main():
201238### Python Implementation
202239
203240### [ Solution] ( ./Python/cartesian_product.py )
241+
204242``` python
205243'''
206244@author: aaditkamat
@@ -229,6 +267,7 @@ def main():
229267 set_B = get_input(' B' )
230268 calculate_cartesian_product(set_A, set_B)
231269```
270+
232271***
233272
234273### Python Implementation
@@ -314,6 +353,46 @@ function fisherYates (arr) {
314353fisherYates ([1 , 2 , 3 , 4 , 5 , 6 ]);
315354```
316355
356+ ### C++ Implementation
357+
358+ #### [ Solution 1] ( ./C++/day19b.cpp )
359+
360+ ``` cpp
361+ /*
362+ * @author : dhruv-gupta14
363+ * @date : 15/01/2019
364+ */
365+
366+ #include < bits/stdc++.h>
367+ using namespace std ;
368+
369+ int main () {
370+ int n;
371+ cin >> n;
372+ int arr1[n];
373+
374+ for(int i=0;i<n;i++)
375+ cin >> arr1[i];
376+
377+ int temp=0;
378+ int random_index = 0;
379+
380+ for(int j=0;j<n;j++)
381+ {
382+ random_index = rand() % n;
383+ temp = arr1[j];
384+ arr1[j] = arr1[random_index];
385+ arr1[random_index] = temp;
386+ }
387+
388+ for(int k=0;k<n;k++)
389+ cout << arr1[k] << " ";
390+
391+
392+ return 0;
393+ }
394+ ```
395+
317396## Java Implementation
318397
319398### [ Solution] ( ./Java/FisheYates.java )
@@ -413,4 +492,4 @@ def main():
413492 fisher_yates(lst)
414493
415494main()
416- ```
495+ ```
0 commit comments