Values associated with nodes
val [ 1 ] = 2 NEW_LINE val [ 2 ] = 3 NEW_LINE val [ 3 ] = 4 NEW_LINE val [ 4 ] = 8 NEW_LINE val [ 5 ] = 16 NEW_LINE queries = [ 2 , 3 , 1 ] NEW_LINE q = len ( queries ) NEW_LINE