state the benefits and limitations of binary search in terms of time complexity
Answers
Answered by
9
ᴡʜᴀᴛ ᴀʀᴇ ᴛʜᴇ ʙᴇɴᴇғɪᴛs ᴀɴᴅ ʟɪᴍɪᴛᴀᴛɪᴏɴs ᴏғ ʙɪɴᴀʀʏ sᴇᴀʀᴄʜ ɪɴ ᴛᴇʀᴍs ᴏғ ᴛɪᴍᴇ ᴄᴏᴍᴘʟᴇxɪᴛʏ? ... ᴛʜᴇ ɪɴᴘᴜᴛ ᴏғ ᴛʜᴇ ʙɪɴᴀʀʏ sᴇᴀʀᴄʜ ᴍᴜsᴛ ʙᴇ sᴏʀᴛᴇᴅ. ᴛʜᴀᴛ ʙᴇɪɴɢ sᴀɪᴅ, ᴛʜᴇ ɪɴᴘᴜᴛ ᴍᴜsᴛ ʙᴇ “sᴏʀᴛᴀʙʟᴇ.” sᴏ, ʏᴏᴜ ᴄᴀɴɴᴏᴛ ᴊᴜsᴛ ᴜsᴇ ʙɪɴᴀʀʏ sᴇᴀʀᴄʜ ᴏɴ ᴀɴʏ ʟɪsᴛ / ᴀʀʀᴀʏ ᴏғ ᴏʙᴊᴇᴄᴛs. ᴛʜᴇ ᴏʙᴊᴇᴄᴛs ᴍᴜsᴛ ʜᴀᴠᴇ ᴀɴ “ᴏʀᴅᴇʀ” ᴛᴏ ᴛʜᴇᴍ.
Answered by
0
Answer:
Binary Search is applied on the sorted array or list of large size. It's time complexity of O(log n) makes it very fast as compared to other sorting algorithms. The only limitation is that the array or list of elements must be sorted for the binary search algorithm to work on it.
Similar questions