/* ------------------------------------------------------------------------- */ // global variable declaration

struct tree // definition of a tree structure
{
struct tree *left; // pointer pointed to left child node
int data; // data value of current node
struct tree *right; // pointer pointed to right child node
};
typedef struct tree *btree; // declaration of a new type of tree structure

/* ------------------------------------------------------------------------- */ // declaration of prototype function that will be used in the following program bTree Insert_Node(bTree, int); // insert node of binary tree bTree Create_Btree(int *, int); // create binary tree

void Print_Btree(bTree ); // print a created binary tree

/* ------------------------------------------------------------------------- */ /* main program: input array element, set up a linked list type of binary */ /* tree and print the binary tree */
/* ------------------------------------------------------------------------- */ void main(void)
{
bTree root = NULL; // pointer of tree root node

int i,index; // variable for loop count and length of array
int value; // variable used to store input data temporarily
int nodeList[20]; // array to store input data

printf("\nPlease input the elements of binary tree (Exit for 0):\n"); index = 0;

/* --------------------------------------------------------------------- */ // read and reserve input data into array nodeList
scanf("%d",&value);
while(value != 0) // read 'til a '0' is input
{
nodeList[index] = value;
index++;
scanf("%d",&value);
}

/* --------------------------------------------------------------------- */ // create a binary tree using linked list
root = Create_Btree(nodeList,index);

// --------------------------------------------------------------------- */ // print the content of created binary tree above
Print_Btree(root);
}

...Objects), together.
The advantage of using a tree structure is due to it’s ability of holding continuous real-world data, which can be added and deleted at any time.
In other words, strictly for scientific purposes, trees are ideal manners of organizing data in a sequential, structured manner, and at the same time allowing for the structure to grow and shrink in real-time.
There are four required steps/procedures to be taken before the “tree” can work as an efficient representation of a certain data structure:
Step One: data must be “sorted” in a certain manner.
This means, that the data may be sorted in degree of polynomials, by the number of their significant figures (floating point calculations), in order of ascending or descending numerical value (from lowest to highest or reverse order), and other.
In computer science, a strict algorithm is used as a means of maintaining the efficiency of the data structure (i.e. if it contains continuous data or any form of decimal number set where “precision matters” we want the precision of the numbers to be kept as they are once they are sorted.
Therefore, the binary search is implemented.
Function of the binary search:
1)
Considering that the structure is already sorted (if not we need to do so)the goal of the binary search is to find a location within the “tree” called the key, and ensure, that there is...

...Ordered Dictionaries Binary Search Trees
<
2 1 6 9 4 = 8
Keys are assumed to come from a total order. New operations:
closestKeyBefore(k) closestElemBefore(k) closestKeyAfter(k) closestElemAfter(k)
1 Binary Search Trees 2
>
Binary Search Trees
Binary Search (§3.1.1)
Binary search performs operation findElement(k) on a dictionary implemented by means of an array-based sequence, sorted by key
similar to the high-low game at each step, the number of candidate items is halved terminates after O(log n) steps
Lookup Table (§3.1.1)
A lookup table is a dictionary implemented by means of a sorted sequence
We store the items of the dictionary in an array-based sequence, sorted by key We use an external comparator for the keys
Example: findElement(7)
0 1 1 1 1 3 3 4 4 4 5 5 5 7 7 8 9 9 9 9 11 11 11 11 14 14 14 14 16 16 16 16 18 18 18 18 3 19
Performance:
m
8 8 8
l
0
h
19 19 19
l
0 0
m
3 3
h
7
findElement takes O(log n) time, using binary search insertItem takes O(n) time since in the worst case we have to shift n/2 items to make room for the new item removeElement take O(n) time since in the worst case we have to shift n/2 items to compact the items after the removal
l
4
m
5
h
7
l=m =h
Binary Search Trees
The lookup table is effective only for dictionaries of small size or for dictionaries on which searches are the...

... Array Representation
A complete binarytree has a simple array representation. Suppose we number the nodes from left to right, beginning at the top and ending at the bottom. Then we can store the various data items in the corresponding elements of an array. For example
can be represented by the array
This in fact corresponds to the level order enumeration of the tree. Note that we only use an initial segment of the array. Provided the array is long enough, and we know the number of tree nodes, it doesn't matter how many unused components there are at the end.
* length[A]: the size of the array
* heap-size[A]: the number of items stored into the array A
* Note: heap-size[A] <= length[A]
* The root of the tree is at A[1], i.e., the indexing typically begins at index 1 (not 0). A[0] can be reserved for the variable heap-size[A].
Heap is implemented as an array, but its operations can be grasped more easily by looking at the binarytreerepresentation. The mapping between the array representation and binarytreerepresentation is unambiguous. The array representation can be achieved by traversing the binarytree in level order.
Figure 1: Binarytree and array...

