text_plain_output_1.png
def binary_search_recursive(array, element, start, end):
    if start > end:
        return -1
    mid = (start + end) // 2
    if element == array[mid]:
        return mid
    if element < array[mid]:
        return binary_search_recursive(array, element, start, mid - 1)
    else:
        return binary_search_recursive(array, element, mid + 1, end)

element = 35
array = list(range(1, 1000))
n = 1000

def binary_search_recursive(array, element, start, end):
    if start > end:
        return -1
    mid = (start + end) // 2
    if element == array[mid]:
        return mid
    if element < array[mid]:
        return binary_search_recursive(array, element, start, mid - 1)
    else:
        return binary_search_recursive(array, element, mid + 1, end)
element = 50
array = [10, 20, 30, 40, 50, 60, 70]

def selectionSort(array, size):
    for step in range(size):
        min_idx = step
        for i in range(step + 1, size):
            if array[i] < array[min_idx]:
                min_idx = i
        array[step], array[min_idx] = (array[min_idx], array[step])
data = [10, 5, 30, 15, 50, 6, 25]
size = len(data)
selectionSort(data, size)
print('Menurut Selection Sort:')
print(data)