コード例 #1
0
def test_quick_select_finds_lowest_number_in_list():
    array = [1, 5, 3, 2, 9, 7, 4]
    result = quick_select(array, 0, len(array) - 1, 0, sort_in_ascending)
    assert result == 1
コード例 #2
0
def test_quick_select_gets_median_of_text():
    array = parse_text(text)
    result = quick_select(array, 0, len(array) - 1, len(array) / 2, sort_in_ascending)
    assert result == 5001