Java simple bucket technique with multiple passes
```\n    // make a char frequency array of characters and the frequency with that they occur.\n    // pick an array index at which count > 0 add it to the resul
```\n    // make a char frequency array of characters and the frequency with that they occur.\n    // pick an array index at which count > 0 add it to the result, increment the index until you find the next non zero            count char. add it to result and increment index. keep doing so until you reach the end of array.\n    // this was bascially step 2.\n    \n    //set index to array.length and decremtn index until you find a char with nonzero count; add that to result and keep         //decrementing and adding non zero count chars until you reach 0;\n    \n    //check if the length of appended string is equal to the original string, if not so repeat the above two steps of \n    //passing in forward direction and then in backward until the length of appended string equals the original.\n    \n    //return the result\n    \n    //Time Complexity = O(n)\n    //Space Complexity = O(1);\n    \n    public String sortString(String s) {\n        \n        int[] charArr = new int[26];\n        \n        for(int i=0; i<s.length(); i++){\n            charArr[s.charAt(i) - \'a\']++;            \n        }\n        \n        StringBuilder sb = new StringBuilder();\n        \n        while(sb.length() != s.length()){\n            for(int i=0; i<26; i++){\n                if(charArr[i] > 0){\n                    sb.append((char) (\'a\' + i));\n                    charArr[i]--;\n                }\n            }\n            \n            \n            for(int j=25; j>=0; j--){\n                if(charArr[j] > 0){\n                    sb.append((char) (\'a\' + j));\n                    charArr[j]--;\n                }\n            }\n        }\n        \n        return sb.toString();\n        \n    }
['Java']