Answer:
I will code in Javascript.
<em>//define and initialize both arrays.</em>
var words = ['hello', 'mother','hello','father','here','i','am','hello'];
var sortedList = [];
for ( var i = 0; i < words.length ; i++ ){ <em>//loop used to go throght the words</em>
var duplicated = false; <em>// boolean used for detect duplicates</em>
for ( var j = i + 1; j < words.length ; j++ ) { <em>//loop used to compare with other words</em>
if( words[i] == words[j] ) { <em>//if the word is duplicated, duplicated becomes true.</em>
duplicated = true;
break;
}
}
if (! duplicated) { <em>//if at the end of the loop of each word duplicated is false, then the element is pushed into sortedList.</em>
sortedList.push(words[i]);
}
}
sortedList.sort(); <em>//when the loop is finished, use the Javascript method to sort an array.</em>