...Path Complexity of the Class Binary Search Tree
Contents
Page No.
Abstract List of Symbols and Abbreviations List of Figures List of Tables
V VI VII VII
1. Introduction 1.1 1.2 General Organization of the Thesis
1 1 3 4 4 4 5 5 7 9 9 11 15 21 22 22 24 30 31
2. Preliminaries 2.1. 2.2. 2.3. Introduction Terminology and Notations Path complexity of a class
2.3.1. Introduction 2.3.2. The class Stack 3. Path complexity of the class BST 3.1. 3.2. 3.3. 3.4. State representation of BST Insert and delete operations on BST Path Complexity analysis of the class BST Bounds on path complexity of the class BST
4. Program for computing path complexity of the class BST 4.1. 4.2. Array representation of BinaryTree Program Listing
5. Conclusion References
IV
Abstract
Path complexity of a program is defined as the number of program execution paths as a function of input size n. This notion of program complexity has been extended to complexity of a class as follows. Class had data members and data operations. The notion of state for the class is defined based on structural representation of a class. We are assuming only those data operations that change state of a class. The path complexity of a class is defined to be the number of valid input sequences, each of them containing n data operations. We have analyzed the path complexity of the class...

...Red-Black Tree
Abstract--In this paper, Red-Black Tree is discussed and various operations that can be performed on it are illustrated. The operations include rotation/restructuring (Left-Rotation and Right-Rotation), inserting a node in Red-Black Tree and deleting a node from Red-Black Tree thereby maintaining its Red-Black Properties.
I. Introduction
A fascinating and important balanced binary searchtree is the red-black tree. Rudolf Bayer invented this important tree structure in 1972, about 10 years after the introduction of AVL trees. Bayer referred to his red-black trees as “symmetric binary B-trees.”
Red-black trees, as they are now known, like AVL trees, are “self-balancing”. Whenever a new object is inserted or deleted, the resulting tree continues to satisfy the conditions required to be a red-black tree. The computational complexity for insertion or deletion can be shown to be O (log N), similar to an AVL tree. The rules that define a red-black tree are interesting because they are less constrained than the rather strict rules associated with an AVL tree. Each node is assigned a color of red or black [1].
Insertion and deletion operations on red-black trees are more complex to describe or to code than the same operations on AVL trees. Red-black trees also...

...AVL Tree Definition AVL Trees
v
6 3 4 8
AVL trees are balanced. An AVL Tree is a
z
44 2 17 1 32
4 3 1
binary search tree
such that for every internal node v of T, the heights of the
78 2 50 1 48 62 1
88
children of v can differ by at most 1.
AVL Trees 1
An example of an AVL tree where the heights are shown next to the nodes:
AVL Trees 2
n(2)
3 4 n(1)
Height of an AVLTree
Insertion in an AVL Tree
Insertion is as in a binary search tree Always done by expanding an external node. Example: 44 44
17 78 17 a=y 32 50 88 32 50 88 78 c=z
Fact: The height of an AVL tree storing n keys is O(log n). Proof: Let us bound n(h): the minimum number of internal nodes of an AVL tree of height h. We easily see that n(1) = 1 and n(2) = 2 For n > 2, an AVL tree of height h contains the root node, one AVL subtree of height n-1 and another of height n-2. That is, n(h) = 1 + n(h-1) + n(h-2) Knowing n(h-1) > n(h-2), we get n(h) > 2n(h-2). So
n(h) > 2n(h-2), n(h) > 4n(h-4), n(h) > 8n(n-6), … (by induction), n(h) > 2in(h-2i)
48
62
48
62
b=x
Solving the base case we get: n(h) > 2 h/2-1 Taking logarithms: h < 2log n(h) +2 Thus the height of an AVL tree is O(log n)
AVL Trees 3
w
54
before insertion
AVL Trees
after insertion
4
Trinode...

...
Sustainable Competitive Advantage: Extending the Resource Based View
A body of literature has emerged which addresses the content of sustainable competitive advantage as well as its sources and different types of strategies that may be used to achieve it.
A firm is argued to have a competitive advantage when it is implementing a value creating strategy which a current or potential competitor is not implementing at the same time. Moreover, a firm is argued to have a sustained competitive advantage when it is implementing a value creating strategy which a current or potential competitor is not implementing at the same time and when these other firms are unable to duplicate the benefits of this strategy. However, in order for a resource to have the potential of being a sustained competitive advantage, it must contain the following four attributes: Firstly, it must be valuable, in the sense that it exploits opportunities and/or neutralizes threats in a firm’s environment, secondly, it must be rare among firm’s current and potential competition; thirdly, it must be imperfectly imitable and fourthly, there cannot be any strategically equivalent substitutes for this resource that are valuable but neither rare or imperfectly imitable.(Amit,2001)
The resource-based theory is based on the assumption that firms are fundamentally heterogeneous regarding their resources and internal competencies. This debates with the problem of how firms can exploit their...