Geeks!
Geeks!
Geeks!
}
if (max2 == Integer.MIN_VALUE){
return -1;
}
else{
return max2;
}
}
int t = sc.nextInt();
while(t-->0){
int n = sc.nextInt();
int[] arr = new int[n];
System.out.println();
}
1
4
1 2 3 4
Output:
4 3 2 1
----------------------------------------------------------------------------
//number size of the rotation.
rotate(arr,r,n-1); //1 2 5 4 3
rotate(arr,0,r-1); //2 1 5 4 3
rotate(arr,0,n-1); //3 4 5 1 2
input: 5 2
1 2 3 4 5
output: 3 4 5 1 2
------------------------------------------------------------------
//Count of smaller elements
N = 6
A[] = {1, 2, 4, 5, 8, 10}
X = 9
Output:
5
----------------------------------------------------------------------
//Search a node in BST
if(root.data<Key){
root.right = insert(root.right,Key);
}else{
root.left = insert(root.left,Key);
}
return root;
--------------------------------------------------------------------------
//Delete a node from BST