My C project

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Giorgos
    New Member
    • Jan 2007
    • 4

    My C project

    I have a C project for one of my courses. I 'll now give you the description of the project!

    A shop has more from 1,000,000 customers. Each customer has his own member card which corresponds in one code. This code is constituted by 10 characters (ex. AB56AVF112). Depending on the money that the customer spends, he gains some points. So, I want to build a C project that it can give me information about:
    1) How many times has each customer visited the shop
    2) How many points has each customer gained
    3) Who are the top 10 customers

    I'll have two files for Input. The first text file gives me information about the money and the points (How many points correspond to a specific ammount.
    (ex. 1;30;10 -> 10, 20 points etc
    31;60;20 etc)
    |-> 1$-30$, 31$-60$ etc

    The second text file give me information about the customer and the money he spends in each visit in the shop.
    (ex. ABC123DEF1;125 --> money
    QWER587962;200 etc)
    |-> customer's code

    I don't ask you to tell me what to do, but every time that I have a question about something in the project I'll refer it here!


    PS: I am sorry for my english!
  • Ganon11
    Recognized Expert Specialist
    • Oct 2006
    • 3651

    #2
    Awesome, this project sounds interesting. Are there any complications you're having or concepts you're having trouble understanding? Post here, and we'll all be glad to give you a hand!

    P.S. your english looks fine so far!

    P.P.S. thank you so much for explaining your project so thoroughly!

    Comment

    • Giorgos
      New Member
      • Jan 2007
      • 4

      #3
      I have to use hash table (1 Dimension) for the project. So firstly I need a good hash function :) !!!! The Hash table includes the codes of the customers. So let's say:

      Hash table:
      |.............. |
      |.............. | --> 2587ASAASQ
      |.............. | --> UYHTG125PO --> YUIO897QWE (collision)

      ...............

      |.............. |


      I have a problem! Where will I put the money of each customer? I thought to put them in a list, something like this...

      |.............| --> 2587ASAASQ --> 23586


      ...but in the case of a collision? Can I put them like this...

      |.............. | --> UYHTG125PO --> YUIO897QWE --> 25698 --> 36587

      ...?

      Comment

      • Giorgos
        New Member
        • Jan 2007
        • 4

        #4
        Anyone who can help?

        Comment

        • Banfa
          Recognized Expert Expert
          • Feb 2006
          • 9067

          #5
          Store your customer information in a structure, your hash table can look-up into you allocated structures. Once you have found the structure for a customer it will contain all information

          |.............. |
          |.............. | --> {2587ASAASQ, 345}
          |.............. | --> {UYHTG125PO, 674} --> {YUIO897QWE, 234} (collision)

          ...............

          |.............. |

          Comment

          • RedSon
            Recognized Expert Expert
            • Jan 2007
            • 4980

            #6
            Originally posted by Giorgos
            I have to use hash table (1 Dimension) for the project. So firstly I need a good hash function :) !!!! The Hash table includes the codes of the customers. So let's say:

            Hash table:
            |.............. |
            |.............. | --> 2587ASAASQ
            |.............. | --> UYHTG125PO --> YUIO897QWE (collision)

            ...............

            |.............. |


            I have a problem! Where will I put the money of each customer? I thought to put them in a list, something like this...

            |.............| --> 2587ASAASQ --> 23586


            ...but in the case of a collision? Can I put them like this...

            |.............. | --> UYHTG125PO --> YUIO897QWE --> 25698 --> 36587

            ...?
            Are you asking here about good strategys to use in case of collisions? In that case, linear collision avoidance is always simple to implement. Although I wonder if your professor would let you use something like google's sparse hash. I always wanted to try that data structure, but haven't found the right project for it yet.

            Comment

            Working...