FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
Genetic-String-Mapping-Algorithm/src/Helper.cpp at main · vatsalcode/Genetic-String-Mapping-Algorithm · GitHub
vatsalcode
/
Genetic-String-Mapping-Algorithm
Public
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Issues
0
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Issues
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
Genetic-String-Mapping-Algorithm
/
src
/
Helper.cpp
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (43 loc) · 877 Bytes
Breadcrumbs
Genetic-String-Mapping-Algorithm
/
src
/
Helper.cpp
Copy path
File metadata and controls
51 lines (43 loc) · 877 Bytes
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
#
include
"
../include/Helper.h
"
string
convertNumberToBinary
(
int
n,
int
len){
string answer =
"
"
;
while
(n !=
0
) {
answer =
to_string
(n%
2
) + answer;
n = n/
2
;
}
while
(answer.
size
() < len)
answer =
'
0
'
+ answer;
return
answer;
}
string
convertNumberToBinarySimple
(
int
n){
string answer =
"
"
;
while
(n !=
0
) {
answer =
to_string
(n%
2
) + answer;
n = n/
2
;
}
return
answer;
}
//
Returns true if two vectors are equal
bool
twoVectorsEqual
(vector<
int
> v1, vector<
int
> v2){
if
(v1.
size
() == v2.
size
()){
for
(
int
i=
0
;i<v1.
size
();i++){
if
(v1.
at
(i) != v2.
at
(i)){
return
0
;
}
}
return
1
;
}
return
0
;
}
//
Printing an <int> vector and a <string> vector
void
printVector
(vector<
int
> v){
for
(
int
i=
0
;i<v.
size
();i++){
cout<<v[i]<<
"
"
;
}
cout<<endl;
}
void
printStringVector
(vector<string> v){
for
(
int
i=
0
;i<v.
size
();i++){
cout<<v[i]<<endl;
}
}
Back
|
FazBrowse Home
|
New Git URL