Signal Strength: Difference between revisions

From programming_contest
Jump to navigation Jump to search
imported>Plg5
Created page with "= Introduction = *midatl2008 This problem asks to find the maximum signal strength in a non-cyclic graph. There are "servers" which have gain, and a "connections" from a..."
 
imported>Plg5
No edit summary
Line 8: Line 8:
Mild. The theory is pretty straightforward and doesn't necessitate a fast algorithm.
Mild. The theory is pretty straightforward and doesn't necessitate a fast algorithm.
==Implementation==
==Implementation==
Spic
Moderate. Parsing the information and putting them into the relevant data structures is annoying.
= Solutions=
= Solutions=
== Solution Using foo and X with Bob and alice algorithm ==
==Solution using recursion==


=== Idea ===
=== Idea ===


I had an idea! I thought of using bob and foo because of XYZ.
Create a function that will recursively determine the signal strength at any server. It will find the strength of all the parent servers, and return the strongest one. Implement memoization for speed


=== How to ===
=== How to ===


The code was done this way.
Your program needs 3 layers


=== Solution - *Language X* ===
*Initial setup layer
<syntaxhighlight lang="cpp">
*Case layer
#include <stdio.h>
*Recursive layer


int main()
The recursive function should be called initially on the LAST server, and should work its way up to the FIRST server. Thus, base case is when server #0 is hit.
{
    printf ("Hello Word!");
    return 0;
}
</syntaxhighlight>
 
= Super Epic Fails =
 
It would be really easy to make this mistake or that mistake


= Tags =
= Tags =
*[[BFS]]
*[[DFS]]
*[[Dynamic Programming]]

Revision as of 04:03, 25 April 2015

Introduction

This problem asks to find the maximum signal strength in a non-cyclic graph. There are "servers" which have gain, and a "connections" from a server to another, witch also have a gain.

Difficulty

Algorithmic

Mild. The theory is pretty straightforward and doesn't necessitate a fast algorithm.

Implementation

Moderate. Parsing the information and putting them into the relevant data structures is annoying.

Solutions

Solution using recursion

Idea

Create a function that will recursively determine the signal strength at any server. It will find the strength of all the parent servers, and return the strongest one. Implement memoization for speed

How to

Your program needs 3 layers

  • Initial setup layer
  • Case layer
  • Recursive layer

The recursive function should be called initially on the LAST server, and should work its way up to the FIRST server. Thus, base case is when server #0 is hit.

Tags