Driver code
int main ( ) { int a [ ] = { 7 , 2 , 3 , 0 , 5 , 10 , 3 , 12 , 18 } ; int n = sizeof ( a ) / sizeof ( a [ 0 ] ) ; Query q [ ] = { { 0 , 4 } , { 4 , 7 } , { 7 , 8 } } ; int m = sizeof ( q ) / sizeof ( q [ 0 ] ) ; RMQ ( a , n , q , m ) ; return 0 ; }