diff options
| -rw-r--r-- | src/02/README.md | 67 |
1 files changed, 67 insertions, 0 deletions
diff --git a/src/02/README.md b/src/02/README.md new file mode 100644 index 0000000..ae874fa --- /dev/null +++ b/src/02/README.md @@ -0,0 +1,67 @@ +# Learning Profile for Assignment #2 - Computer Science 272: Data Structures and Algorithms + +Name: Mo Khan +Student ID: 3431709 + +## Question 1 +### Problem Statement + +Design an algorithm for the following operations for a binary tree BT, and show the worst-case running times for each implementation: +* preorderNext(x): return the node visited after node x in a pre-order traversal of BT. +* postorderNext(x): return the node visited after node x in a post-order traversal of BT. +* inorderNext(x): return the node visited after node x in an in-order traversal of BT. + +### Description of the Code +### Errors and Warnings +### Sample Input and Output +### Discussion + +## Question 2 +### Problem Statement + +Design a recursive linear-time algorithm that +tests whether a binary tree satisfies the +search tree order property at every node. + +### Description of the Code +### Errors and Warnings +### Sample Input and Output +### Discussion + +## Question 3 +### Problem Statement + +Illustrate what happens when the sequence 1, 5, 2, 4, 3 is added to an empty +ScapegoatTree, and show where the credits described in the proof of Lemma 8.3 go, +and how they are used during this sequence of additions. + +### Description of the Code +### Errors and Warnings +### Sample Input and Output +### Discussion + +## Question 4 +### Problem Statement + +Implement a commonly used hash table in a program that handles collision using linear probing. + +Using (K mod 13) as the hash function, store the following elements in the table: + +{1, 5, 21, 26, 39, 14, 15, 16, 17, 18, 19, 20, 111, 145, 146}. + +### Description of the Code +### Errors and Warnings +### Sample Input and Output +### Discussion + +## Question 5 +### Problem Statement + +Create a subclass of `BinaryTree` whose nodes have fields for storing preorder, post-order, and in-order numbers. +Write methods `preOrderNumber()`, `inOrderNumber()`, and `postOrderNumbers()` that assign these numbers correctly. +These methods should each run in `O(n)` time. + +### Description of the Code +### Errors and Warnings +### Sample Input and Output +### Discussion |
