-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathQuestions.h
More file actions
39 lines (26 loc) · 1.06 KB
/
Questions.h
File metadata and controls
39 lines (26 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
// Functions of Question 1
void add_vectors(double vector1[],double vector2[],double vector3[],int size);
double scalar_prod(double vector1[],double vector2[],int size);
double norm2(double vector1[],int size);
// Functions of Question 2
#define N3 3
void diag_scan(int mat [][N3], int arr []);
// Functions and Struct Definition of Question 3
// This struct is used to record the value and the position index of non-zero values in a sparse vector
struct Q3Struct
{
int val;
int pos;
};
void efficient(const int source[], struct Q3Struct effVector[], int size);
void reconstruct(int source[], int m, const struct Q3Struct effVector[], int n);
// Functions and Struct Definition of Question 4
// The structure defined here will be the element of an N-sized array.
// The goal is to sort the struct array in Ascending Order using the intData of the struct.
struct Q4Struct
{
int intData;
char charData;
};
void sortDatabyBubble(struct Q4Struct array[], int size);
void sortDatabySelection(struct Q4Struct array[], int size);