Feature #5: Calculate the Search Ranking Factor
Discover how to calculate search ranking factors by multiplying the scores of all linked web pages except the current one. This lesson teaches an efficient algorithm that computes the product of elements to the left and right of each page score to determine final rankings. You will learn to implement this in O(n) time and O(n) space complexity.
We'll cover the following...
Description
Consider that your company has decided to experiment with a different search ranking algorithm. This algorithm favors search results that reference each other and create a closed graph. All the web pages in the search result have already been assigned scores based on their content quality and relevance. Now, we want to determine the ranking factor of each page, which will be used in tandem with other criteria to determine the final page rank. To find this ranking factor, the team has decided to take the product of the scores of all pages that are referenced by the current page. This means that in the set of web pages where each one references the other, the ranking factor of each page will be determined by multiplying the scores of all the other pages in the set except itself.
To implement this feature, you will be provided with an array containing the page scores of web pages that reference each other. A page’s rank is calculated as the product of the scores of all the pages that link to it. For example, you are given the following scores of five web pages that link to each other: [1, 4, 6, 9]. The ranking factor found by the algorithm mentioned above will be: [216, 54, 36, 24] ...