1.1Implement an algorithm to determine if a string has all unique characters What if you can not use additional data structures?

bool isUniqueChars(string str) { unsigned int checklittle = 0; unsigned int checklarger = 0; for(int i = 0; i < str.size();i++) { bool flag = str[i] - 'a' >= 0 ; unsigned int temp; temp = flag ? 1 << (str[i] - 'a') : 1 << (str[i] - 'A'); if(flag){ if( checklittle & temp ) return false; else checklittle |= temp; }else { if(checklarger & temp) return false; else checklarger |= temp; } } return true;
1.2 Write code to reverse a C-Style String

void reverse(char *str){ if(NULL == str) return; char *p = str; while(*p)++p; --p; while(str < p){ char temp = *p; *p = *str; *str = temp; --p; ++str; } }
1.3 Design an algorithm and write code to remove the duplicate characters in a string without using any additional bufer NOTE: One or two additional variables are fine .An extra copy of the array is not

void removeDuplicates(char[] str){ if(NULL == str) return ; int len = strlen(str); if(len < 2) return ; int tail = 1; for(int i = 1; i < len ; i++){ int j; for(j = 0; j < tail ; j++){ if(str[j] == str[i]) break; } if(j == tail){ str[tail] = str[i]; ++tail; } } str[tail] = '