Assignment #8 on Chapter 11: Search Trees (Sorry No Code)

Slides:



Advertisements
Similar presentations
Chapter 9: Graphs Shortest Paths
Advertisements

Splay Tree Algorithm Mingda Zhao CSC 252 Algorithms Smith College Fall, 2000.
Augmenting Data Structures Advanced Algorithms & Data Structures Lecture Theme 07 – Part I Prof. Dr. Th. Ottmann Summer Semester 2006.
I/O-Algorithms Lars Arge Fall 2014 September 25, 2014.
Data Structures: A Pseudocode Approach with C 1 Chapter 6 Objectives Upon completion you will be able to: Understand and use basic tree terminology and.
Advanced Data Structures
Insert A tree starts with the dummy node D D 200 D 7 Insert D
1 Binary Search Trees Implementing Balancing Operations –AVL Trees –Red/Black Trees Reading:
CS 206 Introduction to Computer Science II 12 / 01 / 2008 Instructor: Michael Eckmann.
Self-Balancing Search Trees Chapter 11. Chapter 11: Self-Balancing Search Trees2 Chapter Objectives To understand the impact that balance has on the performance.
Fall 2007CS 2251 Self-Balancing Search Trees Chapter 9.
Self-Balancing Search Trees Chapter 11. Chapter Objectives  To understand the impact that balance has on the performance of binary search trees  To.
Chapter 4: Trees AVL Trees Lydia Sinapova, Simpson College Mark Allen Weiss: Data Structures and Algorithm Analysis in Java.
1 Section 9.2 Tree Applications. 2 Binary Search Trees Goal is implementation of an efficient searching algorithm Binary Search Tree: –binary tree in.
CSC 2300 Data Structures & Algorithms February 16, 2007 Chapter 4. Trees.
Advanced Data Structures and Algorithms COSC-600 Lecture presentation-6.
Properties: -Each node has a value -The left subtree contains only values less than the parent node’s value -The right subtree contains only values greater.
Trees By Charl du Plessis. Contents Basic Terminology Basic Terminology Binary Search Trees Binary Search Trees Interval Trees Interval Trees Binary Indexed.
14/13/15 CMPS 3130/6130 Computational Geometry Spring 2015 Windowing Carola Wenk CMPS 3130/6130 Computational Geometry.
Shortest Path Problem Weight of the graph –Nonnegative real number assigned to the edges connecting to vertices Weighted graphs –When a graph.
Module 5 – Networks and Decision Mathematics Chapter 23 – Undirected Graphs.
CIS 068 Welcome to CIS 068 ! Lesson 12: Data Structures 3 Trees.
CSE 3358 NOTE SET 13 Data Structures and Algorithms.
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.
Splay trees Go&Ta How do you organize your world?
SPLAY TREE The basic idea of the splay tree is that every time a node is accessed, it is pushed to the root by a series of tree rotations. This series.
G64ADS Advanced Data Structures
B-Tree Michael Tsai 2017/06/06.
Programming Abstractions
Topics covered (since exam 1):
Binary Search Tree (BST)
Balanced Trees AVL : Adelson-Velskii and Landis(1962)
Data Structures and Analysis (COMP 410)
Splay Trees.
SPLAY TREE Features Binary Search Tree Self adjusting balanced tree
Tree.
Lecture 22 Binary Search Trees Chapter 10 of textbook
ITEC 2620M Introduction to Data Structures
Lecture 25 Splay Tree Chapter 10 of textbook
Orthogonal Range Searching and Kd-Trees
CPSC-310 Database Systems
Final Exam Review 6 December 2010.
Topics covered (since exam 1):
Trees Part 2!!! By JJ Shepherd.
CSCI 104 Splay Trees Mark Redekopp.
Graphs Representation, BFS, DFS
Topics covered (since exam 1):
Tree Rotations & Splay Trees
Topic 10 Trees.
Reporting (1-D) Given a set of points S on the line, preprocess them to build structure that allows efficient queries of the from: Given an interval I=[x1,x2]
AVL Trees Lab 11: AVL Trees.
Topic 10 Trees.
v z Chapter 10 AVL Trees Acknowledgement: These slides are adapted from slides provided with Data Structures and Algorithms in C++, Goodrich,
SPLAY TREES.
Tree Rotations and AVL Trees
CMSC 341 Splay Trees.
Red-Black Trees 1/16/2019 1:56 PM Splay Trees v z Splay Trees.
Topics covered (since exam 1, excluding PQ):
Assignment /6/2.
CMSC 341 Splay Trees.
Lecture 9: Self Balancing Trees
Basic Data Structures - Trees
CMSC 341 Splay Trees.
Topics covered (since exam 1):
Goals Design decisions Design Insertion
CMSC 341 Splay Trees.
Chapter 9: Graphs Shortest Paths
326 Lecture 9 Henry Kautz Winter Quarter 2002
Topic 10 Trees.
A Binary Tree is a tree in which each node has at most 2 children
Presentation transcript:

Assignment #8 on Chapter 11: Search Trees (Sorry No Code) 2016-5-25 By H.B.

Initial idea: Make a normal tree. For every vertex,make a balanced tree to store the sum of each color. The order depends on the amount. Search the answer.

1. Make a normal tree. 2. Record the queries. 3. Record the amount of every color of the subtree of the lowest vertices. (Using recursion & Balanced search tree) 4. Record the answer. 5. Loops: Update the balanced tree while processing the higher vertex and record the answer.

Numbers in list a & Numbers not in list a ; How many numbers that are bigger than the current one are moved to the front ; 2 1 3

Make a splay tree to record the number and its position. (*2) When a number is moved, mark it and “SPLAY” it. Now the right sub tree is made up with numbers “larger” than it. If the current position is negative, the answer is the sum. Or the answer is the number + s.

Balanced tree. (One by one) Find the farthest one that he can stand before. Compare the distance and his “c”. Insert the new man with his new position.

1. Make 26 splay trees for each letter 1. Make 26 splay trees for each letter. Use 1 & 0 to mark the nodes if the number at the current position is or is NOT the letter. 2. Each node has a flag. 3. Take the letter “a” as an example. When it comes to the range that we want to change, we can know the amount of it in the splay tree a. ( Splay two sides) 4. The FLAG of the parent of the first/ last few vertices is 1.

zig-zag zig-zig zig x z z y z y y T4 T1 x T4 T1 T2 T3 T4 x T3 T2 T3 T1 w T2 z w y T3 T1 T2 T3 T4 T3 T4 T1 T2