Find Jobs
Hire Freelancers

Fix and debug c algorithm

₹600-1500 INR

In corso
Pubblicato circa 7 anni fa

₹600-1500 INR

Pagato al completamento
This project requires someone familiar in math and algorithms Please fix the following 2 functions that are the reverse of one another please consider that the factorial of 8! = 40320 and 2^16 = 65536 so when 8 non-repeating possibilities are used the 16 bit translation of the order from the array works and when 1 or more numbers from the array is repeated this also needs to be fixed in this algorithm to always return in function 2 numbers between 0 and 7: Please verify in a loop all possibilities working to fix the following algorithm func1: dst_BitString parameter is a string made up of 16 1 s and 0 s that needs to be returned based on the order of numbers in src_Order src_Order parameter is an array made up of numbers between 0 and 65535 not ordered func2: src_BitString parameter is a string made up of 16 1 s and 0 s that represent the order from func1 variable dst_BitString dst_Order parameter is an array made up of numbers between 0 and 7 that needs to be returned with the order of the numbers from src_Order int func1(char* dst_BitString, int* src_Order) { int n = 0; for (int i = 0; i < 8; i++) { int k = 0; for (int j = i + 1; j < 8; j++) { if (src_Order[i] > src_Order[j]) k++; } n *= (8 - i); n += k; } int b = 1 << 15; for (int i = 0; i < 16; i++) { dst_BitString[i] = (b & n) ? '1' : '0'; b >>= 1; } dst_BitString[16] = 0; return n; } int func2(int* dst_Order, char* src_BitString) { int n = 0; for (int i = 0; i < 16; i++) { n <<= 1; n += src_BitString[i] == '1' ? 1 : 0; } int n8 = 1; for (int i = 0; i < 8; i++) { dst_Order[i] = i; n8 *= i + 1; } int m = n; for (int i = 0; i < 8; i++) { n8 /= (8 - i); int k = m / n8; int t = dst_Order[i + k]; // .....i..k................. for (int j = i + k; j > i; j--) dst_Order[j] = dst_Order[j - 1]; dst_Order[i] = t; m -= k * n8; } return n; }
Rif. progetto: 13671353

Info sul progetto

2 proposte
Progetto a distanza
Attivo 7 anni fa

Hai voglia di guadagnare un po'?

I vantaggi delle offerte su Freelancer

Imposta il tuo budget e le scadenze
Fatti pagare per il lavoro svolto
Delinea la tua proposta
La registrazione e le offerte sui lavori sono gratuite
2 freelance hanno fatto un'offerta media di ₹1.275 INR
Avatar dell'utente
Hello. How are you today. I have read and understood the project. I have strong knowledge in Data structures and Algorithms. And I'm expert in C/++. I'm interested this project. I'll fix soon. I wait for your good reply. Thanks.
₹1.300 INR in 1 giorno
4,9 (176 valutazioni)
6,5
6,5
Avatar dell'utente
I'm expert in C programming. I guarantee you the best quality in time. Check my portfolio...................
₹1.250 INR in 2 giorni
0,0 (0 valutazioni)
0,0
0,0

Info sul cliente

Bandiera: LEBANON
Beirut, Lebanon
5,0
45
Metodo di pagamento verificato
Membro dal apr 25, 2016

Verifica del cliente

Grazie! Ti abbiamo inviato tramite email il link per richiedere il tuo bonus gratuito.
Non è stato possibile inviarti l'email. Riprova per piacere.
di utenti registrati di lavori pubblicati
Freelancer ® is a registered Trademark of Freelancer Technology Pty Limited (ACN 142 189 759)
Copyright © 2024 Freelancer Technology Pty Limited (ACN 142 189 759)
Caricamento anteprima
Autorizzazione per la geolocalizzazione concessa.
La tua sessione è scaduta ed è stato effettuato il log out. Accedi nuovamente per piacere.