interpolation sort

This is a discussion on interpolation sort within the C Programming forums, part of the General Programming Boards category; construct a list of n pseudorandom numbers between 0 and 1. Suitable values for n are 10 (for debugging) and ...

  1. #1
    Registered User
    Join Date
    Jul 2002
    Posts
    1

    Question interpolation sort

    construct a list of n pseudorandom numbers between 0 and 1. Suitable values for n are 10 (for debugging) and 500 (for comparing the results with other methods). Write a program to sort these numbers into an array via the following interpolation sort. First, clear the array (to all 0). for each number from the old list, multiply it by n, take the integer part, and look in that position of the table. if that position is 0, put the number there. if not, move left or right(according to the size of the current number , moving the entries in the table over if necessary to make room ( as in tje fashion of insertion sort). Show that your algorithm will really sort the numbers correctly. must be in in C using Microsoft Visual C++ compiler.

    turn in:
    interpolation.c
    and any .h files
    must be contiguous

    If any one have this file, please feel free to email it to saigonara@yahoo.com

    sincerely

  2. #2
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Give me a break. Do your own damn homework. No one is going to write those files for you, you lazy bastard.

    Quzah.
    Hope is the first step on the road to disappointment.

  3. #3
    ....
    Join Date
    Aug 2001
    Location
    Groningen (NL)
    Posts
    2,386
    Being able to design an algorithm is important and proof that your algorithm is correct is a basic element of programming. It is not always easy, but you should learn it. BTW, the algorithms is already given, so you only need to implement it.

  4. #4
    End Of Line Hammer's Avatar
    Join Date
    Apr 2002
    Posts
    6,231
    Originally posted by quzah
    Give me a break. Do your own damn homework. No one is going to write those files for you, you lazy ....

    Quzah.
    Hey, Quzah... stop mincing your words, and just say what you mean... (I like ya style, btw)
    When all else fails, read the instructions.
    If you're posting code, use code tags: [code] /* insert code here */ [/code]

  5. #5
    Unregistered
    Guest
    run this

    Code:
    #include <stdio.h>
    
    int main()
    {
      int poylg[] = {80,105,115,115,32,79,102,102,32,89,111,117,
                            32,76,97,122,121,32,71,105,116,33};
      int i, x;
    
      for(x=0;x<20;x++)
      {
        printf("\n");
        for(i=0; i<22;i++)
        {
          printf("%c",poylg[i]);
        }
      }
      rewind (stdin);
      getch();
    
      return 0;
    }

  6. #6
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,796
    >and just say what you mean
    I think that kind of language would cause the survivors to break out the smelling salts.

    -Prelude
    My best code is written with the delete key.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Straight Insertion Sort function problem
    By StaticKyle in forum C++ Programming
    Replies: 6
    Last Post: 05-12-2008, 04:03 AM
  2. threaded merge sort
    By AusTex in forum Linux Programming
    Replies: 4
    Last Post: 05-04-2005, 04:03 AM
  3. Sorting
    By vasanth in forum A Brief History of Cprogramming.com
    Replies: 12
    Last Post: 11-10-2003, 04:21 PM
  4. radix sort and radix exchange sort.
    By whatman in forum C Programming
    Replies: 1
    Last Post: 07-31-2003, 12:24 PM
  5. Shell Sort vs Heap Sort vs Quick Sort
    By mackol in forum C Programming
    Replies: 6
    Last Post: 11-22-2002, 07:05 PM

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