Question

Implement Binary Search algorithm to search for a number 70 in the following sorted array of 10 integer numbers. Calculate the total no of mid operations, if statement and else ifcomparison operations and the number of times the loop will execute.

 5  10  25  30  37  46 55  60 65  70

Write a program to traverse a graph using DFS. Apply this algorithm to the following graph and write the sequence of vertices to be travelled. Also calculate the number of times the for loop and if condition will execute in this example.

21 Jan 2021
Answer :
Word Count : 345

Sure, I'll provide you with both the Binary Search algorithm implementation for the given sorted array and a DFS traversal of the provided graph. 

Binary Search Algorithm:

```python
def binary_search(arr, target):
    low, high = 0, len(arr) - 1
    mid_operations = 0
    if_operations = 0
    else_if_operations = 0

    while low <= high:
        mid = (low + high) // 2
        mid_operations += 1

_________ ___ ____ ___ __________ _________ ______ ____ ______ _______.
___ ____ ______ __________ ______ __________ _________ _______.
___ ____ _______ ___ ___ ____ _________.
____ _________ ________ ______ ______ ____ __________ _______.
___ ________ ________ ____ ______ _____ _____.
_________ _______ ____ __________ _____ ____.
________ ______ ____ ___ ______ _______.
____ ____ _______ ___ ____ ___ ____.
___ ________ ___ _________ ______ ______ ____ ____ _________ _____ __________ _______.
__________ ___ ___ _________ _________ _____ __________ ________ ______ ________ ____ ______.
_____ _______ ____ __________ ________ _________ __________ ________ _______.
__________ ________ __________ ________ _________ __________.
_________ ___ ___ ______ _________ ________ ______ _________.
___ ____ ________ ___ _________ ___ _________ ________ __________ _________ ________ ___.
_____ _________ ______ __________ _____ ___ _________ _________ ____ _________ ________ ____.
______ _________ __________ ________ _______ __________ _______.
________ _________ __________ ____ _________ _______.
___ _________ _____ _____ ________ ________ ____ ____.
__________ _________ _______ ____ __________ _______ ___ ________ _____ _____.
_______ ____ ______ _______ _____ ____ ___ __________ _______ _________ ____ _____.
_________ ___ ______ _______ _____.
______ _______ _____ ______ ________ ________.
_____ ______ ______ __________ __________ ______ ______ ______ ____ ______ ___ _______.
___ ________ _________ __________ ______ ________ ___ ____ ________ __________ _________ ___.
_____ _______ ________ ______ _____ ____.
_____ _________ _____ _________ __________ _____ _____ _______.
________ ___ ______ _________ _______ _________ ______ __________ ____.
______ ______ ______ __________ _______ __________ ____.
___ ______ ____ __________ ________ _________ _________ __________ __________ ________.
________ ____ __________ ___ ___ ______ ________ _____ _________.
_____ ____.
Get Full Answer on WhatsApp
IGNOU NEWS
Assignment Submission Last Date Extended Till 30 June 2026 Click Here★★★IGNOU June 2026 TEE Date Sheet Released Click Here★★★
Top
📞
Call Support Instant phone assistance Implement Binary Search algorithm to search for a number 70 in the fol
→
🟢
WhatsApp Chat Fast live messaging
→
Email Us Business enquiries & support
→