Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
P
project1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Xinganlu1
project1
Commits
21cf1aea
Commit
21cf1aea
authored
4 years ago
by
20200519053
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
格式修改
parent
e0d0fb5f
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
13 deletions
+15
-13
20200519053-work1.docx
+0
-0
20200519053-work1.py
+15
-13
No files found.
20200519053-work1.docx
View file @
21cf1aea
No preview for this file type
This diff is collapsed.
Click to expand it.
20200519053-work1.py
View file @
21cf1aea
...
@@ -26,28 +26,30 @@ print('''
...
@@ -26,28 +26,30 @@ print('''
3. Levenshetein string distance
3. Levenshetein string distance
'''
)
'''
)
stra
=
input
(
'input first string:'
)
def
edit_dist
(
stra
,
strb
):
strb
=
input
(
'input second string:'
)
arra
=
[]
arra
=
[]
arrb
=
[]
arrb
=
[]
for
c
in
stra
:
for
c
in
stra
:
arra
.
append
(
c
)
arra
.
append
(
c
)
for
c
in
strb
:
for
c
in
strb
:
arrb
.
append
(
c
)
arrb
.
append
(
c
)
lena
=
len
(
arra
)
lena
=
len
(
arra
)
lenb
=
len
(
arrb
)
lenb
=
len
(
arrb
)
lenboud
=
max
(
lena
,
lenb
)
lenboud
=
max
(
lena
,
lenb
)
arrf
=
[[
0
for
i
in
range
(
0
,
lenboud
+
2
)]
for
i
in
range
(
0
,
lenboud
+
2
)]
arrf
=
[[
0
for
i
in
range
(
0
,
lenboud
+
2
)]
for
i
in
range
(
0
,
lenboud
+
2
)]
for
i
in
range
(
1
,
lenboud
+
2
):
for
i
in
range
(
1
,
lenboud
+
2
):
arrf
[
i
][
0
]
=
i
arrf
[
i
][
0
]
=
i
arrf
[
0
][
i
]
=
i
arrf
[
0
][
i
]
=
i
for
i
in
range
(
1
,
lena
+
1
):
for
i
in
range
(
1
,
lena
+
1
):
for
j
in
range
(
1
,
lenb
+
1
):
for
j
in
range
(
1
,
lenb
+
1
):
if
(
arra
[
i
-
1
]
==
arrb
[
j
-
1
]):
if
(
arra
[
i
-
1
]
==
arrb
[
j
-
1
]):
arrf
[
i
][
j
]
=
arrf
[
i
-
1
][
j
-
1
]
arrf
[
i
][
j
]
=
arrf
[
i
-
1
][
j
-
1
]
else
:
else
:
arrf
[
i
][
j
]
=
min
(
arrf
[
i
][
j
-
1
],
min
(
arrf
[
i
-
1
][
j
],
arrf
[
i
-
1
][
j
-
1
]))
+
1
arrf
[
i
][
j
]
=
min
(
arrf
[
i
][
j
-
1
],
min
(
arrf
[
i
-
1
][
j
],
arrf
[
i
-
1
][
j
-
1
]))
+
1
print
(
'Levenshetein string distance = '
,
arrf
[
lena
][
lenb
])
print
(
'Levenshetein string distance = '
,
arrf
[
lena
][
lenb
])
str1
=
input
(
'input first string:'
)
str2
=
input
(
'input second string:'
)
edit_dist
(
str1
,
str2
)
print
(
'''
print
(
'''
4. Nontechnical problem
4. Nontechnical problem
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment