Algotests
1.0.0
2014/15 년 이후 Dati e Algoritmi Unipd 클래스 테스트 및 연습의 코퍼스.
우리는 코드를 쉽게 이해하기 쉽기 때문에 코드를 작성하려고 했으므로 코드를 작성하는 방법을 모르더라도 솔루션을 탐색하고 알고리즘의 작동 방식을 확인할 수 있습니다. 예를 들어
def is_max_heap(a):
" " "
:param a: list
Array organized as max-heap
:return: bool
Checks if array a is a max-heap
" " "
for i in range(len(a)):
parent = a[i]
if left_child_index(i) in range(len(a)):
l_child = a[left_child_index(i)] # left child of node
else:
l_child = None
if right_child_index(i) in range(len(a)):
r_child = a[right_child_index(i)] # right child of node
else:
r_child = None
if (not check_child(l_child, parent)) or (not check_child(r_child, parent)):
return False
return True배열이 최대 상품인지 확인하는 최적의 알고리즘입니다.
GitHub 문제 추적기는 버그 보고서 및 기능 요청에만 해당 됩니다. 도움을 요청하는 질문과 같은 다른 것은 상세한 동기 부여가있는 pull request 으로 게시해야합니다.
가입하고 싶습니까? 왜 안 돼? Github 페이지를 확인하고 이메일을 보내거나 Facebook에서 우리를 팔로우하십시오!
2004 년 1 월 Apache 라이센스 버전 2.0