Find Jobs
Hire Freelancers

C++ Program from Weiss Book

$30-40 USD

Ukończony
Opublikowano ponad 19 lat temu

$30-40 USD

Płatne przy odbiorze
**Due Date: Sept 25 Assignment:** The problem is to generate a random permutation of the first N integers. So, if N=4 one possible answer is: {3,1,2,4} The following is not a correct answer because 3 is repeated and it doesn't include 1: {3,3,2,4} The assignment is to first implement 3 separate solutions to this problem using the following three algorithms: #1. Fill the array a from a[0] to a[N-1] as follows: To fill a[i], generate random numbers until you get one that is not already in a[0], a[1], ..., a[i-1]. So, to fill a[0] there is nothing to check. Whatever random number you generate can be put in a[0]. To fill a[1] you need to generate a random number and then check that it isn't the same as the one in a[0]. This goes on until a[N-1] is filled. a[N-1] may take several tries to fill. The chance of generating a random number that hasn't already been assigned at a[N-1] is 1 out of N. #2. Same as #1 but keep an extra array called the usedarray. When a random number, r, is first put in the array a, set used[r] = true. This means that when filling a[i] with a random number you can test in one step to see whether the random number has been used, instead of the possibly i steps in the first algorithm. #3. Fill the array such that a[i] = i+1. Then: for( i = 1; i < n; i++) swap( a[ i ], a[ randInt( 0, i ) ] ); randInt( x, y) will return a random integer between i and j inclusive. Without implementing these algorithms it's possible to estimate their asymptotic complexity. The runtime of algorithm #1 is O(N2 log N), the runtime of #2 is O(N log N), and the runtime of #3 is O(N). The second part of the assignment is to empirically verify these estimates. You can do this by running the algorithms for increasing values of N and comparing the ratio of observed runtimes with predicted runtime. The easiest way to do this is with a table of values that looks something like: Alg1 N = 250, 500, 1,000, 2,000 Alg2 N = 2,500, 5,000, 10,000, 20,000, 40,000, 80,000 Alg3 N = 10,000, 20,000, 40,000, 80,000, 160,000, 320,000, 640,000 ## Deliverables The three main deliverables are: (1) your source code, (2) the table of values that show results converging to a constant, and (3) a write-up of your analysis of the results. In your analysis be sure to include for each implementation brief comments to help us understand your solution. 3) All deliverables will be considered "work made for hire" under U.S. Copyright law. Buyer will receive exclusive and complete copyrights to all work purchased. (No GPL, GNU, 3rd party components, etc. unless all copyright ramifications are explained AND AGREED TO by the buyer on the site per the coder's Seller Legal Agreement). ## Platform Windows
Identyfikator projektu: 3352511

Informację o projekcie

18 ofert
Zdalny projekt
Aktywny 20 lat temu

Szukasz sposobu na zarobienie pieniędzy?

Korzyści ze składania ofert na Freelancer.com

Ustal budżet i ramy czasowe
Otrzymuj wynagrodzenie za swoją pracę
Przedstaw swoją propozycję
Rejestracja i składanie ofert jest bezpłatne
Przyznano:
Awatar Użytkownika
See private message.
$7 USD w 9 dni
5,0 (8 opinii)
2,6
2,6
18 freelancerzy składają oferty o średniej wysokości $18 USD dla tej pracy
Awatar Użytkownika
See private message.
$21,25 USD w 9 dni
4,8 (339 opinii)
6,4
6,4
Awatar Użytkownika
See private message.
$29,75 USD w 9 dni
5,0 (25 opinii)
6,2
6,2
Awatar Użytkownika
See private message.
$17 USD w 9 dni
5,0 (79 opinii)
5,8
5,8
Awatar Użytkownika
See private message.
$25,50 USD w 9 dni
4,9 (212 opinii)
5,8
5,8
Awatar Użytkownika
See private message.
$15,30 USD w 9 dni
4,9 (196 opinii)
5,7
5,7
Awatar Użytkownika
See private message.
$21,25 USD w 9 dni
5,0 (102 opinii)
5,7
5,7
Awatar Użytkownika
See private message.
$8,50 USD w 9 dni
5,0 (13 opinii)
5,2
5,2
Awatar Użytkownika
See private message.
$4,25 USD w 9 dni
5,0 (43 opinii)
4,5
4,5
Awatar Użytkownika
See private message.
$34 USD w 9 dni
4,7 (6 opinii)
3,6
3,6
Awatar Użytkownika
See private message.
$10,20 USD w 9 dni
5,0 (29 opinii)
3,5
3,5
Awatar Użytkownika
See private message.
$13,60 USD w 9 dni
5,0 (8 opinii)
2,1
2,1
Awatar Użytkownika
See private message.
$29,75 USD w 9 dni
5,0 (8 opinii)
2,0
2,0
Awatar Użytkownika
See private message.
$3,40 USD w 9 dni
5,0 (1 opinia)
0,0
0,0
Awatar Użytkownika
See private message.
$12,75 USD w 9 dni
0,0 (1 opinia)
0,0
0,0
Awatar Użytkownika
See private message.
$25,50 USD w 9 dni
0,0 (0 opinii)
0,0
0,0
Awatar Użytkownika
See private message.
$3,40 USD w 9 dni
0,0 (0 opinii)
0,0
0,0
Awatar Użytkownika
See private message.
$25,50 USD w 9 dni
0,0 (0 opinii)
0,0
0,0
Awatar Użytkownika
See private message.
$34 USD w 9 dni
0,0 (0 opinii)
0,0
0,0

O kliencie

Flaga UNITED STATES
United States
5,0
5
Członek od wrz 16, 2004

Weryfikacja Klienta

Inne pracę od tego klienta

Fortune Cookie(repost)
$30-40 USD
Dziękujemy! Przesłaliśmy Ci e-mailem link do odebrania darmowego bonusu.
Coś poszło nie tak podczas wysyłania wiadomości e-mail. Proszę spróbować ponownie.
Zarejestrowani Użytkownicy Całkowita Liczba Opublikowanych Projektów
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Wczytywanie podglądu
Udzielono pozwolenia na Geolokalizację.
Twoja sesja logowania wygasła i zostałeś wylogowany. Proszę, zalogować się ponownie.