Thread: A problem with a graph

  1. #1
    Registered User
    Join Date
    May 2008

    A problem with a graph

    Hello to everybody,
    I'm preparing for a competition in Informatics and I had difficulty with the following task:

    You should find a path with the greatest number of points(vertices) in a graph.
    /The graph has no cycles in it - it's a tree./

    Can you write down the code or explain to me how to do it?
    Thank you in advance!

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Draw a few simple trees on paper.
    Draw on them what the longest path would be, say using a highlighter.
    Think about the process you go through to work that out, then think about how you might code it.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Someone having same problem with Code Block?
    By ofayto in forum C++ Programming
    Replies: 1
    Last Post: 07-12-2007, 08:38 AM
  2. A question related to strcmp
    By meili100 in forum C++ Programming
    Replies: 6
    Last Post: 07-07-2007, 02:51 PM
  3. WS_POPUP, continuation of old problem
    By blurrymadness in forum Windows Programming
    Replies: 1
    Last Post: 04-20-2007, 06:54 PM
  4. Help w/ graph as adjacency matrix
    By ac251404 in forum C++ Programming
    Replies: 4
    Last Post: 05-09-2006, 10:25 PM
  5. Laptop Problem
    By Boomba in forum Tech Board
    Replies: 1
    Last Post: 03-07-2006, 06:24 PM