Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 00690f9

Browse files
committed
Add CID-127
1 parent 0d1429b commit 00690f9

File tree

23 files changed

+4240
-2
lines changed

23 files changed

+4240
-2
lines changed

‎hard/127-code-plagiarism/dataset/1_1

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<<< Python The same code
2+
3+
def quickSort(alist):
4+
quickSortHelper(alist,0,len(alist)-1)
5+
6+
def quickSortHelper(alist,first,last):
7+
if first<last:
8+
9+
splitpoint = partition(alist,first,last)
10+
11+
quickSortHelper(alist,first,splitpoint-1)
12+
quickSortHelper(alist,splitpoint+1,last)
13+
14+
15+
def partition(alist,first,last):
16+
pivotvalue = alist[first]
17+
18+
leftmark = first+1
19+
rightmark = last
20+
21+
done = False
22+
while not done:
23+
24+
while leftmark <= rightmark and \
25+
alist[leftmark] <= pivotvalue:
26+
leftmark = leftmark + 1
27+
28+
while alist[rightmark] >= pivotvalue and \
29+
rightmark >= leftmark:
30+
rightmark = rightmark -1
31+
32+
if rightmark < leftmark:
33+
done = True
34+
else:
35+
temp = alist[leftmark]
36+
alist[leftmark] = alist[rightmark]
37+
alist[rightmark] = temp
38+
39+
temp = alist[first]
40+
alist[first] = alist[rightmark]
41+
alist[rightmark] = temp
42+
43+
44+
return rightmark
45+
46+
=====
47+
48+
def quickSort(alist):
49+
quickSortHelper(alist,0,len(alist)-1)
50+
51+
def quickSortHelper(alist,first,last):
52+
if first<last:
53+
54+
splitpoint = partition(alist,first,last)
55+
56+
quickSortHelper(alist,first,splitpoint-1)
57+
quickSortHelper(alist,splitpoint+1,last)
58+
59+
60+
def partition(alist,first,last):
61+
pivotvalue = alist[first]
62+
63+
leftmark = first+1
64+
rightmark = last
65+
66+
done = False
67+
while not done:
68+
69+
while leftmark <= rightmark and \
70+
alist[leftmark] <= pivotvalue:
71+
leftmark = leftmark + 1
72+
73+
while alist[rightmark] >= pivotvalue and \
74+
rightmark >= leftmark:
75+
rightmark = rightmark -1
76+
77+
if rightmark < leftmark:
78+
done = True
79+
else:
80+
temp = alist[leftmark]
81+
alist[leftmark] = alist[rightmark]
82+
alist[rightmark] = temp
83+
84+
temp = alist[first]
85+
alist[first] = alist[rightmark]
86+
alist[rightmark] = temp
87+
88+
89+
return rightmark

‎hard/127-code-plagiarism/dataset/1_2

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
<<< Go The same code
2+
3+
package main
4+
5+
import (
6+
"fmt"
7+
8+
"github.com/google/go-github/github"
9+
)
10+
11+
func main() {
12+
client := github.NewClient(nil)
13+
14+
fmt.Println("Recently updated repositories owned by user willnorris:")
15+
16+
opt := &github.RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"}
17+
repos, _, err := client.Repositories.List("willnorris", opt)
18+
if err != nil {
19+
fmt.Printf("error: %v\n\n", err)
20+
} else {
21+
fmt.Printf("%v\n\n", github.Stringify(repos))
22+
}
23+
24+
rate, _, err := client.RateLimit()
25+
if err != nil {
26+
fmt.Printf("Error fetching rate limit: %#v\n\n", err)
27+
} else {
28+
fmt.Printf("API Rate Limit: %#v\n\n", rate)
29+
}
30+
}
31+
32+
=====
33+
34+
package main
35+
36+
import (
37+
"fmt"
38+
39+
"github.com/google/go-github/github"
40+
)
41+
42+
func main() {
43+
client := github.NewClient(nil)
44+
45+
fmt.Println("Recently updated repositories owned by user willnorris:")
46+
47+
opt := &github.RepositoryListOptions{Type: "owner", Sort: "updated", Direction: "desc"}
48+
repos, _, err := client.Repositories.List("willnorris", opt)
49+
if err != nil {
50+
fmt.Printf("error: %v\n\n", err)
51+
} else {
52+
fmt.Printf("%v\n\n", github.Stringify(repos))
53+
}
54+
55+
rate, _, err := client.RateLimit()
56+
if err != nil {
57+
fmt.Printf("Error fetching rate limit: %#v\n\n", err)
58+
} else {
59+
fmt.Printf("API Rate Limit: %#v\n\n", rate)
60+
}
61+
}

