Adding student marks to a Linked List

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • praveenaj
    New Member
    • Sep 2009
    • 1

    Adding student marks to a Linked List

    I was given to write a C program using Linked list to enter student marks, but i can't figure out how this node insertion works:
    how nodes are linked with each other???


    A Computer Training Institute wants to store marks of the Theory and Practical Papers of Data Structures & Algorithm. This system keeps the Registration Number and the Name other than the two marks, and all the records should be inserted in increasing order of the Registration Number.

    • Use a suitable data structure to solve this problem.
    • Store at least 5 different records in your program.
    • Display all the records you have stored. All the records should be displayed as follows.



    Reg. No Name Theory Practical
    101 Silva 55 30
    102 Perera 38 28
    104 Fernando 55 20
    105 Peries 15 18

    • Now write a function/s to insert the records of the students whose Registration Numbers are 103 and 106 in the correct positions.

    • Write a function to search a given student record specified by the registration number.

    • Display all the items again and check whether they have inserted properly.


    thanks in advance
  • OraMaster
    New Member
    • Aug 2009
    • 135

    #2
    Originally posted by praveenaj
    I was given to write a C program using Linked list to enter student marks, but i can't figure out how this node insertion works:
    how nodes are linked with each other???


    A Computer Training Institute wants to store marks of the Theory and Practical Papers of Data Structures & Algorithm. This system keeps the Registration Number and the Name other than the two marks, and all the records should be inserted in increasing order of the Registration Number.

    • Use a suitable data structure to solve this problem.
    • Store at least 5 different records in your program.
    • Display all the records you have stored. All the records should be displayed as follows.



    Reg. No Name Theory Practical
    101 Silva 55 30
    102 Perera 38 28
    104 Fernando 55 20
    105 Peries 15 18

    • Now write a function/s to insert the records of the students whose Registration Numbers are 103 and 106 in the correct positions.

    • Write a function to search a given student record specified by the registration number.

    • Display all the items again and check whether they have inserted properly.


    thanks in advance
    You may need to know
    1. What are linked lists and their types and how it works?
    2. Try to insert a node into an ordered linked list on the basis of reg. no. (this is what u need to implement)
    Try to search on Google for the same and do some programming stuffs and let everybody know what you understood and what problems you are facing.
    Kind Regards,
    Bhushan

    Comment

    • weaknessforcats
      Recognized Expert Expert
      • Mar 2007
      • 9214

      #3
      I stingly recommend that you write a single function that inserts NodeB after NodeA:

      Code:
      Insert(Node* NodeA, Node* NodeB);
      and use this function in the rest of your linked list code. This will avoid re-solving the node insertion over and over and over again.

      Are you allowed to use C++? If so, you can use the linked list container list<> where all this have been done professionally aned debugged for you. Otherwise, you will need to re-invent this wheel again.

      Comment

      • weaknessforcats
        Recognized Expert Expert
        • Mar 2007
        • 9214

        #4
        I forgot to say that the Insert function from my previous post will have only 5 lines of code in it.

        Comment

        Working...