Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

Similar documents
Abstract Data Structures IB Computer Science. Content developed by Dartford Grammar School Computer Science Department

Binary Trees

Chapter 20: Binary Trees

MULTIMEDIA COLLEGE JALAN GURNEY KIRI KUALA LUMPUR

Cpt S 122 Data Structures. Data Structures Trees

Binary Trees, Binary Search Trees

TREES. Trees - Introduction

We have the pointers reference the next node in an inorder traversal; called threads

Trees. CSE 373 Data Structures

Trees. (Trees) Data Structures and Programming Spring / 28

Computational Optimization ISE 407. Lecture 16. Dr. Ted Ralphs

CSCI-401 Examlet #5. Name: Class: Date: True/False Indicate whether the sentence or statement is true or false.

Associate Professor Dr. Raed Ibraheem Hamed

Binary Trees. College of Computing & Information Technology King Abdulaziz University. CPCS-204 Data Structures I

Section 5.5. Left subtree The left subtree of a vertex V on a binary tree is the graph formed by the left child L of V, the descendents

Copyright 1998 by Addison-Wesley Publishing Company 147. Chapter 15. Stacks and Queues

Trees. Truong Tuan Anh CSE-HCMUT

Programming II (CS300)

Trees! Ellen Walker! CPSC 201 Data Structures! Hiram College!

Data Structure - Binary Tree 1 -

(2,4) Trees. 2/22/2006 (2,4) Trees 1

There are many other applications like constructing the expression tree from the postorder expression. I leave you with an idea as how to do it.

Data Structure Lecture#10: Binary Trees (Chapter 5) U Kang Seoul National University

Successor/Predecessor Rules in Binary Trees

Algorithms in Systems Engineering ISE 172. Lecture 16. Dr. Ted Ralphs

Data Structures. Outline. Introduction Linked Lists Stacks Queues Trees Deitel & Associates, Inc. All rights reserved.

CS24 Week 8 Lecture 1

Name CPTR246 Spring '17 (100 total points) Exam 3

Binary Search Trees. What is a Binary Search Tree?

Binary Trees. Examples:

(2,4) Trees Goodrich, Tamassia (2,4) Trees 1

Chapter 5. Binary Trees

CS350: Data Structures Tree Traversal

Binary Trees. BSTs. For example: Jargon: Data Structures & Algorithms. root node. level: internal node. edge.

Garbage Collection: recycling unused memory

Cpt S 122 Data Structures. Course Review Midterm Exam # 1

Topic 14. The BinaryTree ADT

CSI33 Data Structures

Principles of Computer Science

March 20/2003 Jayakanth Srinivasan,

Binary Search Trees. 1. Inorder tree walk visit the left subtree, the root, and right subtree.

Stacks, Queues and Hierarchical Collections

Trees. Q: Why study trees? A: Many advance ADTs are implemented using tree-based data structures.

a graph is a data structure made up of nodes in graph theory the links are normally called edges

Binary search trees. Binary search trees are data structures based on binary trees that support operations on dynamic sets.

Binary search trees 3. Binary search trees. Binary search trees 2. Reading: Cormen et al, Sections 12.1 to 12.3

CS 206 Introduction to Computer Science II

CSC148 Week 6. Larry Zhang

Final Exam Data Structure course. No. of Branches (5)

Operations on Heap Tree The major operations required to be performed on a heap tree are Insertion, Deletion, and Merging.

Tree. A path is a connected sequence of edges. A tree topology is acyclic there is no loop.

INF2220: algorithms and data structures Series 1

Stacks, Queues and Hierarchical Collections. 2501ICT Logan

Trees : Part 1. Section 4.1. Theory and Terminology. A Tree? A Tree? Theory and Terminology. Theory and Terminology

CSE 373 Spring Midterm. Friday April 21st

Binary Tree. Preview. Binary Tree. Binary Tree. Binary Search Tree 10/2/2017. Binary Tree

Lec 17 April 8. Topics: binary Trees expression trees. (Chapter 5 of text)

Revision Statement while return growth rate asymptotic notation complexity Compare algorithms Linear search Binary search Preconditions: sorted,

Data Structure. IBPS SO (IT- Officer) Exam 2017

CS302 - Data Structures using C++

Department of Computer Science and Technology

CS301 - Data Structures Glossary By

Computer Science 210 Data Structures Siena College Fall Topic Notes: Trees

CSE 230 Intermediate Programming in C and C++ Binary Tree

Chapter 11.!!!!Trees! 2011 Pearson Addison-Wesley. All rights reserved 11 A-1

Chapter 11.!!!!Trees! 2011 Pearson Addison-Wesley. All rights reserved 11 A-1

Trees 11/15/16. Chapter 11. Terminology. Terminology. Terminology. Terminology. Terminology

Data Structures. Binary Trees. Root Level = 0. number of leaves:?? leaves Depth (Maximum level of the tree) leaves or nodes. Level=1.

Data Structure Advanced

Binary search trees (BST) Binary search trees (BST)

Algorithms and Data Structures

Objective Questions for Online Practical Exams under CBCS Scheme Subject: Data Structure-I (CS-113)

A set of nodes (or vertices) with a single starting point

6-TREE. Tree: Directed Tree: A directed tree is an acyclic digraph which has one node called the root node

Binary Search Trees Treesort

1. Stack overflow & underflow 2. Implementation: partially filled array & linked list 3. Applications: reverse string, backtracking

