SophiaPretty

(5)

$14/per page/Negotiable

About SophiaPretty

Levels Tought:
Elementary,Middle School,High School,College,University,PHD

Expertise:
Accounting,Algebra See all
Accounting,Algebra,Applied Sciences,Architecture and Design,Art & Design,Biology,Business & Finance,Calculus,Chemistry,Communications,Computer Science,Economics,Engineering,English,Environmental science,Essay writing Hide all
Teaching Since: Jul 2017
Last Sign in: 304 Weeks Ago, 4 Days Ago
Questions Answered: 15833
Tutorials Posted: 15827

Education

  • MBA,PHD, Juris Doctor
    Strayer,Devery,Harvard University
    Mar-1995 - Mar-2002

Experience

  • Manager Planning
    WalMart
    Mar-2001 - Feb-2009

Category > Computer Science Posted 18 Nov 2017 My Price 10.00

must implement the following functions You may implement

I would like to hopefully get some help in completing this assignment. I am struggling to begin. I would like tutoring help instead of just handing over the assignment if possible.

 

In the source file you submit, big40.c, you must implement the following functions. You may implement

any auxiliary functions you need to make these work, as well. Notice that none of your

functions should print anything to the screen or STDOUT.

 

Integer40 *big40Add(Integer40 *p, Integer40 *q);

 

Description: Return a pointer to a new, dynamically allocated Integer40 struct that contains the

result of adding the 40 digit integers represented by p and q.

 

Special Notes: If a NULL pointer is passed to this function, simply return NULL. If any dynamic

memory allocation functions fail within this function, also return NULL, but be careful

to avoid memory leaks when you do so.

 

Hint: Before adding two huge integers, you will want to create n array to store the result. Remember

that all integers in this problem are 40 digits long. In the event that the most significant

digits (MSD) result in a carry, the carry will be ignored. For example, if the MSD of

the two inputs are 9 and 7, the resultant MSD will be 6 with a carry of 1 for the MSD + 1

digit. (916 + 716 = 1016, therefore 6 is the MSD and the 1 is ignored.) (The subscript of 16 indicate base 16. However the two expressions 1016 and 10x are equivalent and used equally often.)

 

Returns: A pointer to the newly allocated Integer40 struct, or NULL in the special cases mentioned

above.

 

Integer40 *i40Destroyer(Integer40 *p);

 

Description: Destroy any and all dynamically allocated memory associated with p. Avoid segmentation

faults and memory leaks.

 

Returns: NULL

 

Integer40 *parseString(char *str);

 

Description: Convert a number from string format to Integer40 format. (For example function

calls, see big40-main01.c.)

 

Special Notes: If the empty string ("") is passed to this function, treat it as a zero ("0"). If

any dynamic memory allocation functions fail within this function, or if str is NULL, return

NULL, be careful to avoid memory leaks when you do so. You may assume the string

will only contain ASCII digits '0' through '9' and the letters 'A' thru 'F' in either upper

or lower case, for a minimum of 40 digits. In the event that 40 digits are not in the input

string, print an error message to STDERR and fill with leading zeroes. Also, if there are

more than 40 digits in the input string use the first 40 digits in the string.

 

Returns: A pointer to the newly allocated Integer40 struct, or NULL if dynamic memory allocation

fails or if the input str is NULL.

 

Integer40 *fibBig40(int n, Integer40 *first, Integer40 *second);

 

Description: This is your Fibonacci function. Pay careful attention the F(0) is initialized with

the hwConfigVariable and F(1) is initialized with the cryptoVariable. Implement an iterative

solution that runs in O(n) time and returns a pointer to a Integer40 struct that contains

F(n). Be sure to prevent memory leaks before returning from this function.

 

Space Consideration: When computing F(n) for large n, it's important to keep as few Fibonacci

numbers in memory as necessary at any given time. For example, in building up to F(10000),

you won't want to hold Fibonacci numbers F(0) through F(9999) in memory all at once.

Find a way to have only a few Fibonacci numbers in memory at any given time over the

course of a single call to fibBig40(...).

 

Special Notes: Remember that n is the second parameter passed as an input argument to the

program. You may assume that n is a non-negative integer. If any dynamic memory allocation

functions fail within this function, return NULL, but be careful to avoid memory leaks

when you do so.

 

Returns: A pointer to an Integer40 representing F(n), or NULL if dynamic memory allocation

fails.

 

void big40Rating();

 

STDERR output: Outputs the following items to STDERR, delimited by a semicolon ";":

 

1. NID

2. A difficulty rating of how difficult you found this assignment on a scale of 1.0 (ridiculously

easy) through 5.0 (insanely difficult).

3. Duration, in hours, of the time you spent on this assignment.

 

The first argument to this function is the pointer to the big40RatingStruct which is defined

in the big40.h include file. Make sure to output those items to STDERR. Each element should

be terminated or delimited by a ";".

Integer40* loadHwConfigVariable(int seed);

 

Returns: A pointer to an Integer40 array of 40 random digits. If the input variable seed is set,

the random number generator will be seeded, otherwise not. Regardless, the 40 digits will be

initialized in 10 unique groups of 4 random digits. Returns NULL if there is an error during

creation or initialization of the hwConfigVariable.

 

Integer40* loadCryptoVariable(char *cryptoVariableFilename);

 

Returns: A pointer to an Integer40 array of 40 random digits read in from the cryptoVariable-

Filename. Returns NULL if there is an error during initialization of the cryptoVariable or in

the file I/O.

Attachments:

Answers

(5)
Status NEW Posted 18 Nov 2017 06:11 AM My Price 10.00

-----------  ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly

Not Rated(0)