File tree Expand file tree Collapse file tree 1 file changed +1
-1
lines changed
algorithms/greedy/minimum_number_of_pushes Expand file tree Collapse file tree 1 file changed +1
-1
lines changed Original file line number Diff line number Diff line change @@ -109,7 +109,7 @@ optimal for minimizing key presses.
109109- Iterate through the sorted frequency vector:
110110 - If the frequency of a letter is zero, break the loop as there are no more letters to process.
111111 - Calculate the number of pushes for each letter based on its position in the sorted list: (i / 8 + 1) * frequency[ i] .
112- > the number of pushes required to obtain a single instance of it is (i / 8 + 1). Because there are 8 available
112+ > the number of pushes required to obtain a single instance of it is (i / 8 + 1). Because there are 8 available
113113 > keys (2 − 9), for the first 8 values of i (i = 0 to i = 7) corresponding to the first 8 frequent letters,
114114 > (i / 8 + 1) will give 1. For the next 8 values of i (i=8 to i=15) corresponding to the next 8 frequent letters,
115115 > (i / 8 + 1) will give 2, and this pattern continues.
You can’t perform that action at this time.
0 commit comments