The basic data structures (arrays, lists, stacks, queues and trees) have been employed throughout, and used as the basis of the crucial processes, such as storing, sorting and searching data, which underly many computer science applications.
In order to develop algorithms using an array representation, we need to allocate memory and keep track of the largest position that has been lled so far, which is the same as the current number of nodes in the heap tree. This will involve something like:
We will start by studying some key data structures, such as arrays, lists, queues, stacks and trees, and then move on to explore their use in a range of di erent searching and sorting algorithms. This leads on to the consideration of approaches for more e cient storage of data in hash tables.
Thus, an algorithm which deletes any node i from a heap tree is: The bubble down process is more di cult to implement than bubble up, because a node may have none, one or two children, and those three cases have to be handled di erently.
Introduction and reviewAlgorithm analysisList, stacks and queuesTrees and hierarchical orders See full list on ece.uwaterloo.ca
Before we proceed with looking at data structures for storing linearly ordered data, we must take a diversion to look at trees. At first glance, it appears as if trees aremost appropriate for storing hierarchically ordered data; however, we will later see how trees can also be used to allow efficient storage of linearly ordered data, as well. See full list on ece.uwaterloo.ca
A general tree is appropriate for storing hierarchical orders, where the relationship is between the parent and the children. There are many cases, however, where the tree datastructure is more useful if there is a fixed number of identifiable children. This topic looks at binary trees as well as perfect and complete binary trees, N-ary trees, the
This topic looks at storing linearly ordered data in search trees. The focus is to ensure that operations on individual elements stored in the tree run in Θ(ln(-)) time. See full list on ece.uwaterloo.ca
A priority queue stores linearly ordered data based on the priority; however, by restricting the operations, those operations can be optimized. See full list on ece.uwaterloo.ca
Note that previously I used to teach linear probing and double hashing; however, it hasbeen brought to my attention that quadratic hashing is better—especially when we considerthe effects of caching and the additional cost of cache misses. See full list on ece.uwaterloo.ca