Find Jobs
Hire Freelancers

C++ Program from Weiss Book

$30-40 USD

Terminado
Publicado hace más de 19 años

$30-40 USD

Pagado a la entrega
**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
ID del proyecto: 3352511

Información sobre el proyecto

18 propuestas
Proyecto remoto
Activo hace 20 años

¿Buscas ganar dinero?

Beneficios de presentar ofertas en Freelancer

Fija tu plazo y presupuesto
Cobra por tu trabajo
Describe tu propuesta
Es gratis registrarse y presentar ofertas en los trabajos
Adjudicado a:
Avatar del usuario
See private message.
$7 USD en 9 días
5,0 (8 comentarios)
2,6
2,6
18 freelancers están ofertando un promedio de $18 USD por este trabajo
Avatar del usuario
See private message.
$21,25 USD en 9 días
4,8 (339 comentarios)
6,4
6,4
Avatar del usuario
See private message.
$29,75 USD en 9 días
5,0 (25 comentarios)
6,2
6,2
Avatar del usuario
See private message.
$17 USD en 9 días
5,0 (79 comentarios)
5,8
5,8
Avatar del usuario
See private message.
$25,50 USD en 9 días
4,9 (212 comentarios)
5,8
5,8
Avatar del usuario
See private message.
$15,30 USD en 9 días
4,9 (196 comentarios)
5,7
5,7
Avatar del usuario
See private message.
$21,25 USD en 9 días
5,0 (102 comentarios)
5,7
5,7
Avatar del usuario
See private message.
$8,50 USD en 9 días
5,0 (13 comentarios)
5,2
5,2
Avatar del usuario
See private message.
$4,25 USD en 9 días
5,0 (43 comentarios)
4,5
4,5
Avatar del usuario
See private message.
$34 USD en 9 días
4,7 (6 comentarios)
3,6
3,6
Avatar del usuario
See private message.
$10,20 USD en 9 días
5,0 (29 comentarios)
3,5
3,5
Avatar del usuario
See private message.
$13,60 USD en 9 días
5,0 (8 comentarios)
2,1
2,1
Avatar del usuario
See private message.
$29,75 USD en 9 días
5,0 (8 comentarios)
2,0
2,0
Avatar del usuario
See private message.
$3,40 USD en 9 días
5,0 (1 comentario)
0,0
0,0
Avatar del usuario
See private message.
$12,75 USD en 9 días
0,0 (1 comentario)
0,0
0,0
Avatar del usuario
See private message.
$25,50 USD en 9 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$3,40 USD en 9 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$25,50 USD en 9 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
See private message.
$34 USD en 9 días
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
United States
5,0
5
Miembro desde sept 16, 2004

Verificación del cliente

Otros trabajos de este cliente

Fortune Cookie(repost)
$30-40 USD
¡Gracias! Te hemos enviado un enlace para reclamar tu crédito gratuito.
Algo salió mal al enviar tu correo electrónico. Por favor, intenta de nuevo.
Usuarios registrados Total de empleos publicados
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Cargando visualización previa
Permiso concedido para Geolocalización.
Tu sesión de acceso ha expirado y has sido desconectado. Por favor, inica sesión nuevamente.