Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions brc_test1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
from random import randint
import time

# 배열에 10,000개의 정수를 삽입
array = []
for _ in range(10000):
array.append(randint(1, 100)) # 1부터 100 사이의 랜덤한 정수

# 선택 정렬 프로그램 성능 측정
start_time = time.time()

# 선택 정렬 프로그램 소스코드
for i in range(len(array)):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기에 코드 코멘트

min_index = i # 가장 작은 원소의 인덱스
for j in range(i + 1, len(array)):
if array[min_index] > array[j]:
min_index = j
array[i], array[min_index] = array[min_index], array[i] # 스와프

end_time = time.time() # 측정 종료
print("선택 정렬 성능 측정:", end_time - start_time) # 수행 시간 출력

# 배열을 다시 무작위 데이터로 초기화
array = []
for _ in range(10000):

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

여기는 두번째 내 코멘트

array.append(randint(1, 100)) # 1부터 100 사이의 랜덤한 정수

# 기본 정렬 라이브러리 성능 측정
start_time = time.time()

# 기본 정렬 라이브러리 사용
array.sort()

end_time = time.time() # 측정 종료
print("기본 정렬 라이브러리 성능 측정:", end_time - start_time) # 수행 시간 출력
18 changes: 18 additions & 0 deletions fustat2.1_test_01
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
@@ -59,12 +59,12 @@
now = q.popleft()
result.append(now)
# 해당 원소와 연결된 노드들의 진입차수에서 1 빼기
for i in range(1, n + 1):
if graph[now][i]:
indegree[i] -= 1
for j in range(1, n + 1):
if graph[now][j]:
indegree[j] -= 1
# 새롭게 진입차수가 0이 되는 노드를 큐에 삽입
if indegree[i] == 0:
q.append(i)
if indegree[j] == 0:
q.append(j)

# 사이클이 발생하는 경우(일관성이 없는 경우)
if cycle:
20 changes: 20 additions & 0 deletions fustat23.py.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import csv

file_name1 = "weather.csv"
file_name2 = "weather2.csv"
f1 = open(file_name1, "r", encoding="utf-8")
f2 = open(file_name2, "w", encoding="utf-8", newline="")

lines = csv.reader(f1)
wr = csv.writer(f2)

header = next(lines)

for i in range(5) :
line = next(lines)
wr.writerow(line)

print("파일쓰기 종료!")

f1.close()
f2.close()