Thread: need with on homework.. noob here

  1. #1
    Registered User
    Join Date
    Aug 2007

    need with on homework.. noob here

    Input : Maximum dimensions of an area (Xmax, Ymax), Number of nodes N, and distance D.

    Program function
    1- Each node has id.
    2 - Distribute the nodes in the area randomly, such as each node has a position (x , y)
    3 Each node is considered a neighbor to another node, if the distance between them is less than D.
    4 - A node degree is the number of its neighbor nodes. Average degree is the total number of neighbors divided by the nodes number N.

    1-The average node degree
    2-The degree of any node selected by the user.
    3-The minimum degree
    4-The maximum degree

    this is what i understand:
    1. use time to generate random point => coordinate = rand() % (x/y + 1)

    then i dunno how to start... pls help

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    Well having assigned all the positions, the next step would seem to be to calculate all the 'D' values.
    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. Homework
    By kermi3 in forum A Brief History of
    Replies: 11
    Last Post: 11-03-2001, 04:39 PM
  2. Homework
    By kermi3 in forum C Programming
    Replies: 10
    Last Post: 09-27-2001, 04:49 PM
  3. Homework
    By kermi3 in forum C++ Programming
    Replies: 15
    Last Post: 09-26-2001, 03:16 PM
  4. Homework
    By kermi3 in forum C Programming
    Replies: 0
    Last Post: 09-10-2001, 01:26 PM