Hashing Techniques
1
Hashing Techniques
Several ADTs for storing and retrieving data were discussed Linear Lists, Binary Trees, BSTs, AVL Trees. An important operation Findkey() has a time complexity: O(n) in Lists, O(n) in Binary Trees, O(log n) in BSTs
Heaps & Priority Queues
A heap is a binary tree. A heap is best implemented in sequential representation (using an array). Two important uses of heaps are:
(i) efficient implementation of priority queues (ii) sorting - Heapsort.
1
A Heap
10
30
20
Any no
B-Trees
1
B-trees: Why?
Best tree discussed so far AVL Tree: Important operation Findkey() can be implemented in O(log n) time. AVL Tree has problems for large data
the size of the AVL tree increases and may not fit in the system's main memory. the heig
AVL Trees
1
AVL Trees
Consider a situation when data elements are inserted in a BST in sorted order: 1, 2, 3, . 1 BST becomes a 2 degenerate tree. Search operation 3 FindKey takes O(n), n which is as inefficient as in a list.
2
AVL Trees
It is possible
Binary Search Trees (BSTs)
1
Binary Search Trees (BSTs)
Consider the search operation FindKey (): find an element of a particular key value in a binary tree. This operation takes O(n) time in a binary tree. In a binary tree of 106 nodes 106 steps require
General Trees & Binary Trees
CSC212
1
Trees
Previous data structures (e.g. lists, stacks, queues) have a linear structure. Linear structures represent one-to-one relation between data elements. Trees have a nested or a hierarchical structure. Hierarchica
Stacks, Queues & Deques
CSC212
1
Stacks & Queues
Stack: Last In First Out (LIFO).
Used in procedure calls, to compute arithmetic expressions etc.
Queue: First In First Out (FIFO).
Used in operating systems, simulations etc.
Priority Queues: Highest p
Data Structures
ADT List
1
ADT List
Elements Structure
Domain User of an ADT must only know this
Operations
Specification Representation Implementation
2
Implementer must know all these.
ADT List: Specification
Elements: The elements are of type <Type>. T
Data Structures
CSC212
1
Fundamental Concepts
Some fundamental concepts that you should know:
Dynamic memory allocation. Recursion. Performance analysis.
2
Performance Analysis
There are problems and algorithms to solve them. Problems and problem instan
Data Structures: Introduction
CSC212
1
Data Types & Data Structures
Applications/programs read data, store data temporarily, process it and finally output results. What is data? Numbers, Characters, etc.
Application/ Program Data
Data
2
Data Types & Data