FIFO list

This is a discussion on FIFO list within the C Programming forums, part of the General Programming Boards category; FIFO list Hi, I am a newbie to C Programming and I got some difficulty to do my C programming's ...

  1. #1
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    FIFO list

    FIFO list
    Hi,

    I am a newbie to C Programming and I got some difficulty to do my C programming's task.
    It's about the FIFO list.

    The general info is like this:

    We are required to design, implement and test two functions as specified:


    1.st_priority_load( ) takes one integer and one string parameter (in that order). The string is added to a list in priority order specified by the integer parameter. The list is a data structure private to these functions.

    2.st_priority_remv( ) takes a single integer reference parameter. Its action is to remove from the list the string with the highest priority value up to, and including, the value passed as its argument, and return the string so removed. The reference parameter is reset to the actual priority of the affected string. Where there are more than one string in the list with the nominated priority, the "oldest" string is to be removed and returned, i.e., each priority level behaves as a FIFO list.

    Notes:


    1.The "highest" priority is 0, and priority m is higher than priority n if m < n.

    2.The algorithmic complexity of each function must be at most O( r + s ), where
    r = number of distinct priority values in list; and
    s = number of strings in list with the same priority


    O( r*s ) is not acceptable.

    3.There are to be no predefined upper limits to the values of r or s as defined above.

    4.The data structure used to represent the priority list must be hidden from the calling environment. Any suitable data structure may be used as long as it meets the preceding requirements.

    I dun really get what should we do in this program.
    Could anyone help me to solve this problem?

  2. #2
    the hat of redundancy hat nvoigt's Avatar
    Join Date
    Aug 2001
    Location
    Hannover, Germany
    Posts
    3,139
    >Could anyone help me to solve this problem?

    We don't do peoples homework. What have you tried so far ? Show some code, pseudo code or plans what you need to do the task.

    And please don't cross post.
    hth
    -nv

    She was so Blonde, she spent 20 minutes looking at the orange juice can because it said "Concentrate."

    When in doubt, read the FAQ.
    Then ask a smart question.

  3. #3
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    Unhappy FIFO list...any other option besides array?

    Hi ,

    One of the requirements is that there are no upper limits predefined for value r or s.
    My tutor ever said that we may use array for this,but this is not the right solution.If that's the case,what should we use?

  4. #4
    Registered User
    Join Date
    Feb 2003
    Posts
    595
    How about a linked list?

    Are you supposed to be writing this in C, or can you use the C++ string class?

  5. #5
    Registered User
    Join Date
    Apr 2003
    Posts
    3

    Unhappy Linked list should be right

    Hi,

    Hm,I have to used C programming in UNIX environment to write this program.
    Linked list sounds quite reasonable for the solution.

    Thanks a lot.
    Ur reply helps me a lot.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. circular doubly linked list help
    By gunnerz in forum C++ Programming
    Replies: 5
    Last Post: 04-28-2007, 08:38 PM
  2. How can I traverse a huffman tree
    By carrja99 in forum C++ Programming
    Replies: 3
    Last Post: 04-28-2003, 05:46 PM
  3. List class
    By SilasP in forum C++ Programming
    Replies: 0
    Last Post: 02-10-2002, 04:20 PM
  4. singly linked list
    By clarinetster in forum C Programming
    Replies: 2
    Last Post: 08-26-2001, 10:21 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21