Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7087017
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T07:37:19+00:00 2026-05-28T07:37:19+00:00

I needed some help/pointers on a homework problem. I would really appreciate it if

  • 0

I needed some help/pointers on a homework problem. I would really appreciate it if someone could point me in the right direction on how to go about solving this problem 🙂

Assignment

“An angry bird named Mo is flying a long journey to exact his revenge
on the pigs. To save energy for the fight, the bird will take
advantage of jet streams that will lower his flying energy
consumption. Before the flight, BirdHQ gave the bird an input file in
the following format:

  1. First line contains only 1 integer, which is the constant energy it takes to fly 1 mile WITHOUT jet streams.
  2. Every subsequent line contains 3 space-separated integers: the start mile marker of the jet stream, the end mile marker of the jet
    stream, and lastly an integer denoting the overall energy needed to
    fly that jet stream’s distance.

For instance, the line “3 7 12″ means it takes 12 energy units to fly
the 4 miles between miles 3 and 7.

Note that jet streams can overlap, but the bird cannot be on more than
one jet stream at a time, and it cannot fly partial jet streams.

For simplicity, consider the end mile marker of the farthest jet
stream as the end of the journey.

Write a python program that takes in an input file “jetstreams.txt” to
plan out the optimal sequence of jet streams Mo should fly on to
minimize his energy consumption throughout the entire journey. All
integers in the input file are non-negative. As output, print out the
mininum total energy and a list of tuples denoting the jet streams’
endpoints.

For example, given the sample jetstreams.txt, the minimum total energy
needed to fly all 24 miles is 352 energy units, and the optimal
sequence of jet streams is [(0,5), (6,11), (14,17), (19,24)].”

jetstreams.txt

50
0 5 10
1 3 5
3 7 12
6 11 20
14 17 8
19 24 14
21 22 2

Would this be anything like solving the shortest path of a graph?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T07:37:19+00:00Added an answer on May 28, 2026 at 7:37 am

    Yes.

    You have a “don’t use the jetstream at all” path, which consists of vertices numbered 0, 1, 3, 5, 6, 7, 11, 14, 17, 19, 21, 22, 24. The edges which join each of these vertices has a “weight” of 50* the distance – so the 0->1 edge is weighted 50, the 1->3 edge is weighted 100, etc.

    Then, you have additional edges representing the jetstreams – one from 0->5 weighted 10, one from 1->3 weighted 5, etc.

    Together, these form a directed acyclic graph (a DAG).

    Now you have that, you can apply the usual graph traversal techniques to find the “cheapest” route from vertex 0 to vertex 24.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I need some help in picking the 'right' solution for the following 'problem'. I
I'm new to vbscript and Stack Overflow, and could really use some help. Currently
I would appreciate some help with the following: I'm writing a program in Visual
Some MATLAB help needed ! I have an set of 1s and 0s, I
I am very new to WPF and needed some pointers as to why this
Say there is some functionality needed for an application under development which could be
I needed some help in trying to optimize this code portion ... Basically here's
I am new to Flex and needed some help setting up Web service client.
Hello all I am using MS SQL Server 2008 R2 and needed some help
I'm making a reaction type game and I needed some help implementing a way

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.