sort, hash or pars

This is a discussion on sort, hash or pars within the C++ Programming forums, part of the General Programming Boards category; howdy, i have been reading about sorting algorithums and have a basic question. it seems the terms sort, hash and ...

  1. #1
    In The Light
    Join Date
    Oct 2001
    Posts
    598

    sort, hash or pars

    howdy,
    i have been reading about sorting algorithums and have a basic question. it seems the terms sort, hash and pars are used interchageably. what is the difference as far as implementation? all of these techniques seem to do pretty much the same thing,
    do they just go about it a different way?

    M.R.

  2. #2
    Unregistered
    Guest
    here's my 2 cents worth:

    sorts use a physical attribute intrinsic to an item to place them in some sort of order----alphabetically in reverse based on value of 2 char of last name or whatever. To search for a given item you have to look at each item in turn, although on average you only have to search half the collection once they are in order.

    hash takes some intrinsic attribute and places it in some sort of formula using the result to place the item in "order". The difference is now you can search faster for a given item by using the same formula in the search as for the sort. On average, unless you have a large number of items hashing to the same spot (collisions), you have to search far fewer items in a collection that has been hashed than on a collection that has been sorted. A good hashing function to use will vary depending on the collection. A good hashing function will produce few collisions so searching should be faster than even with a sorted collection.

    pars to me means breaking up into pieces based on some criteria. For example, parsing a sentence into individual words or parsing the word Mississippi using each i as the pars symbol.

  3. #3
    In The Light
    Join Date
    Oct 2001
    Posts
    598
    howdy,
    Thanks Guest, now let me ask a bit more specific question,

    take a 2 dimensional array
    column 0 contains an identification
    column 1 contains a valie related to the identification:
    Code:
    column 0   column 1
    W36x210    13200
    W36x194    12100
    W33x241    14200
    W33x221    12800
    this array wil contain about 1500 rows.
    to sort by column 1 which would be the best algorithum.

    M.R.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem with unaligned intrinsics
    By The Wazaa in forum C++ Programming
    Replies: 4
    Last Post: 02-18-2009, 12:36 PM
  2. Straight Insertion Sort function problem
    By StaticKyle in forum C++ Programming
    Replies: 6
    Last Post: 05-12-2008, 05:03 AM
  3. Group Project Help/Volunteer
    By DarkDot in forum C++ Programming
    Replies: 3
    Last Post: 04-25-2007, 12:36 AM
  4. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 05:03 AM
  5. Not sure on hash table memory allocations
    By Thumper333 in forum C Programming
    Replies: 3
    Last Post: 09-27-2004, 10:00 PM

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