if you want to remove an article from website contact us from top.

    what is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?

    Mohammed

    Guys, does anyone know the answer?

    get what is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n? from screen.

    GATE

    A Computer Science portal for geeks. It contains well written, well thought and well explained computer science and programming articles, quizzes and practice/competitive programming/company interview Questions.

    GATE | GATE CS 2021 | Set 2 | Question 18

    Last Updated : 23 May, 2021

    What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?

    (A) Θ(√n)(B) Θ(log2(n))(C) Θ(n2)(D) Θ(n)Answer: (B)Explanation: Arithmetic operations performed by binary search on sorted data items means computation of mid element required arithmetic operation. So it will be computed log(n) time and Hence option (C) will be correct.

    Quiz of this Question

    Previous

    GATE | GATE CS 2021 | Set 2 | Question 17

    Next

    GATE | GATE CS 2021 | Set 2 | Question 19

    RECOMMENDED ARTICLES

    Page : 1 2 3 4 5 6

    GATE | GATE CS 2021 | Set 1 | Question 61

    24, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 62

    24, Feb 21

    GATE | GATE CS 2021 | Set 2 | Question 41

    26, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 44

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 42

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 43

    21, Feb 21

    GATE | GATE CS 2021 | Set 2 | Question 63

    03, Mar 21

    GATE | GATE CS 2021 | Set 1 | Question 1

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 2

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 3

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 4

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 5

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 6

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 8

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 7

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 9

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 10

    17, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 11

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 12

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 13

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 14

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 15

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 16

    21, Feb 21

    GATE | GATE CS 2021 | Set 1 | Question 17

    21, Feb 21

    Article Contributed By :

    GeeksforGeeks Vote for difficulty Article Tags : GATE Report Issue

    स्रोत : www.geeksforgeeks.org

    Algorithms: GATE CSE 2021 Set 2

    What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size ... $\Theta(n^2)$ $\Theta(n)$

    GATE CSE 2021 Set 2 | Question: 8

    asked in Algorithms Feb 18, 2021

    recategorized Apr 11, 2021 by Lakshman Patel RJIT

    5,647 views

    4 Comments

    3 Answers

    4 Comments

    Show 2 previous comments

    3 Comments

    Answer: ← Previous Next →

    ← Previous in category

    Next in category →

    Related questions

    Send feedback Rank Predictor College Prediction Useful Links FAQ Corrections Discuss Copyright Request Testimonials Chat Logs Chat Badges Search tips Exam Category Blog Category Blog Tags Privacy Test Series Contact Us

    Developed by Chun

    स्रोत : gateoverflow.in

    [Solved] What is the worst

    The correct answer is option 3: Key Points Binary search has the Worst-case and avg case time complexity O(log2n) and best case O(1) in an array. So, i

    Home Algorithms Searching, Sorting and Hashing Searching Binary

    Question

    Download Solution PDF

    What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?

    This question was previously asked in

    GATE CS 2021 Official Paper: Shift 2

    Attempt Online

    View all GATE CS Papers >

    θ(n) θ(√n) θ(log2(n)) θ(n2)

    Answer (Detailed Solution Below)

    Option 3 : θ(log2(n))

    Crack GATE CSE with

    India's Super Teachers

    FREE

    Demo Classes Available*

    Explore Supercoaching For FREE

    Free Tests

    View all Free tests >

    FREE

    CT 1: Ratio and Proportion

    8K Users

    10 Questions 16 Marks 30 Mins

    Start Now

    Detailed Solution

    Download Solution PDF

    The correct answer is option 3:

    Key Points

    Binary search has the Worst-case and avg case time complexity O(log2n) and best case O(1) in an array. So, it is can also be written as θ(log2n)

    and θ (1).

    No of arithmetic operations will be θ (logn) in the worst case as every comparison needs 2 operations + and / by 2.

    Download Solution PDF

    Share on Whatsapp

    India’s #1 Learning Platform

    Start Complete Exam Preparation

    Daily Live MasterClasses

    Practice Question Bank

    Mock Tests & Quizzes

    Get Started for Free

    Download App

    Trusted by 3,17,13,925+ Students

    ‹‹ Previous Ques Next Ques ››

    More Searching Questions

    Q1. Suppose we are given n keys, m hash table slots, and two simple uniform hash functions h1 and h2. Further, suppose our hashing scheme uses h1 for the odd keys and h2 for the even keys. What is the expected number of keys in a slot?Q2. Consider a hash table of size 7 implemented using an array A[0 ... 6]. A modulo hash function (MOD 7) is used to map the keys, and open addressing is used to handle collisions. If 53, 32, 43, 51, 99 are inserted into the hash table, the contents of array A isQ3. Consider a 13 element hash table for which f(key) = key mod 13 is used with integer keys. Assuming linear probing is used for collision resolution, at which location would the key 103 be inserted, if the keys 661, 182, 24 and 103 are inserted in that order?Q4. Consider a dynamic hashing approach for 4-bit integer keys: 1. There is a main hash table of size 4. 2. The 2 least significant bits of a key is used to index into the main hash table. 3. Initially, the main hash table entries are empty. 4. Thereafter, when more keys are hashed into it, to resolve collisions, the set of all keys corresponding to a main hash table entry is organized as a binary tree that grows on demand. 5. First, the 3rd least significant bit is used to divide the keys into left and right subtrees. 6. to resolve more collisions, each node of the binary tree is further sub-divided into left and right subtrees based on 4th least significant bit. 7. A split is done only if it is needed, i. e. only when there is a collision. Consider the following state of the hash table. Which of the following sequence of key insertions can cause the above state of the hash table (assume the keys are in decimal notation)?Q5. What is the worst-case number of arithmetic operations performed by recursive binary search on a sorted array of size n?Q6. Which open addressing technique is free from Clustering problems?Q7. Finding the location of the element with a given value is:Q8. The average successful search time for sequential search on ‘n’ items isQ9. For which of the following tasks, stack is not suitable data structure? (a) Binary search in an array (b) Breadth first search (c) Implementing function calls (d) Process scheduling

    More Searching, Sorting and Hashing Questions

    Q1. Suppose we are given n keys, m hash table slots, and two simple uniform hash functions h1 and h2. Further, suppose our hashing scheme uses h1 for the odd keys and h2 for the even keys. What is the expected number of keys in a slot?Q2. What is the formula to be used to calculate the total number of comparisons in bubble sort with n elements after k iterations?Q3. Consider a hash table of size 7 implemented using an array A[0 ... 6]. A modulo hash function (MOD 7) is used to map the keys, and open addressing is used to handle collisions. If 53, 32, 43, 51, 99 are inserted into the hash table, the contents of array A isQ4. Consider the following array of elements  <70, 23, 60, 19, 13, 16, 1, 4, 8, 12, 7, 10, 85> The minimum number of interchanges needed to convert into a max-heap isQ5. Which of the following is not a stable sorting algorithm in its typical implementation?Q6. Which one of the following algorithms cannot sort n numbers in O(n) comparisons?Q7. In _______, records are placed in the order in which they are inserted, so new records are inserted at the end of the file.Q8. Which of the following is the worst-case time complexity of the merge-sort algorithm?Q9. The number of elements that can be sorted in Θ(log n) time using heap sort isQ10. Consider a 13 element hash table for which f(key) = key mod 13 is used with integer keys. Assuming linear probing is used for collision resolution, at which location would the key 103 be inserted, if the keys 661, 182, 24 and 103 are inserted in that order?

    स्रोत : testbook.com

    Do you want to see answer or more ?
    Mohammed 9 day ago
    4

    Guys, does anyone know the answer?

    Click For Answer