b'\n_START_ARTICLE_\nPrioritn\xc3\xad vyhled\xc3\xa1vac\xc3\xad strom\n_START_PARAGRAPH_\nPrioritn\xc3\xad vyhled\xc3\xa1vac\xc3\xad strom je datov\xc3\xa1 struktura z oboru teoretick\xc3\xa9 informatiky. Jedn\xc3\xa1 se o strukturu k ukl\xc3\xa1d\xc3\xa1n\xc3\xad bod\xc5\xaf dvourozm\xc4\x9brn\xc3\xbdch, tedy polo\xc5\xbeek, kter\xc3\xa1 krom\xc4\x9b hlavn\xc3\xad hodnoty maj\xc3\xad p\xc5\x99i\xc5\x99azenou je\xc5\xa1t\xc4\x9b \xe2\x80\x9eprioritu\xe2\x80\x9c\xe2\x80\x9c. Samotn\xc3\xa1 struktura je k\xc5\x99\xc3\xad\xc5\xbeencem bin\xc3\xa1rn\xc3\xadho vyhled\xc3\xa1vac\xc3\xadho stromu a prioritn\xc3\xad fronty._NEWLINE_V ka\xc5\xbed\xc3\xa9m uzlu stromu je ulo\xc5\xbeen jednak ten z bod\xc5\xaf j\xc3\xadm za\xc4\x8d\xc3\xadnaj\xc3\xadc\xc3\xadho podstromu, kter\xc3\xbd m\xc3\xa1 nejmen\xc5\xa1\xc3\xad prioritu, jednak hlavn\xc3\xad hodnota (nejl\xc3\xa9pe medi\xc3\xa1n v\xc5\xa1ech hodnot podstromu), kter\xc3\xa1 pod\xc5\x99azen\xc3\xa9 body rozd\xc4\x9bluje do lev\xc3\xa9ho (men\xc5\xa1\xc3\xad nebo rovn\xc3\xa9 hodnoty) a prav\xc3\xa9ho (v\xc4\x9bt\xc5\xa1\xc3\xad hodnoty) podstromu.\n_START_SECTION_\nVytvo\xc5\x99en\xc3\xad stromu\n_START_PARAGRAPH_\ntree construct_tree(data) {_NEWLINE_  if length(data) > 1 {_NEWLINE_  _NEWLINE_    node_point = find_point_with_minimum_priority(data) // nalezen\xc3\xad bodu s nejni\xc5\xbe\xc5\xa1\xc3\xad prioritou_NEWLINE_    _NEWLINE_    reduced_data = remove_point_from_data(data, node_point) // jeho odstran\xc4\x9bn\xc3\xad ze vstupu_NEWLINE_    node_key = calculate_median(reduced_data) // v\xc3\xbdpo\xc4\x8det medi\xc3\xa1nu ze zbytku vstupn\xc3\xadch bod\xc5\xaf_NEWLINE_    _NEWLINE_    // rozd\xc4\x9blen\xc3\xad dat podle medi\xc3\xa1nu_NEWLINE_    left_data = []_NEWLINE_    right_data = []    _NEWLINE_   _NEWLINE_    for (point in reduced_data) {_NEWLINE_      if point.key <= node_key_NEWLINE_         left_data.append(point)_NEWLINE_      else_NEWLINE_         right_data.append(point)_NEWLINE_    }_NEWLINE__NEWLINE_    left_subtree = construct_tree(left_data)_NEWLINE_    right_subtree = construct_tree(right_data)_NEWLINE__NEWLINE_    return node // vr\xc3\xa1cen\xc3\xad podstromu_NEWLINE__NEWLINE_  } else if length(data) == 1 {_NEWLINE_     return leaf node // zb\xc3\xbdvaj\xc3\xadc\xc3\xad bod je vrac\xc3\xadme jako list_NEWLINE_  } else if length(data) == 0 {_NEWLINE_    return null // pr\xc3\xa1zdn\xc3\xbd _NEWLINE_  }}\n_START_SECTION_\nVyhled\xc3\xa1v\xc3\xa1n\xc3\xad v intervalu\n_START_PARAGRAPH_\nTypickou \xc3\xbalohou v prioritn\xc3\xadm vyhled\xc3\xa1vac\xc3\xadm strom\xc4\x9b je nalezen\xc3\xad bod\xc5\xaf s omezenou nejvy\xc5\xa1\xc5\xa1\xc3\xad prioritou a spadaj\xc3\xadc\xc3\xadch do pat\xc5\x99i\xc4\x8dn\xc3\xa9ho intervalu hodnot._NEWLINE_points search_tree(tree, min_key, max_key, max_priority) {_NEWLINE_  root = get_root_node(tree) _NEWLINE_  result = []_NEWLINE_  _NEWLINE_  if get_child_count(root) > 0 {_NEWLINE_      _NEWLINE_    if get_point_priority(root) > max_priority_NEWLINE_      return null // v tomto podstromu v\xc3\xbdsledek nenajdeme_NEWLINE__NEWLINE_    if min_key <= get_point_key(root) <= max_key // je  jedn\xc3\xadm z kandid\xc3\xa1t\xc5\xaf hodnota p\xc5\x99\xc3\xadmo v ko\xc5\x99eni podstromu?_NEWLINE_       result.append(get_point(node))_NEWLINE_   _NEWLINE_    if min_key < get_node_key(root) // m\xc3\xa1 smysl prohled\xc3\xa1vat lev\xc3\xbd podstrom?_NEWLINE_        result.append(search_tree(root.left_sub_tree, min_key, max_key, max_priority))_NEWLINE__NEWLINE_    if get_node_key(root) < max_key // m\xc3\xa1 smysl prohled\xc3\xa1vat prav\xc3\xbd podstrom?_NEWLINE_        result.append(search_tree(root.right_sub_tree, min_key, max_key, max_priority))_NEWLINE_      _NEWLINE_    return result_NEWLINE__NEWLINE_  else { // jsme v listu_NEWLINE_    if get_point_priority(root) < max_priority and min_key <= get_point_key(root) <= max_key // je bod v listu jedn\xc3\xadm z kandid\xc3\xa1t\xc5\xaf?_NEWLINE_       result.append(get_point(node))_NEWLINE_  }}'