‎hard/127-code-plagiarism/dataset/2_1

Lines changed: 131 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,131 @@
1+
<<< Python Changed names of variables
2+
3+
MAX_SIZE = 100
4+
5+
class Mapping:
6+
def __init__(self, iterable):
7+
self.items_list = []
8+
self.__update(iterable)
9+
10+
def update(self, iterable):
11+
for item in iterable:
12+
self.items_list.append(item)
13+
14+
__update = update # private copy of original update() method
15+
16+
17+
class MappingSubclass(Mapping):
18+
19+
def update(self, keys, values):
20+
# provides new signature for update()
21+
# but does not break __init__()
22+
for item in zip(keys, values):
23+
self.items_list.append(item)
24+
25+
def quickSort(alist):
26+
quickSortHelper(alist,0,len(alist)-1)
27+
28+
def quickSortHelper(alist,first,last):
29+
if first<last:
30+
31+
splitpoint = partition(alist,first,last)
32+
33+
quickSortHelper(alist,first,splitpoint-1)
34+
quickSortHelper(alist,splitpoint+1,last)
35+
36+
37+
def partition(alist,first,last):
38+
pivotvalue = alist[first]
39+
40+
leftmark = first+1
41+
rightmark = last
42+
43+
done = False
44+
while not done:
45+
46+
while leftmark <= rightmark and \
47+
alist[leftmark] <= pivotvalue:
48+
leftmark = leftmark + 1
49+
50+
while alist[rightmark] >= pivotvalue and \
51+
rightmark >= leftmark:
52+
rightmark = rightmark -1
53+
54+
if rightmark < leftmark:
55+
done = True
56+
else:
57+
temp = alist[leftmark]
58+
alist[leftmark] = alist[rightmark]
59+
alist[rightmark] = temp
60+
61+
temp = alist[first]
62+
alist[first] = alist[rightmark]
63+
alist[rightmark] = temp
64+
65+
66+
return rightmark
67+
68+
=====
69+
70+
SIZE = 100
71+
72+
class Map:
73+
def __init__(self, iter):
74+
self.i_list = []
75+
self.__upd(iterable)
76+
77+
def upd(self, iterat):
78+
for item in iterat:
79+
self.i_list.append(item)
80+
81+
__upd = upd # private copy of original update() method
82+
83+
class MapSub(Map):
84+
85+
def upd(self, keys, values):
86+
# provides new signature for update()
87+
# but does not break __init__()
88+
for item in zip(keys, values):
89+
self.items_list.append(item)
90+
91+
def qS(mylst):
92+
qSH(mylst,0,len(mylst)-1)
93+
94+
def qSH(mylst,start,end):
95+
if start<end:
96+
97+
centersplit = Myfunc(mylst,start,end)
98+
99+
qSH(mylst,start,centersplit-1)
100+
qSH(mylst,centersplit+1,end)
101+
102+
103+
def Myfunc(mylist,start,finish):
104+
tempvalue = mylist[start]
105+
106+
left = start+1
107+
right = finish
108+
109+
done = False
110+
while not done:
111+
112+
while left <= right and \
113+
mylist[left] <= tempvalue:
114+
left = left + 1
115+
116+
while mylist[right] >= tempvalue and \
117+
right >= left:
118+
right = right -1
119+
if right < left:
120+
done = True
121+
else:
122+
temp = mylist[left]
123+
mylist[left] = mylist[right]
124+
mylist[right] = temp
125+
126+
temp = mylist[start]
127+
mylist[start] = mylist[right]
128+
mylist[right] = temp
129+
130+
131+
return right

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /