# Function to build a segment tree using minimum operation
def build_segment_tree(arr, tree, node, start, end):
    if start == end:
        tree[node] = arr[start]
    else:
        mid = (start + end) // 2
        left_child = 2 * node + 1
        right_child = 2 * node + 2

        build_segment_tree(arr, tree, left_child, start, mid)
        build_segment_tree(arr, tree, right_child, mid + 1, end)

        tree[node] = min(tree[left_child], tree[right_child])

# Example usage
arr = [1, 2, 3, 4]
n = len(arr)
tree = [0] * (4 * n)  # Adjust the size of the tree based on the array length

build_segment_tree(arr, tree, 0, 0, n - 1)
print("Segment Tree:", tree)
