Python beginners challenge Cpaw CTF Q14 with bubble sort

Introduction

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

What I referred to when studying bubble sort

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.

code

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))

Impressions

I'm not good at implementing algorithms as code, so I wanted to take this opportunity to implement various sorting methods.

Recommended Posts

Python beginners challenge Cpaw CTF Q14 with bubble sort
Python beginners organize bubble sort
Algorithm learned with Python 17th: Sorting (bubble sort)
Bubble sort in Python
Sort huge files with python
Bubble sort with fluffy animation
Challenge LOTO 6 with Python without discipline
[Python] One-liner Stalin sort with 50 characters
# 2 Python beginners challenge AtCoder! ABC085C --Otoshidama
INSERT into MySQL with Python [For beginners]
[Episode 2] Beginners tried Numeron AI with python
[Episode 3] Beginners tried Numeron AI with python
[Episode 0] Beginners tried Numeron AI with python
[Episode 1] Beginners tried Numeron AI with python
[Python] Read images with OpenCV (for beginners)
WebApi creation with Python (CRUD creation) For beginners
Implemented Stooge sort in Python3 (Bubble sort & Quicksort)
How Python beginners get started with Python with Progete
[For beginners] Try web scraping with Python
[Python] Sort
Python # sort
Bubble sort
Bubble sort
Causal reasoning and causal search with Python (for beginners)
Algorithm learned with Python 16th: Sorting (insertion sort)
[Final story] Beginners tried Numeron AI with python
[CpawCTF] Q14. [PPC] Try writing Sort! In Python
~ Tips for Python beginners from Pythonista with love ① ~
Algorithm learned with Python 15th: Sorting (selection sort)
What Python beginners got hooked on with Django
Challenge AtCoder (ABC) 164 with Python! A ~ C problem
~ Tips for Python beginners from Pythonista with love ② ~
[Introduction for beginners] Working with MySQL in Python