Test_3_solution

# Test_3_solution - Deep Copy Returning new node(without freeing it Version B Problem 1 1 a,b,c,d 2 b 3 d 4 a 5 a,b,c Sheet1 Page 2 Problem 2 17

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

Sheet1 Page 1 Version A: Problem 1 1 - a,b,c,d 2 - d 3 - c 4 - c 5 - a,d(,e) Problem 2 15 Semicolon 48,52,56 for (const char *p = end-1 p >= expr --p) 49,53 if (*p == . .. || *p == . ..) 57 if (*p == '^') (near)60 } 73 expr_node *right = parse_expression(lhs, op) 74 expr_node *left = parse_expression(rhs, end) 75 return create_expr_node(*op, 0, right, left) 81 expr_node *root = parse_expresson("10-5-5",NULL) 83 delete_expr_node(root) Problem 3 1) Add the string to the tail of the list (or enqueue) 2) (all of these are in one line. .. the newlines are for readability) (don't count off if the whitespace is off) a) recursion recursion is recursion is fun recursion is fun is recursion is fun is fun b) Racecar c) A A B A B C d) taerg taerg si taerg si 2731SC Problem 4 Malloc Malloc return != null Shallow Copy

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

View Full Document
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Deep Copy Returning new node (without freeing it) ________________________________________________ Version B Problem 1 1 - a,b,c,d 2 - b 3 - d 4 - a 5 - a,b(,c) Sheet1 Page 2 Problem 2 17 ... 43,44 int left = evaluate(root->left) 45 switch (root->mode) 63 return root->value 79 expr_node *right = parse_expression(lhs, op) 80 expr_node *left = parse_expression(rhs, end) 81 return create_expr_node(*op, 0, right, left) 87 expr_node *root = parse_expression("10-5-5",NULL) 89 delete_expr_node(root) Problem 3 1) Adds the string to the head of the linked list (or stack) 2) a) fun is fun is recursion b) Racecar c) C B A d) 2731SC si taerg Problem 4 Malloc Malloc return != null Shallow Copy Deep Copy Returning new node (without freeing it)...
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 / 2

Test_3_solution - Deep Copy Returning new node(without freeing it Version B Problem 1 1 a,b,c,d 2 b 3 d 4 a 5 a,b,c Sheet1 Page 2 Problem 2 17

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

View Full Document
Ask a homework question - tutors are online