edited by
816 views
1 votes
1 votes

edited by

1 Answer

1 votes
1 votes
One solution can be to linearly traverse the entire array and find the missing number. Here time complexity is O(n).

We can get this in O(Logn) time using the modification of the Binary Search algorithm
We can get the middle element and find if it lies in between before mid or the after mid. This way we are reducing the size of our array to half everytime and hence the answer is O(Logn)

Related questions

1 votes
1 votes
1 answer
1
Markzuck asked Jan 6, 2019
507 views
Please show the ideal way to deal with such comparisons as I am getting g>=f IN genral what logic shall be followed to analyse such complex comparions?
0 votes
0 votes
1 answer
2
Markzuck asked Dec 29, 2018
804 views
cant we write the recurrance relation for bar() as T(n) = 5T(n-1) + c,like cant we take both the recurrance call as combined as both have same parameter?and if not, then ...
1 votes
1 votes
0 answers
3
0 votes
0 votes
1 answer
4
Shamim Ahmed asked Nov 22, 2018
1,091 views
For merging two unsorted list of size m and n into sorted list of size (m+n). The time complexity in terms of no. of comparison for this is?