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
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
SELECT PT_NAME, PT_NO, GEND_CD, AGE,
CASE WHEN TLNO IS NULL THEN 'NONE'
ELSE TLNO END AS TLNO
FROM PATIENT
WHERE AGE <= 12 AND GEND_CD ='W'
ORDER BY AGE DESC, PT_NAME;
31 changes: 31 additions & 0 deletions 11-Kruskal&Prim/sookyung/네트워크연결 .py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
def find(a):
if a == arr[a]:
return a
arr[a] = find(arr[a])
return arr[a]

def union(from_node, to_node):
a = find(from_node)
b = find(to_node)
if a != b:
arr[a] = b
return True
return False

n = int(input())
m = int(input())
arr = [i for i in range(n+1)]

networks = []
for _ in range(m):
network = list(map(int, input().split()))
networks.append(network)

networks.sort(key=lambda x: x[2])

res = 0
for network in networks:
if union(network[0], network[1]):
res += network[2]

print(res)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
SELECT USER_ID, PRODUCT_ID FROM ONLINE_SALE
GROUP BY USER_ID, PRODUCT_ID
HAVING COUNT(USER_ID) >= 2
ORDER BY USER_ID, PRODUCT_ID DESC
29 changes: 29 additions & 0 deletions 11-Kruskal&Prim/sookyung/최소스패닝트리.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
def find(x):
if x != root[x]:
root[x] = find(root[x])
return root[x]


v, e = map(int, input().split())
root = [i for i in range(v + 1)]
arr = []
answer = 0

for _ in range(e):
arr.append(list(map(int, input().split())))

arr.sort(key=lambda x: x[2])

for a, b, c in arr:
arr1 = find(a)
arr2 = find(b)

if arr1 != arr2:
if arr1 > arr2:
root[arr1] = arr2
else:
root[arr2] = arr1

answer += c

print(answer)