Datastructure lab

This is a discussion on Datastructure lab within the C++ Programming forums, part of the General Programming Boards category; Hi! I'm a fellow that has big problems on starting this next datastructure lab in c++. I have so much ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    1

    Datastructure lab

    Hi!
    I'm a fellow that has big problems on starting this next datastructure lab in c++. I have so much in my mind right now and I don't know if I'm gonna complete this lab on time.
    So i'm wondering if there are someone that could help me with this lab?

    We use at the school visual studio 6.0

    Here's the lab description:

    A) Hash table

    Now your going to make an article-storage were the articles will be saved in a hash-table for fast prompt accessible. For every article saves the information of the article-number, article-type and the amount articles in the storage.
    You should be able to “hash” on the article-number( i.e article-number is the key). You should be able to ADD, SEEK and LIST the articles in the storage.

    The programme shall handle collision with "Separate Chaining” i.e create linked list at collisions. You shall therefore make an array of pointers that initiate to NULL, afterward you should be able to seek and add articles that are missing.

    At collision you do your linked list. Use here as said a linked list and a string class.
    Remember when you add an article for the first time to the index, you have to move the NULL-pointer to point at the new post and then link the article last in the list.
    If an article with that article-number already exist in the list, the numbers on the storage should increase on the one that already existed.
    Does’nt the articlename correspond, then you could yourself decide how it’s gonna be solved in your programme.

    Assume from these files(must use)
    1. Hash.h
    2. Hash.cpp
    3. Article.h

    B) Sorting

    This task goes out on that you have to implement 3 optional sorting-algorithms. The algorithms shall be choosed so an algorithm works with O(n2), next with O(n log n) and the last one with O(n).

    Write a programme that at random takes number-values to a file. This file shall be used as indata for sorting. After the sorting, shall the result be written out into a result-file. The result-file shall also be used as indata for sorting, to see how the algorithms works on the already sorted or almost sorted data ( if some values changes).

    You shall have to create data-files with 5 different quantity of numbers to sort. These values shall be used as indata to respective algorithm. Run the algorithm with indata that is both sorted and unsorted.
    You shall use these following numbers: 100 000, 200 000, 400 000, 800 000 and 1 600 000 values. Same computer must be used to check all values to have a more fair result and the computer may not work with other things during the process of the sorting.
    Is it so that your computer makes the sorting too quick or too slow, you may have to change some numbers so you get a better result, NOTE that the quantity of the numbers shall double for each sorting.

    Every algorithm shall have two variables, compare and swap, that counts how many comparision and copies of values has been made during the sort. These two variables shall be used in comparision between the different algorithms.
    Registrate also the time the algorithms take when they are used, by using following class:
    1. Timer.h
    2. Timer.cpp

    Do a table with your results that contains these facts:
    • Run with an unsorted and a sorted data
    • Values for compare and swap for respective run
    • Time-consumption for respective run


    Here comes the code for the following files.
    Code:
    Code Tags added by Kermi3
    
    1. Hash.h
    
    #ifndef _HASH_H
    #define _HASH_H
    
    #include "LinkedList.h"
    
    class Hash
    {
    public:
    Hash();
    ~Hash();
    //... 
    
    private: 
    const int TABLESIZE;
    LinkedList *m_table;
    };
    
    #endif
    
    
    2. Hash.cpp
    
    #include "Hash.h"
    
    Hash::Hash() : TABLESIZE(11)
    {
    m_table = new LinkedList[TABLESIZE];
    }
    
    Hash::~Hash()
    {
    delete[] m_table;
    }
    
    
    3. Article.h
    
    #ifndef _ARTICLE_H
    #define _ARTICLE_H
    
    #include "String.h"
    
    class Article
    {
    public: 
    Article(int i_key, int i_number, String i_type);
    //...
    
    private:
    int m_key;
    int m_number;
    String m_type; //Använd din strängklass
    }; 
    
    #endif
    
    
    4. Timer.h
    
    #ifndef TIMER_H
    #define TIMER_H
    
    class Timer
    {
    public:
    Timer(){ m_startTime = 0; m_stopTime = 0; }
    int startTimer(); //Returnerar 0 om timern inte kunde initieras
    double stopTimer(); //Returnerar tiden (ms) som förlöpt mellan start och stop
    
    double getTime(); //Hämtar sista tidtagningen i millisekunder
    private:
    
    double m_startTime;
    double m_stopTime;
    double m_frequence;
    };
    
    #endif
    
    
    5. Timer.cpp
    
    
    #include 
    #include "timer.h"
    
    
    int Timer::startTimer()
    {
    LARGE_INTEGER start, freq;
    if(!QueryPerformanceFrequency(&freq))
    return 0;
    m_frequence = (double) freq.QuadPart;
    QueryPerformanceCounter(&start);
    m_startTime = (double)start.QuadPart;
    return 1;
    }
    
    double Timer::stopTimer()
    {
    LARGE_INTEGER end;
    QueryPerformanceCounter(&end);
    
    m_stopTime = (double)end.QuadPart;
    
    return (m_stopTime-m_startTime) * 1000.0 / m_frequence;
    }
    
    double Timer::getTime()
    {
    return (m_stopTime-m_startTime) * 1000.0 / m_frequence;
    }
    Code Tags added by Kermi3
    That's all. You can send me the programme by mail if you finished the lab. That would be awesome!

    THANK U ALL!

    email: elmacopaco@hotmail.com

  2. #2
    Registered User
    Join Date
    Sep 2004
    Location
    California
    Posts
    3,246
    That's all. You can send me the programme by mail if you finished the lab. That would be awesome!
    Is this a joke? Please leave.

  3. #3
    VA National Guard The Brain's Avatar
    Join Date
    May 2004
    Location
    Manassas, VA USA
    Posts
    903
    lmao
    • "Problem Solving C++, The Object of Programming" -Walter Savitch
    • "Data Structures and Other Objects using C++" -Walter Savitch
    • "Assembly Language for Intel-Based Computers" -Kip Irvine
    • "Programming Windows, 5th edition" -Charles Petzold
    • "Visual C++ MFC Programming by Example" -John E. Swanke
    • "Network Programming Windows" -Jones/Ohlund
    • "Sams Teach Yourself Game Programming in 24 Hours" -Michael Morrison
    • "Mathmatics for 3D Game Programming & Computer Graphics" -Eric Lengyel

  4. #4
    #include<xErath.h> xErath's Avatar
    Join Date
    Jun 2004
    Posts
    722
    I have a Hash Table in Java... Do you want that with or without code tags??

  5. #5
    unleashed alphaoide's Avatar
    Join Date
    Sep 2003
    Posts
    696
    Read this about homework policy : http://cboard.cprogramming.com/annou...ouncementid=39
    And this about posting a good question: FAQ: Examples of good questions (General)
    source: compsci textbooks, cboard.cprogramming.com, world wide web, common sense

  6. #6
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    I'm am posting this because it appears that you are posting a homework assignment or other project and you are asking for someone else to do all of the work.

    Please don't ask people to do all your work for you, See the announcement on Homework at the top of the forum to see what is acceptable or PM me.

    Basically people are happy to help, but they're not going to do it all for you.

    Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.

    On obivous homework questions especially, I also like to remind people of the board's tenth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.

    Feel free to PM me with any questions.

    Good Luck,

    Kermi3
    Lead Moderator
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  7. #7
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    I am posting this because you did not use code tags on this thread. In the furture please use Code Tags. They make your code MUCH easier to read and people will be much more likely to help you if you do. And they'll be happier about helping you

    For example:

    Without code tags:

    for(int i=0;i<5;i++)
    {
    cout << "No code tags are bad";
    }

    With Code Tags:
    Code:
    for(int i=0;i<5;i++)
    {
         cout << "This code is easy to read";
    }
    This is of course a basic example...more complicated code is even easier to read with code tags than without.

    I've added code tags for you this time. They can be added by putting [code] at the beginning of your code and [/code] at the end. More information on code tags may be found on the code tag post at the top of every forum. I also suggest you take a look at the board guildlines if you have not done so already.

    This is a common first post mistake, just remember to use [code] tags in the future and you'll get much more help.

    If this is your first time posting here the welcome, and if there's anything I can do or any questions I can answer about these forums, or anything else, please feel free and welcome to PM me.


    Good Luck with your program,

    Kermi3
    Lead Moderator
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  8. #8
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    Sorry, way too blatant homework for me.

    The real killer is "please email me"
    Which really means
    "I've spammed a shed-load of boards and I can't be arsed to remember where they all are. Plus I've no intention of ever returning to your loser board if none of you idiots don't email me a good answer. If you do provide a good answer, I'll treasure your email address and leech off you for the rest of my course".
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  9. #9
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    Wow - 1 post, 2 red boxes and you've only been here for just over an hour.
    Haven't seen a crash and burn like this since Yucatan 65M years ago
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  10. #10
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    el maco...don't listen to these guys, they're I am sillyI am sillyI am sillyI am sillyI am sillyI am sillyI am sillys....i'll do it for you....e-mail me everything that you have involving this project.. i don't have a domain name for my server yet, but just e-mail it to misplaced@127.0.0.1

  11. #11
    Anti-Poster
    Join Date
    Feb 2002
    Posts
    1,399
    > misplaced@127.0.0.1
    Ha...I think that cracked me up more than the OP.
    If I did your homework for you, then you might pass your class without learning how to write a program like this. Then you might graduate and get your degree without learning how to write a program like this. You might become a professional programmer without knowing how to write a program like this. Someday you might work on a project with me without knowing how to write a program like this. Then I would have to do you serious bodily harm. - Jack Klein

  12. #12
    and the hat of wrongness Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,422
    Fortunately, he seems to have faired no better elsewhere either - which is a "good thing"
    http://www.codeguru.com/forum/showthread.php?t=313359
    http://www.flipcode.com/cgi-bin/msg....=general&id=-1
    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.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

  13. #13
    Toaster Zach L.'s Avatar
    Join Date
    Aug 2001
    Posts
    2,686
    The guy one flipcode had a good response.
    The word rap as it applies to music is the result of a peculiar phonological rule which has stripped the word of its initial voiceless velar stop.

  14. #14
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >The guy one flipcode had a good response.
    And people say we're mean.
    My best code is written with the delete key.

  15. #15
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    Nothing benificial can come from this one. Closed. Will be reopened upon request of thread the author of the thread.
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Need help with programming lab.
    By woody292 in forum C++ Programming
    Replies: 3
    Last Post: 09-07-2008, 11:19 PM
  2. Internet Chem Lab
    By axon in forum A Brief History of Cprogramming.com
    Replies: 0
    Last Post: 02-17-2005, 08:12 PM
  3. programming from home to the lab???
    By nbo10 in forum Tech Board
    Replies: 7
    Last Post: 08-27-2004, 04:35 PM
  4. Please help debug this lab! Please!
    By mack_ol in forum C Programming
    Replies: 0
    Last Post: 02-17-2002, 11:32 AM
  5. stupid computer lab lady...
    By dirkduck in forum A Brief History of Cprogramming.com
    Replies: 7
    Last Post: 10-16-2001, 06:53 PM

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