// PSEUDOCODE
//input
List of numbers
Sort the numbers in the list so that they’re in order.
Loop through the list to leave out a number in the list
Then add the remaining numbers to get the sum
Place all of the sums in a separate array
Filter the new sum array to identify the min and max sum’s
//output
Min and max sum of the list of numbers
This is pseudocode from a hackerrank challenge I was working on with a couple of cool cats from the coding community I joined. Pseudocode, for those who don't know, is a methodology to represent the implementation of an algorithm. In this session, I really learned the importance and aid of pseudocoding. In the words of one of my friends Rashad, "It's good to use pseudocode. Your code start's to flow better."
This was very true and I struggled for a long time on how to properly use pseudocode. A really great tip he gave me was first, to start with the input & output of what you're trying to achieve. Afterward, you only have to fill in the middle. Being rather specific was important in detailing what your pseudocode entails. Another small but important detail was in the order of placing the input and output. This small detail helped me see, even clearer, how useful pseudocoding was.
By placing the input, the data that the algorithm is manipulating, at the top of my pseudocode, then placing the output at the bottom and writing the details of what the algorithm will be doing in the middle. This gave my pseudocode the structure of an actual function. Afterward, it was just a matter of plugging in and deciding which methods needed to be used to achieve what it was I was trying to achieve.
Top comments (0)