search
Log In
0 votes
123 views
in a sorted array of n distinct  element finding i th largest element take o(1)  .   true / false
in Programming
retagged by
123 views
0
True.
0
yes, can u explain ?
0
if i is as large as n then ?
2
then we can just do it , by putting it's index number directly

1 Answer

0 votes
It is true as the ith element is equal to array[i] which takes O(1)

Related questions

0 votes
1 answer
1
103 views
when i printing x it is giving 0 but when comparing x with 5 ,it executing else part ,means condition fail ,why ?? #include <stdio.h> int main(void) { int x; if(x=(printf("Hello")) != 5) printf("Hello"); else printf("World \n"); printf("%d \n",x); return 0; } https://ideone.com/NJSj2i
asked Jan 28, 2019 in Programming Gurdeep Saini 103 views
2 votes
3 answers
2
459 views
#include <stdio.h> int arr[] = { 10, 20, 30, 40, 50 }; static int count ; inc() { return ++count; } int main() { arr[count++]=inc(); printf("%d ", arr[count]); printf("%d ", arr[0]); } https://ideone.com/5LOuqj
asked Jan 14, 2019 in Programming Gurdeep Saini 459 views
0 votes
0 answers
3
80 views
#include<stdio.h> int main() { char A[5][7][6]; char *p[5][7][6]; printf(“%d\t”,(unsigned)(A+1)-(unsigned)A); printf(“%d”,(unsigned)(p+1)-(unsigned)p); } OPTIONS: 42 42 1 1 42 336 336 42
asked Dec 22, 2018 in Programming utkarshkosta 80 views
...