In any given function in java, what do I need to look for in order to determine its space complexity? thank you Solution You need to identify that is there any type of memory your creating locally in function to process current execution of the function. Type of memory generally can be created in function are: 1. local variables . ex int a, double y, String z etc : Space complexity : O(1) => constant 2. An Array, ArrayList, LinkedList, HashMap etc of size K => Space complexity : O(k) For example: void merge(int arr[], int l, int m, int r) { // Find sizes of two subarrays to be merged int n1 = m - l + 1; int n2 = r - m; /* Create temp arrays */ int L[] = new int [n1]; // WE ARE CREATING EXTRA MEMORY int R[] = new int [n2]; // WE ARE CREATING EXTRA MEMORY /*Copy data to temp arrays*/ for (int i=0; i.