CISC 235 Topic 3. General Trees, Binary Trees, Binary Search Trees

Trees. Estruturas de Dados / Programação 2 Árvores. Márcio Ribeiro twitter.com/marciomribeiro. Introduc)on. Hierarchical structure

Trees. Introduction & Terminology. February 05, 2018 Cinda Heeren / Geoffrey Tien 1

Binary Tree. Binary tree terminology. Binary tree terminology Definition and Applications of Binary Trees

Trees. Tree Structure Binary Tree Tree Traversals

CE 221 Data Structures and Algorithms

Data Structures and Algorithms for Engineers

COSC 2011 Section N. Trees: Terminology and Basic Properties

tree nonlinear Examples

Course Review for. Cpt S 223 Fall Cpt S 223. School of EECS, WSU

Why Use Binary Trees? Data Structures - Binary Trees 1. Trees (Contd.) Trees

BST Implementation. Data Structures. Lecture 4 Binary search trees (BST) Dr. Mahmoud Attia Sakr University of Ain Shams

COSC 2007 Data Structures II Final Exam. Part 1: multiple choice (1 mark each, total 30 marks, circle the correct answer)

MID TERM MEGA FILE SOLVED BY VU HELPER Which one of the following statement is NOT correct.

Data Structures - Binary Trees 1

INF2220: algorithms and data structures Series 1

Programming II (CS300)

Data Structures. Trees. By Dr. Mohammad Ali H. Eljinini. M.A. Eljinini, PhD

Tree Data Structures CSC 221

2-3 and Trees. COL 106 Shweta Agrawal, Amit Kumar, Dr. Ilyas Cicekli

Tree Structures. A hierarchical data structure whose point of entry is the root node

F453 Module 7: Programming Techniques. 7.2: Methods for defining syntax

FINALTERM EXAMINATION Fall 2009 CS301- Data Structures Question No: 1 ( Marks: 1 ) - Please choose one The data of the problem is of 2GB and the hard

Summer Final Exam Review Session August 5, 2009

Transcription:

Abstract Data Structures IB Computer Science Content developed by Dartford Grammar School Computer Science Department

HL Topics 1-7, D1-4 1: System design 2: Computer Organisation 3: Networks 4: Computational thinking 5: Abstract data structures 6: Resource management 7: Control D: OOP

1: System design HL only 5 Overview Thinking recursively 5.1.1 Identify a situation that requires the use of recursive thinking 5.1.2 Identify recursive thinking in a specified problem solution 5.1.3 Trace a recursive algorithm to express a solution to a problem Abstract data structures 5.1.4 Describe the characteristics of a two-dimensional array 5.1.5 Construct algorithms using two-dimensional arrays 5.1.6 Describe the characteristics and applications of a stack 5.1.7 Construct algorithms using the access methods of a stack 5.1.8 Describe the characteristics and applications of a queue 5.1.9 Construct algorithms using the access methods of a queue 5.1.10 Explain the use of arrays as static stacks and queues Linked lists 5.1.11 Describe the features and characteristics of a dynamic data structure 5.1.12 Describe how linked lists operate logically 5.1.13 Sketch linked lists (single, double and circular) Trees 5.1.14 Describe how trees operate logically (both binary and non-binary) 5.1.15 Define the terms: parent, left-child, right-child, subtree, root and leaf 5.1.16 State the result of inorder, postorder and preorder tree traversal 5.1.17 Sketch binary trees Applications 5.1.18 Define the term dynamic data structure 5.1.19 Compare the use of static and dynamic data structures 5.1.20 Suggest a suitable structure for a given situation 2: Computer Organisation 4: Computational thinking 6: Resource management D: OOP 3: Networks 5: Abstract data structures 7: Control

Topic 5.1.11 Describe how linked lists operate logically

Abstract Data Structures (ADTs) 2D array Stack Queue Linked List (Binary) Tree Recursion

Linked list A linked list is a linear collection of self-referential structures, called nodes, connected by pointer links. A linked list is accessed by keeping a pointer to the first node of the list. This pointer to the first node of a list is typically named head. Subsequent nodes are accessed via a link pointer member that is stored in each node.

Linear & Circular Linked Lists

Inserting into a linked list Insertion into a linked list has three special cases: 1. Inserting a new node to the very beginning of the list 2. Inserting a new node at the very end of the list 3. Inserting a new node in the middle of the list and so, has a predecessor and successor in the list

An empty list When list is empty, which is indicated by (head == NULL)condition, the insertion is quite simple. Algorithm sets both head and tail to point to the new node.

Inserting at the BEGINNING In this case, new node is inserted right before the current head node. Update the next link of a new node, to point to the current head node. Update head link to point to the new node.

Inserting at the END In this case, new node is inserted right after the current tail node. Update the next link of the current tail node, to point to the new node. Update tail link to point to the new node.

Inserting in the MIDDLE In general case, new node is always inserted between two existing nodes. Head and tail links are not updated in this case. Update link of the "previous" node, to point to the new node. Update link of the new node, to point to the "next" node.

Super useful site for algorithms http://www.algolist.net/data_structures/singly-linked_list/insertion

Exam question about ADTs (Linked Lists, Queue, Stacks)

Solution for (a)

Solution for (b)

Solution for (c) part 1

Solution for (c) part 2

Solution for (d)

Great presentation about linked lists http://www.slideshare.net/sshinchan/single-linked-list