Vous êtes sur la page 1sur 9

Data Abstractions

– A computer’s main memory is not organized as arrays, lists, stacks, queues, and
trees but is instead organized as a sequence of addressable memory cells. Thus,
all other structures must be simulated. How this simulation is accomplished is
the subject of this chapter.Organizations such as arrays, lists, stacks, queues,
and trees are abstract tools that are created so that users of the data can be
shielded from the details of actual data storage and can be allowed to access
information as though it were stored in a more convenient form. The common
thread is that the user has the privilege of accessing data as an abstract tool.
Arrays

– An array is a container object


that holds a fixed number of
values of a single type.
Linked lists

linked list: a list consisting of items in which


each item knows the location of the
next item.
Node: an item in a linked list. Each node
contains a piece of list data and the
location of the next node (item).
Link: (of a node) the location of the next node.
head node: first node in a linked list
head pointer: points to the head node
By restricting the manner in which the entries of a list are accessed, we obtain two
special types of lists known as stacks and queues.
Storing Binary Trees

– A tree data structure is a powerful tool for organizing data objects based on keys. It
is equally useful for organizing multiple data objects in terms of hierarchical
relationships (think of a ``family tree'', where the children are grouped under their
parents in the tree).
Trees Data Structures

 The topmost node in the tree is called the root. There is only one root per tree
and one path from the root node to any node.
 Every node (excluding a root) in a tree is connected by a directed edge from
exactly one other node. This node is called a parent.
 Child − The node below a given node connected by its edge downward is called
its child node.
 Leaf − The node which does not have any child node is called the leaf node.
Common operations

The process of deleting an internal


node in a binary tree

The process of inserting a node into a binary


tree
Expression Trees
Binary Search Trees

Definition : Binary Search Tree (BST).A binary


search tree is a binary tree ; either it is empty
or each node contains an identifier and
 all identifiers in the left sub tree of T are less
than the identifiers in the root note T.
 all the identifiers the right sub tree are
greater than the identifier in the root node T.
 the right and left sub tree are also BSTs.

Vous aimerez peut-être aussi