python_data_scien/algorithmic_thinking2/project3/alg_project3_solution.py
def slow_closest_pair(cluster_list):
    """
    Compute the distance between the closest pair of clusters in a list (slow)

    Input: cluster_list is the list of clusters
    
    Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters
    cluster_list[idx1] and cluster_list[idx2] have minimum distance dist.       
    """
    result_tuple = (float('inf'),-1,-1)
    for idx_i in range(len(cluster_list)):
        for idx_j in range(len(cluster_list)):
            if idx_i != idx_j:
                temp_tuple = pair_distance(cluster_list,idx_i,idx_j)
                #cluster_dist = cluster_list[idx_i].distance(cluster_list[idx_j])
                if temp_tuple[0] < result_tuple[0]:
                    result_tuple = temp_tuple
    return result_tuple

    Compute the distance between the closest pair of clusters in a list (slow)

    Input: cluster_list is the list of clusters
    
    Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters
    cluster_list[idx1] and cluster_list[idx2] have minimum distance dist.       
    
Compute the distance between the closest pair of clusters in a list (slow)
Input: cluster_list is the list of clusters

tuple of the form (dist, idx1, idx2) where the centers of the clusters
cluster_list[idx1] and cluster_list[idx2] have minimum distance dist.
Compute the distance between the closest pair of clusters in a list ( slow ) Input : cluster_list is the list of clusters tuple of the form ( dist idx1 idx2 ) where the centers of the clusters cluster_list [ idx1 ] and cluster_list [ idx2 ] have minimum distance dist .
def slow_closest_pair(cluster_list):
    result_tuple = (float('inf'),-1,-1)
    for idx_i in range(len(cluster_list)):
        for idx_j in range(len(cluster_list)):
            if idx_i != idx_j:
                temp_tuple = pair_distance(cluster_list,idx_i,idx_j)
                if temp_tuple[0] < result_tuple[0]:
                    result_tuple = temp_tuple
    return result_tuple
def slow_closest_pair ( cluster_list ) : result_tuple = ( float ( 'inf' ) , - 1 , - 1 ) for idx_i in range ( len ( cluster_list ) ) : for idx_j in range ( len ( cluster_list ) ) : if idx_i != idx_j : temp_tuple = pair_distance ( cluster_list , idx_i , idx_j ) if temp_tuple [ 0 ] < result_tuple [ 0 ] : result_tuple = temp_tuple return result_tuple
Compute the distance between the closest pair of clusters in a list (slow)
Input: cluster_list is the list of clusters
Compute the distance between the closest pair of clusters in a list ( slow ) Input : cluster_list is the list of clusters
"""
    Compute the distance between the closest pair of clusters in a list (slow)

    Input: cluster_list is the list of clusters
    
    Output: tuple of the form (dist, idx1, idx2) where the centers of the clusters
    cluster_list[idx1] and cluster_list[idx2] have minimum distance dist.       
    """ #cluster_dist = cluster_list[idx_i].distance(cluster_list[idx_j])

cluster_list