Huffman Coding Draw the tree, label all nodes w/ index, leaves w/ letter and all links(0 or 1) What is the most frequent letter? What is the least frequent.

Slides:



Advertisements
Similar presentations
Michael Alves, Patrick Dugan, Robert Daniels, Carlos Vicuna
Advertisements

The Dictionary ADT Definition A dictionary is an ordered or unordered list of key-element pairs, where keys are used to locate elements in the list. Example:
22C:19 Discrete Structures Trees Spring 2014 Sukumar Ghosh.
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
Data Structure and Algorithms (BCS 1223) GRAPH. Introduction of Graph A graph G consists of two things: 1.A set V of elements called nodes(or points or.
Data Compressor---Huffman Encoding and Decoding. Huffman Encoding Compression Typically, in files and messages, Each character requires 1 byte or 8 bits.
Binary Trees A binary tree is made up of a finite set of nodes that is either empty or consists of a node called the root together with two binary trees,
Graph COMP171 Fall Graph / Slide 2 Graphs * Extremely useful tool in modeling problems * Consist of: n Vertices n Edges D E A C F B Vertex Edge.
B + -Trees Same structure as B-trees. Dictionary pairs are in leaves only. Leaves form a doubly-linked list. Remaining nodes have following structure:
B-Tree B-Tree is an m-way search tree with the following properties:
Course Review COMP171 Spring Hashing / Slide 2 Elementary Data Structures * Linked lists n Types: singular, doubly, circular n Operations: insert,
B-Trees Disk Storage What is a multiway tree? What is a B-tree?
B-Trees Disk Storage What is a multiway tree? What is a B-tree?
Unit 11a 1 Unit 11: Data Structures & Complexity H We discuss in this unit Graphs and trees Binary search trees Hashing functions Recursive sorting: quicksort,
1 B-Trees Disk Storage What is a multiway tree? What is a B-tree? Why B-trees? Comparing B-trees and AVL-trees Searching a B-tree Insertion in a B-tree.
COMP 171 Data Structures and Algorithms Tutorial 10 Hash Tables.
1 abstract containers hierarchical (1 to many) graph (many to many) first ith last sequence/linear (1 to 1) set.
General Trees and Variants CPSC 335. General Trees and transformation to binary trees B-tree variants: B*, B+, prefix B+ 2-4, Horizontal-vertical, Red-black.
B-Trees and B+-Trees Disk Storage What is a multiway tree?
Balanced Trees. Binary Search tree with a balance condition Why? For every node in the tree, the height of its left and right subtrees must differ by.
B-Trees (continued) Analysis of worst-case and average number of disk accesses for an insert. Delete and analysis. Structure for B-tree node.
Chapter 9: Graphs Spanning Trees Mark Allen Weiss: Data Structures and Algorithm Analysis in Java Lydia Sinapova, Simpson College.
AVL Trees / Slide 1 Deletion  To delete a key target, we find it at a leaf x, and remove it. * Two situations to worry about: (1) target is a key in some.
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Trees.
C o n f i d e n t i a l HOME NEXT Subject Name: Data Structure Using C Unit Title: Graphs.
1 B-Trees Section AVL (Adelson-Velskii and Landis) Trees AVL tree is binary search tree with balance condition –To ensure depth of the tree is.
Advanced Data Structures and Algorithms COSC-600 Lecture presentation-6.
MA/CSSE 473 Day 28 Hashing review B-tree overview Dynamic Programming.
CS112A1 Spring 2008 Practice Final. ASYMPTOTIC NOTATION: a)Show that log(n) and ln(n) are the same in terms of Big-Theta notation b)Show that log(n+1)
Data Structures Arrays both single and multiple dimensions Stacks Queues Trees Linked Lists.
B+ Trees COMP
Search Related Algorithms. Graph Code Adjacency List Representation:
Trees. Introduction to Trees Trees are very common in computer science They come in different forms They are used as data representation in many applications.
CSCE350 Algorithms and Data Structure Lecture 17 Jianjun Hu Department of Computer Science and Engineering University of South Carolina
1 Section 1.4 Graphs and Trees A graph is set of objects called vertices or nodes where some pairs of objects may be connected by edges. (A directed graph.
IT 60101: Lecture #151 Foundation of Computing Systems Lecture 15 Searching Algorithms.
1 Binary Trees Informal defn: each node has 0, 1, or 2 children Informal defn: each node has 0, 1, or 2 children Formal defn: a binary tree is a structure.
Review for Final Andy Wang Data Structures, Algorithms, and Generic Programming.
Starting at Binary Trees
MA/CSSE 473 Day 28 Dynamic Programming Binomial Coefficients Warshall's algorithm Student questions?
5.5.3 Rooted tree and binary tree  Definition 25: A directed graph is a directed tree if the graph is a tree in the underlying undirected graph.  Definition.
Arboles B External Search The algorithms we have seen so far are good when all data are stored in primary storage device (RAM). Its access is fast(er)
ITEC 2620A Introduction to Data Structures Instructor: Prof. Z. Yang Course Website: 2620a.htm Office: TEL 3049.
Lecture 11COMPSCI.220.FS.T Balancing an AVLTree Two mirror-symmetric pairs of cases to rebalance the tree if after the insertion of a new key to.
CS 206 Introduction to Computer Science II 11 / 16 / 2009 Instructor: Michael Eckmann.
Chapter 7 Trees_Part3 1 SEARCH TREE. Search Trees 2  Two standard search trees:  Binary Search Trees (non-balanced) All items in left sub-tree are less.
Data Structures academy.zariba.com 1. Lecture Content 1.Linear Data Structures 2.Trees and Graphs* 3.Dictionaries and Hash Tables 4.Homework 2.
Review for Final Exam – cs411/511 Definitions (5 questions, 2 points each) Algorithm Analysis (3 questions, 3 points each) General Questions (3 questions,
CSS446 Spring 2014 Nan Wang.  to study trees and binary trees  to understand how binary search trees can implement sets  to learn how red-black trees.
Week 10 - Friday.  What did we talk about last time?  Graph representations  Adjacency matrix  Adjacency lists  Depth first search.
Trees, Binary Search Trees, Balanced Trees, Graphs Graph Fundamentals Telerik Algo Academy
GRAPHS. Graph Graph terminology: vertex, edge, adjacent, incident, degree, cycle, path, connected component, spanning tree Types of graphs: undirected,
Chapter 10: Trees A tree is a connected simple undirected graph with no simple circuits. Properties: There is a unique simple path between any 2 of its.
Week 15 – Wednesday.  What did we talk about last time?  Review up to Exam 1.
Hello Everyone!!! 1. Tree And Graphs 2 Features of Trees  Tree Nodes Each node have 0 or more children A node have must one parent  Binary tree Tree.
1.[10] Suppose we have 14 integers: 10, 100, 30, 130, 80, 50, 140, 20, 60, 70, 120, 40, 90, 110. Please create a 2-3 tree by inserting one integer at a.
Discrete Mathematics Chapter 10 Trees. Outline 10.1 Introduction to Trees 10.2 Applications of Trees 10.3 Tree Traversal 10.4 Spanning Trees 10.5 Minimal.
Chapter 11. Chapter Summary  Introduction to trees (11.1)  Application of trees (11.2)  Tree traversal (11.3)  Spanning trees (11.4)
B+-Tree Deletion Underflow conditions B+ tree Deletion Algorithm
Trees Chapter 15.
Tries 07/28/16 11:04 Text Compression
Tries 5/27/2018 3:08 AM Tries Tries.
Chapter 5 : Trees.
Source Code for Data Structures and Algorithm Analysis in C (Second Edition) – by Weiss
AVL DEFINITION An AVL tree is a binary search tree in which the balance factor of every node, which is defined as the difference between the heights of.
Hash In-Class Quiz.
A Hash Table with Chaining
ITEC 2620M Introduction to Data Structures
Heaps Chapter 6 Section 6.9.
Chapter 9: Graphs Spanning Trees
Presentation transcript:

Huffman Coding Draw the tree, label all nodes w/ index, leaves w/ letter and all links(0 or 1) What is the most frequent letter? What is the least frequent letter?

R B F O A Encode FOOBAR:______________________________________________________ Write down the message coded by this sequence: ___________________________________________________

Huffman Coding Draw the tree, label all nodes w/ index, leaves w/ letter and all links(0 or 1) What is the most frequent letter? What is the least frequent letter?

R L T E A Encode LATER:______________________________________________________ Is this a valid sequence: ? Is this a valid sequence: ?

Ternary Tries Insert these words into an initially empty ternary trie: Map Atom Stem Hash Treap AVL Hashing Trie

B-Trees Quick Review: *data records are stored only in the leaves *All the leaves are at the same level *Internal nodes store key values which guide searching in the tree *An internal node holds one fewer keys than it has children: the leftmost child has no key stored for it every other child has a key stored which is equal to the smallest key in the subtree rooted at that child

B-Trees: What does 2-3 mean? A B-tree with M=L=3 is called a 2-3 tree B-Trees are parameterized on M, L A leaf always holds between ceil(L/2.) and L data records (inclusive) An internal node always has between ceil(M/2.) and M children (inclusive) So, in a 2-3 tree, internal nodes have 2 or 3 children (But max 2 keys!) and leaves hold 2 or 3 records

Insert the following elements into a 2-3 B-Tree: 12, 5, 15, 25, 100, 125, 110, 115

Graphs – Unweighted Draw the graph What are both (2) BFS starting from index 0 visiting all vertices? What are all (3) DFS starting from index 0 visiting all vertices?

The transitive closure of a graph G is a graph that has the same vertices as G, and an edge from vertex i to vertex j if and only if there is a path from vertex i to vertex j in G. Show the adjacency list representation for the transitive closure of G:

Graphs – Weighted Draw the graph, then find the minimal spanning tree Inf Inf

Hashing – Chaining For Final: No Ordered Hashing or Brent’s Method Use Chaining to build a hashtable given, H(K) = K mod 5 And keys: 100, 50, 19, 48, 27, 12, 22

Hashing – Double vs. Chaining Primary hash function: H(K) = K mod 5 Secondary hash function: H2(K) = (K mod 4) + 1 Write down the order of insertion: If all keys are equally likely, what is the average # of probes for a successful search?

Given that the keys were inserted in this order: 27, 22, 25, 24, 21 Show the table using Chaining: If all keys are equally likely, what is the average # of probes for a successful search? Better than double hashing?

Disjoint Subsets The set of element labels is S={0,1,2,3,4,5,6}. The data structure after MAKESET(7) is shown in A. The data stucture after a sequence of UNION operations is shown in B. How many DS in B? Write down a sequence of calls to UNION that would transform A into B:

Given the system of disjoint subsets in B, write down the value of the following calls to FIND : FIND(0):__________ FIND(1):__________ FIND(2):__________ FIND(3):__________