6
1. (C/C++) Write a function to calculate this equation: ( input: float x, output: float y.) Optimize for execution speed and robustness. Write all programs in cross-platform C/C++. Programming Test

Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer

  • Upload
    others

  • View
    1

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer

1. (C/C++) Write a function to calculate this equation: ( input: float x, output: float y.)

Optimize for execution speed and robustness.• Write all programs in cross-platform C/C++.•

Programming Test

Page 2: Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer

2. (C/C++) Write a function to normalize a 3 dimensional Cartesian vector.

Optimize for execution speed and robustness.• Write all programs in cross-platform C/C++.•

Page 3: Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer

3. (C/C++) Write a function that removes a given node in a linked list container containingnodes of type LinkList. Assume that each LinkList node and its data pointer wereoriginally allocated dynamically by either malloc (C code) or new (C++ code).

typedef struct LinkList {struct LinkList *next;struct LinkList *prev;struct ImportantData *data;

} LinkList_t;

LinkList_t *headList;

Please enter results on the following page:

Optimize for execution speed and robustness.• Write all programs in cross-platform C/C++.•

Page 4: Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer
Page 5: Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer

4. (C/C++) The findMaxDistance() function (given below) calculates the maximumdistance between any two players in the passed-in player array. Refactor it so that it alsocalculates the minimum distance between any two players. You may change thesignature of the function and the contents of the function, but do not change the Vect_tstructure.

typedef struct Vect // Vector struct for positions{ float x; float y; float z;} Vect_t;

Please enter results on the following page:

Optimize for execution speed and robustness.• Write all programs in cross-platform C/C++.•

Page 6: Programming Test3. (C/C++) Write a function that removes a given node in a linked list container containing nodes of type LinkList. Assume that each LinkList node and its data pointer