Algorithm - El Camino de Santiago Sample Question
Not what you're looking for?
Need help with attached questions.
Algorithm - El Camino de Santiago Sample Question
Purchase this Solution
Solution Summary
Sample solution for algorithm question. El Camino de Santiago sample questions are examined.
Solution Preview
Please see the attachment.
Problem #1
I use a greedy algorithm to find the list of albergues specifying where you will rest.
The basic idea is, for each day, you should walk as far as possible, until you can rest at th albergue but can not rest at th albergue. In another word, if you rest at th albergue, your walking distance of this day is less than or equal to miles; if you rest at th albergue, then you have walk more than miles a day. This is not allowed from the condition. The pseudo code is as follows.
Input: array X[1...n] and d, where X[1]=0 is the start point, X[k] is the distance between the kth albergue and the start point, d is the maximum distance you can walk for one day.
Output: array Y[1...m], where Y[k] is the index of albergue where you take a rest on the kth day.
FindAlbergues(X, d)
1. Set k=1; // Start point at X[1]
2. Set t=1; // Start day is day 1
3. while (k<=n) { // Go through ...
Purchase this Solution
Free BrainMass Quizzes
Excel Introductory Quiz
This quiz tests your knowledge of basics of MS-Excel.
Word 2010: Tables
Have you never worked with Tables in Word 2010? Maybe it has been a while since you have used a Table in Word and you need to brush up on your skills. Several keywords and popular options are discussed as you go through this quiz.
Basic Networking Questions
This quiz consists of some basic networking questions.
Javscript Basics
Quiz on basics of javascript programming language.
Java loops
This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.