{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

Solutions for Practice Test 3

# Solutions for Practice Test 3 - Problem 4 A...

This preview shows pages 1–3. Sign up to view the full content.

Solutions for Practice Test 3 Problem 1 A) II—42 bytes B) Linked List C) III – for(A;B;D){C;} D) IV—none of the above E) II—select Problem 2 A) B) 7 8 9 10 14 15 16 17 18 20 C) 10 8 7 9 15 14 16 20 18 17 1 0 8 1 5 7 9 1 6 1 4 2 0 1 8 1 7

This preview has intentionally blurred sections. Sign up to view the full version.

View Full Document
Problem 3 void PriorityInsert(QNode **pqueue, QNode *node) { if(!*pqueue) { *pqueue = node; } elseif((*pqueue)->priority > node->priority) { node -> next = *pqueue; *pqueue = node; } else { PriorityInsert(&((*pqueue)->next), node); }
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: } Problem 4 A) SMyStruct *copyStruct(SMyStruct *src) { SMyStruct *copy = (SMyStruct*)malloc(sizeof(SMyStruct)); *copy = *src; copy->myData = (int*)malloc(sizeof(int)); *(copy->myData) = *(src->myData); return copy; } B) int sum_free(sVector *v1) { int sum = 0; for(int i=0;i<v1->length;i++) { sum += vindex(*v1, i); } vfree(v1); return sum; }...
View Full Document

{[ snackBarMessage ]}