In the game of $Mindmaster$, secret codes are created by placing pegs of any of seven different colors into four slots. Colors may be repeated, and no slot may remain empty. 2401 secret codes are possible.
<u>Explanation:</u>
Mastermind is a board game that was developed by Mordecai Meirowitz, in 1971. The Code maker sets a secret code, then the Codebreaker attempts to meet the code using logic, deduction. Behind each move, the Code maker provides hints to the Codebreaker. Make the code even more indirect by using multiple pegs of the same color or by leaving one or more peg holes empty. With so many feasible code sequences, every game is confirmed to be a brain teaser.
7 colors with 4 slots and repetition of color are accepted so 7^4 is 2401.
Answer:
b) Single source shortest path
Explanation:
These are the options for the question
a) All pair shortest path
b) Single source shortest path
c) Network flow
d) Sorting
Dijkstra's algorithm is algorithm by
Edsger Dijkstra arround the year 1956, this algorithm determine the shortest path, this path could be between two nodes/vertice of a graph.
The steps involves are;
✓setting up of the distances base on the algorithm.
✓ calculation of the first vertice up to vertice adjacent to it
✓The shortest path result.
It should be noted that maximum number of times the decrease key operation performed in Dijkstra's algorithm will be equal to Single source shortest path.
The argument for the function would be answer "D".
<span>They wrote live updates to a blog, so D. The blog was called "Eye of the Storm." It was written as a series of personal musings and photographs of places where the storm hit- first hand accounts of the disaster. They received a journalism award for it.</span>
The below code will help you to solve the given problem and you can execute and cross verify with sample input and output.
#include<stdio.h>
#include<string.h>
int* uniqueValue(int input1,int input2[])
{
int left, current;
static int arr[4] = {0};
int i = 0;
for(i=0;i<input1;i++)
{
current = input2[i];
left = 0;
if(current > 0)
left = arr[(current-1)];
if(left == 0 && arr[current] == 0)
{
arr[current] = input1-current;
}
else
{
for(int j=(i+1);j<input1;j++)
{
if(arr[j] == 0)
{
left = arr[(j-1)];
arr[j] = left - 1;
}
}
}
}
return arr;
}