Find Jobs
Hire Freelancers

C assignment

$30-250 USD

Concluído
Publicado há mais de 9 anos

$30-250 USD

Pago na 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 do Projeto: 6604443

Sobre o projeto

17 propostas
Projeto remoto
Ativo há 10 anos

Quer ganhar algum dinheiro?

Benefícios de ofertar no Freelancer

Defina seu orçamento e seu prazo
Seja pago pelo seu trabalho
Descreva sua proposta
É grátis para se inscrever e fazer ofertas em trabalhos
Concedido a:
Avatar do Usuário
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 em 1 dia
4,6 (7 avaliações)
3,2
3,2
17 freelancers estão ofertando em média $117 USD for esse trabalho
Avatar do Usuário
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 em 1 dia
4,9 (528 avaliações)
8,7
8,7
Avatar do Usuário
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 em 2 dias
4,7 (201 avaliações)
6,8
6,8
Avatar do Usuário
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 em 2 dias
4,9 (119 avaliações)
6,7
6,7
Avatar do Usuário
hello! I have good experience in C programming. I can deliver you high quality code in due time.
$100 USD em 3 dias
5,0 (132 avaliações)
6,3
6,3
Avatar do Usuário
hi i can deliver it in 7 hours max please feel free to contact me ####################################################################################
$155 USD em 3 dias
5,0 (38 avaliações)
5,4
5,4
Avatar do Usuário
hi I can help please reply thanks. v. .
$200 USD em 3 dias
5,0 (47 avaliações)
5,0
5,0
Avatar do Usuário
Looks like an interesting project, I want in. Do message me back if you are interested Regards, Pravesh
$100 USD em 3 dias
5,0 (12 avaliações)
4,9
4,9
Avatar do Usuário
一个有效的提议尚未被提供
$95 USD em 2 dias
5,0 (17 avaliações)
4,7
4,7
Avatar do Usuário
i can finish it i am good at c..kindly see my reviews to know more...waiting for your reply. ............................... regards, darpan
$155 USD em 3 dias
5,0 (8 avaliações)
3,6
3,6
Avatar do Usuário
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 em 2 dias
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
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 em 3 dias
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
A proposal has not yet been provided
$111 USD em 1 dia
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
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 em 1 dia
0,0 (0 avaliações)
0,0
0,0
Avatar do Usuário
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 em 1 dia
0,0 (0 avaliações)
0,0
0,0

Sobre o cliente

Bandeira do(a) UNITED STATES
cooper city, United States
5,0
6
Método de pagamento verificado
Membro desde out. 17, 2014

Verificação do Cliente

Obrigado! Te enviamos um link por e-mail para que você possa reivindicar seu crédito gratuito.
Algo deu errado ao enviar seu e-mail. Por favor, tente novamente.
Usuários Registrados Total de Trabalhos 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)
Carregando pré-visualização
Permissão concedida para Geolocalização.
Sua sessão expirou e você foi desconectado. Por favor, faça login novamente.