Solutions for Practice Test 3

Solutions for Practice Test 3 - } Problem 4 A) SMyStruct

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

View Full Document Right Arrow Icon
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 8 1 7 9 1 1 2 1 1
Background image of page 1

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

View Full DocumentRight Arrow Icon
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); }
Background image of page 2
Background image of page 3
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

This note was uploaded on 06/17/2008 for the course CS 1372 taught by Professor Smith during the Fall '07 term at Georgia Institute of Technology.

Page1 / 3

Solutions for Practice Test 3 - } Problem 4 A) SMyStruct

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online