• Status Closed
  • Budget $30 - $5000 USD
  • Total Bids 13

Project Description

We have a collection of train cars. We want to hook them together to get the train with the most cars possible. Some cars have a unique front end, and some can have either end in front. Two cars can be coupled together only if their coupling mechanisms are compatible. Each car is described by a string of uppercase letters. The front end is the end with the letter that comes first in the alphabet (if it starts and ends with the same letter, either end can be in front). Two words can be hooked together only if the two adjoining ends have the same letter. Create a class WordTrain that contains the method (function) hookUp that takes cars, a string[], and returns a string which is the longest word train that can be made from cars. DEFINITION: Class: WordTrain Method Signature: string hookUp(vectorcars); If more than one train of the longest lenght is possible, return the one that comes first in the aphabet. Remember that the length of a train is the number of cars, not the number of letters. The returned string should be all the cars in the train, starting at the front of the train, concatenated with '-' showing the coupling between adjacent cars. For alphabetic breaking of ties, the '-' is included in its usual order in the ascii sequence. Your method may assume the following preconditions are met: -cars contains between 1 and 50 elements -each element of cars contains only uppercase letters -each element of cars contains between 3 and 10 inclusive letters EXAMPLES (quotes shown for clarity only) 1) {"CBA", "DAA", "CXX"} : return "ABC-CXX" This is the only possible train of length 2. Note that CBA needed to be reversed so that it was facing the right direction. 2){"ACBA"}: return "ABCA" 3){"AUTOMATA", "COMPUTER", "ROBOT"}: return "COMPUTER-ROBOT" '-' sorts before uppercase letters

## Deliverables

Complete and fully-functional working program(s) in executable form as well as complete source code of all work done. Complete copyrights to all work purchased. This code should be written using Microsoft Visual C++ 6.0, so that when I compile it I won't get errors or warnings related to compiler differences. I will be asking you why you did what you did, because I need to understand your logic. So either during or after you're done coding, you will need to explain me your algorithm. If you have further questions, pls email me. I need to have this program done by July 7. But I will need you to send me your pseudocode or algorithm before that. I also need a test (main) program to test the functions. Thanks :)

## Platform

Windows 2000 NT, Visual C++ 6.0

## Deadline information

Please do not bid if you're not serious. I want to have an efficient algorithm by July 2, and you should respond to my emails if I have questions about your algorith/code. This project has been auctioned before and unfortunately the coder had dissappeared on me. So don't bid if you are not serious!

Get free quotes for a project like this
Awarded to:

Looking to make some money?

  • Set your budget and the timeframe
  • Outline your proposal
  • Get paid for your work

Hire Freelancers who also bid on this project

    • Forbes
    • The New York Times
    • Time
    • Wall Street Journal
    • Times Online