what is the time complexity for the code ? #include<iostream> using namespace std;
main() { int arr[] = { 2,3,4,9,2,7}; int *ptr1 = &arr[0]; int *ptr2 = &arr[1]; const int SIZE = sizeof arr / sizeof arr[0]; while(1) { if(*ptr1 == *ptr2) { cout << *ptr1 << endl; return 0; } if( ptr1 == (arr+SIZE*(sizeof arr[0]))) ptr1=arr; else ptr1++; if( ptr2 == &arr[SIZE-2]) ptr2=arr+1; else if( ptr2 == &arr[SIZE-1]) ptr2=arr; else ptr2+=2; } return 1; } -- You received this message because you are subscribed to the Google Groups "Algorithm Geeks" group. To view this discussion on the web visit https://groups.google.com/d/msg/algogeeks/-/XIpYk-5n94wJ. To post to this group, send email to algogeeks@googlegroups.com. To unsubscribe from this group, send email to algogeeks+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/algogeeks?hl=en.