Find Jobs
Hire Freelancers

C assignment

$30-250 USD

Terminado
Publicado hace más de 9 años

$30-250 USD

Pagado a la entrega
Assignment #2 COP-4338, Programming III Assignment 2 consists of two parts. Part one will create the data, which will be use in part 2. Part1: Write an application that creates 1000 random-sized-files on disk of 500KB maximum size. For this you can create a string buffer of random size, of up to 100 chars, and write it to the file. You can repeat this process create a new string and write it again to the same file. As each string is of random length the size of the files will also be random. Notice that each file will have 500KB only if all strings were of maximum size, but it is more likely to be smaller than 500KB. Tips: Name your files with a sequence, such as [login to view URL], [login to view URL] … [login to view URL], so they can be easily read in a loop. Use time() as a seed for rand(), see sample code on moodle. Once you have the list of 1000 files you can proceed to part 2 Part 2: Read the files created in part 1 and create a structure, which stores the text from the file and the file size. Create an array of these structures (one structure per file read). This will require calling malloc() and allocating contiguous space to store all the structures. typedef struct file_txt { char filename[10]; char buffer[500*8*1000]; /* Null terminated txt from the file */ int size; /* size of the file */ } file_txt; Tips: Notice that the variable buffer is not a pointer but allocates space to store the whole length of the string. This means that upon calling malloc to allocate the memory, it might fail. If this is the case you can halve the size in part1 until it works on your machine Then, sort the array of structures by the size of the file. This will require moving them around in the array. Measure the time this sorting process takes. Output the sorted order of the files (file names) to a file ([login to view URL]) . You can implement any sorting algorithm you want as long as you use the same on the following section. Free the memory, recreate the array of structures, and repeat the experiment, but this time instead of sorting the array of structures, create an array of pointers to each structure and sort the pointers based on the size of the structures they point to. As this time we are only moving pointers (ints), the sorting should be more efficient. Measure the time this takes and compare it to the previous. Append the sorted order of the file (file names) to the [login to view URL] file used before. Create a Makefile which compiles all the involved files. Create a “.h”, “.c”, and tester.c file with your project , as on assignment 1. Note: This code might be helpful in understating how to measure how long sorting takes: #include <sys/time.h> #include <time.h> struct timeval start, stop; gettimeofday(&start,NULL); sort_here(); gettimeofday(&stop,NULL); elapsed = 1000000 * (stop.tv_sec - start.tv_sec); elapsed += stop.tv_usec - start.tv_usec; // time in usecs printf ("%lu;\t", elapsed);
ID del proyecto: 6604443

Información sobre el proyecto

17 propuestas
Proyecto remoto
Activo hace 10 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
Dear sir, I've read your spec carefully. It's simple work. With 10 years experience in C++, I could be a good fit. I can complete it within 24-36 hours. Kind regards, Tin Tan
$60 USD en 1 día
4,6 (7 comentarios)
3,2
3,2
17 freelancers están ofertando un promedio de $117 USD por este trabajo
Avatar del usuario
Hello I'm interesting your project very well I'm a Good C/C++, Linux, Algorithm expert. I understand your req exactly. I m quite well experienced in these assignment jobs. Let's go ahead with me I want to service for you continously. Thanks
$120 USD en 1 día
4,9 (528 comentarios)
8,7
8,7
Avatar del usuario
Hello I am C expert with a lot of experience in helping students with assignments and tutoring. I have reviewed your requirements and understood it. I am familiar with file read and time in C and confident to handle this project perfectly. Please communicate to discuss further. Regards Anshu
$100 USD en 2 días
4,7 (201 comentarios)
6,8
6,8
Avatar del usuario
Dear, I did many c assignment. I understand your requirements and can do this project. I have a strong profile and programming skills. Thanks
$98 USD en 2 días
4,9 (119 comentarios)
6,7
6,7
Avatar del usuario
hello! I have good experience in C programming. I can deliver you high quality code in due time.
$100 USD en 3 días
5,0 (132 comentarios)
6,3
6,3
Avatar del usuario
hi i can deliver it in 7 hours max please feel free to contact me ####################################################################################
$155 USD en 3 días
5,0 (38 comentarios)
5,4
5,4
Avatar del usuario
hi I can help please reply thanks. v. .
$200 USD en 3 días
5,0 (47 comentarios)
5,0
5,0
Avatar del usuario
Looks like an interesting project, I want in. Do message me back if you are interested Regards, Pravesh
$100 USD en 3 días
5,0 (12 comentarios)
4,9
4,9
Avatar del usuario
一个有效的提议尚未被提供
$95 USD en 2 días
5,0 (17 comentarios)
4,7
4,7
Avatar del usuario
i can finish it i am good at c..kindly see my reviews to know more...waiting for your reply. ............................... regards, darpan
$155 USD en 3 días
5,0 (8 comentarios)
3,6
3,6
Avatar del usuario
Hi, We have checked your requirement and understand that you need same file create using looping each file char length equal . We are very happy to work with you. We are new to the elance but have more experience in the Software development and web development area. thanks
$200 USD en 2 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
I have good experience in programming C/C++. I'm good at coming up with algorithms. I'm also a Computer Science and Engineering student.
$100 USD en 3 días
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
A proposal has not yet been provided
$111 USD en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
This is a pretty simple task, I will complete it in under a day if you choose me.I had harder exams at school than this.
$55 USD en 1 día
0,0 (0 comentarios)
0,0
0,0
Avatar del usuario
Hy. I'm quite proficient in C and everything Unix. I'm a CS student in Vienna, and also a full time Senior Operator of our Governments e-health system. Algorithms and Datastructures come easy to me. I can deliver in 1 day (or less) on your task. Kind regards, odb9088
$111 USD en 1 día
0,0 (0 comentarios)
0,0
0,0

Sobre este cliente

Bandera de UNITED STATES
cooper city, United States
5,0
6
Forma de pago verificada
Miembro desde oct 17, 2014

Verificación del cliente

¡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.