Summary of notes + links to samples for CSC 365

Review Java (8/26/05-8/31/05)
Event Handeling in Java + Java Swing (9/2/05-9/9/05)
Collections (9/12/05-9/14/05)
Files + File Systems (9/14/05-10/3/05)
Tree data structures and Algorithms (Red-Black Tree, AVL Tree, 2-3-4 Tree, Btree, etc.) (10/07/05-11/11/05)
Graph Data Structures and Algorithms (Shortest-Path, Max Flow, etc) (11/14/05-11/21/05)
External Sorting (11/28/05)
Priority Queues (11/30/05)
B+-Tree(External) (12/2/05)
Database Concepts (12/5/05-12/9/05)

8/26/05-8/31/05 reviewing java.

9/2/05-9/9/05 Event Handeling in Java + Swing classes for building GUI.

9/12/05-9/12/05 Collection Classes and Interfaces.

9/14/05-10/3/05 Introduced Files + File Systems. 10/3/05 - 11/12/05 Trees.

General discussion about graphs and then directed graphs. Specialized form of Graph called Tree was then defined. A Tree is a Graph that has no cycles. Each nodein the Tree except for the root has one parent. A Tree has a node identified as the root where all other nodes are descendants of that node.

Further specialization of the Tree brought us to the discussion about Binary Tree and extending Binary Trees took us into a discussion about Binary Search Tree (BST). The recursive definition of the BST was introduced:

We discussed the insertion and deletion in a Binary Search Tree; for more information on coding these operations, you may visit
Tree.java, and treeNode.java.

Red-Black Tree was defines as a BST that...

Insertion and deletion of elements were discussed. The solution to the double-red during insertion and the double-black problem during deletion were both explained.

Insertion starts just like a BST insertion. All new nodes are added as red in a Red-Black tree; obviously, if the node is inserted to the left or the right of a node that is red; we end up with a double-red problem right away. The problem is resolved with a recoloring or restructuring. When we recolor, we may propagate the problem up the tree causing further recoloring or restructing. We do a trinode-restructuring when the sibling of the red parent in a double-red context is black; we recolor when the sibling is red.

Deletion starts just like a BST deletion. If the node that we delete is red; there is no impact on the black-depth of the tree; thus, we are already done. If the node we are deleting is black but has one red child; then the red child takes the place of the deleted node and gets colored black; again, the black depth is not affected. We run into the double-black problem when we delete a black node with a black child. Three cases are identified: 1. Root of the sibling side is black; but, it has a red child. 2. Root if the sibling side is black but has no red child. 3. Root of the sibling is red. Case 1. is solved by restructuring. Case 2. is solved by recoloring. Case 3. is solved through adjustment that turns the problem into case 1. or case 2.

Coding RBtree was discussed and the example RBtree.java was examined.

AVL Tree

An AVL tree is another balanced binary search tree named after the inventors, Adelson-Velskii and Landis. AVLs were the first dynamically balanced trees to be proposed, like red-black trees, they are not perfectly balanced, but pairs of sub-trees differ in height by at most 1, maintaining an O(logn) search time. Addition and deletion operations also take O(log n) time.

Definition of an AVL tree:

We'll discuss Insertion/Deletion for AVL trees. We'll also discuss coding AVLs by looking at Tree class and AVL class implementation. A few additional methods: levels, count, countLeaves, displayAll will be discussed as well. Be sure to review the code for test program for our AVL tree.

BTREE:

  • Define order-n Btree rules.
  • Discuss insertion/deletions for order-5 and order-3 BTrees. Homeworks assigned on insertion and deletion from B-tree were assigned.
  • BTree class and its helper class Node are discussed.
  • Test programs test1 and test2 are discussed for testing Btree are also discussed.
  • Discuss external index structures developed as Btrees. The Knuth Variation of BTree (B+Tree) as well as B*Tree were discussed.

    4/16/03-4/25/03 Graphs + their algorithms.

    11/28/05 External Sorting. Will discuss Balanced Multi-Way Mergetsort.

    5/2/03-5/7/03 Databases Architecture (External, Conceptual, Internal) were discussed, as well as, expressing queries in SQL.