Changed linked list to array

addAndGetFreq is the main method to look at here