linked list-------------------plzzzz i need the code fast

This is a discussion on linked list-------------------plzzzz i need the code fast within the C++ Programming forums, part of the General Programming Boards category; First we need to create a database which maintains all the students at UNI Then we will create a social ...

  1. #1
    Registered User
    Join Date
    May 2011
    Posts
    3

    linked list-------------------plzzzz i need the code fast

    First we need to create a database which maintains all the students at UNI
    Then we will create a social networking application like facebook that will maintain a list of friends of each student.
    A student at UNI should have at least the following parameters: (Please note that you may add additional parameters of your choice for each student if it helps you in any way)
    ID: int (note that only IDs are unique for each student)
    First Name: string
    Last Name: string
    gpa: double
    year: int (values are 1, 2, 3, or 4 depending upon if a student is first, second, third, or final year student)
    Registered Courses In Current Semester: string array
    Completed Courses: string array
    Major: string
    College: string
    friends: Student * (this field is of type Student pointer which points to the object of type Student)
    next: Student* (this pointer will point to the next student in the list)

    You should create pointer, say UNIDatabase, as the head of the database which points to the linked list.
    UNIStudent * UNIDatabase = NULL; //this pointer is the head of the linked list. Don’t call it head.
    You should provide functions to support the following operations:
    1. Add a new student in the list (take input from user, all the fields and add a new student)
    2. Delete a student from the list (based on student’s ID). Notice that deleting a student should delete all the friends of that student as well.
    3. Add a student as a friend of a student (by student ID). You should ask two IDs as input from the user, ID1 and ID2, and then add student with ID2 as the friend of the student with ID1.
    4. Delete a student as a friend of a student (by student ID). You should ask two IDs as input from the user, ID1 and ID2, and then delete student with ID2 from the friends of the student of ID1.
    5. Print all the students in the list.
    6. Delete all the friends of a particular student (by student ID).
    7. Delete all the students from the list. This includes deleting all the friends of each student as well.
    8. Print all the students from the list with gpa equal to n.
    9. Print all the students from the list with first name equal to f.
    10. Print all the students from the list with last name equal to n.
    11. Print all the students of a particular college.
    12. Print all the students of a particular major.
    13. Find and print if a student is in the list (find by first name, find by last name, find by ID).
    14. Find if a student is a friend of another student.
    15. Find and print all the students who added a particular student ‘s’ as their friends.
    16. Print all the students who have n friends (n could be 0, 1, 2, 3, …).
    17. Print all the friends of a particular student (by student ID).
    18. Print all the students who have maximum friends.
    19. Print the list of most popular students. It means all the students whom maximum students have added as their friends.
    20. Find if a student’s friend has also added this student as his friend.
    The following diagram shows how the linked list should look like. Please note about the following diagram of linked list:
    1) UNIDatabase is the name of the head of the linked list that contains all the students at UNI(shown as the first row of list).
    2) Each Node represents a student which contains all the fields mentioned above including:
    a) one pointer “next” that points to the next student in the list (shown by an arrow on
    the right hand side of each node).
    b) one pointer “friends” (shown by an arrow in the bottom of each node) which
    points to the friend of top most student.
    3) In this diagram, each node only mentions id of the student. However, it also contains other fields as mentioned above, but that is not shown in the diagram to keep it simple.
    4) The vertical list corresponding to each node is the list of friends of the top most student. For example, student with id=3 has only two friends (id=2, and id=1). Similarly, student with id=5 has no friend. Note that a student ‘x’ can call student ‘y’ to be his/her friend, but student y may not want to add ‘x’ in his/her friend’s list. For example, student with id=9 has student with id=1 as his/her friend, but student with id=1 did not add student with id=9 in his/her friend’s list.
    Last edited by princess_00; 05-24-2011 at 08:18 PM.

  2. #2
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,239
    Speechless.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

  3. #3
    Registered User xentaka's Avatar
    Join Date
    May 2011
    Posts
    60

    Hmm

    Board forbids homework requests on the boards, and I doubt people will be moved by the "need it asap!".

    I would recommend looking up some tutorials on linked lists.
    "The people don't want war, but they can always be brought to the bidding of the leaders. This is easy. All you have to do is tell them they are being attacked, and denounce the pacifists for lack of patriotism and for exposing the country to danger. It works the same in every country." - Hermann Goering.

  4. #4
    Registered User
    Join Date
    May 2011
    Posts
    3
    y speechless ??

  5. #5
    Registered User
    Join Date
    May 2009
    Posts
    2,542
    This has to be an assignment to show why Relational Databases were invented.

    Tim S.

  6. #6
    Registered User
    Join Date
    May 2011
    Posts
    3
    i just need guidline not the whole code..

  7. #7
    Registered User
    Join Date
    Dec 2007
    Posts
    67
    It's times like this when I'm tempted to post the incorrect code for the homework just to give the person some tough love.

  8. #8
    Super Moderator VirtualAce's Avatar
    Join Date
    Aug 2001
    Posts
    9,596
    Closed.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Sorting linked list please help with CODE
    By scarlet00014 in forum C Programming
    Replies: 3
    Last Post: 09-27-2008, 11:24 PM
  2. Linked list - why this bit of code?
    By chris1985 in forum C Programming
    Replies: 2
    Last Post: 10-04-2005, 06:17 AM
  3. my linked list code - comments please
    By cdave in forum C Programming
    Replies: 3
    Last Post: 04-28-2005, 12:37 AM
  4. What's wrong with this linked-list code?
    By helplz in forum C Programming
    Replies: 4
    Last Post: 06-15-2003, 04:22 PM
  5. Linked List Working Code
    By Linette in forum C++ Programming
    Replies: 9
    Last Post: 01-24-2002, 11:00 AM

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