Recently, I am solving the Cpaw CTF problem as a study of CTF. This time, I also studied Python and implemented bubble sort in Python to solve Q14 of CpawCTF. https://ctf.cpaw.site/questions.php?qnum=14
http://algorithm.wiki/ja/app/ I used an app called "Algorithm Picture Book". It was easy to understand because I could study the sorting method graphically. recommendation.
sortDataList = [15,1,93,52,66,31,87,0,42,77,46,24,99,10,19,36,27,4,58,76,2,81,50,102,33,94,20,14,80,82,49,41,12,143,121,7,111,100,60,55,108,34,150,103,109,130,25,54,57,159,136,110,3,167,119,72,18,151,105,171,160,144,85,201,193,188,190,146,210,211,63,207]
for i in range(len(sortDataList)):
for j in range(len(sortDataList) - 1, i, -1):
if sortDataList[j] > sortDataList[j - 1]:
sortDataList[j], sortDataList[j - 1] = sortDataList[j - 1], sortDataList[j]
flag = map(str, sortDataList)
print(''.join(flag))
I'm not good at implementing algorithms as code, so I wanted to take this opportunity to implement various sorting methods.
Recommended Posts