Abstract Data Type (ADT) In early days programming, to read a file, we wrote a code to read the physical file. And we had to do this over and over again. Using ADT, we write the code to read a file and place it in the library for all programs to use. ATD consists of a set of definitions that allow programmers to use the functions while hiding the implementation.
Figure 12-8 Three representations of a stack Stack is a restricted linear list in which all additions and deletions are made at the end, called the top. Stack is known as last in, first out (LIFO) data structure. Examples stack of coins, books….
Figure 12-16 Representation of a tree nodes Indegree branch outdegree branch The sum of the indegree and outdegree branches is the degree of the node. The indegree of the root is zero by definition. All nodes in the tree must have indegree of one and different number of outdegree.
Figure 12-19 Binary tree Binary Tree is a tree in which no node can have more than two subtrees. In other word a node can have 0,1 or 2 subtrees. These subtrees are designated as left and right subtrees.
Graphs-Terminology A Graph is collection of nodes called vertices (single is vertex) and collection of line segments called lines connecting pairs of vertices. Graph could be directed (diagraph) or undirected. Arcs, Edges Adjacent vertices (neighbor) Path, Cycle, Loop. Strongly, weakly connected and disjoint graphs Degree, outdegree, indegree See book Dr Barnawi