Chapter 19 Data Structures 1125 destination. The routing (Jetty web server)
Chapter 19 Data Structures 1125 destination. The routing node routes one packet at a time, so additional packets are enqueued until the router can route them. A file server in a computer network handles file-access requests from many clients throughout the network. Servers have a limited capacity to service requests from clients. When that capacity is exceeded, client requests wait in queues. A tree is a nonlinear, two-dimensional data structure. Tree nodes contain two or more links. A binary tree is a tree whose nodes all contain two links. The root node is the first node in a tree. Each link in the root node refers to a child. The left child is the first node in the left subtree, and the right child is the first node in the right subtree. The children of a node are called siblings. A node with no children is called a leaf node. Computer scientists normally draw trees from the root node down. A binary search tree (with no duplicate node values) has the characteristic that the values in any left subtree are less than the value in its parent node, and the values in any right subtree are greater than the value in its parent node. A node can be inserted only as a leaf node in a binary search tree. An inorder traversal of a binary search tree processes the node values in ascending order. The process of creating a binary search tree actually sorts the data and thus this process is called the binary tree sort. In a preorder traversal, the value in each node is processed as the node is visited. After the value in a given node is processed, the values in the left subtree are processed, then the values in the right subtree are processed. In a postorder traversal, the value in each node is processed after the values of its children. The binary search tree facilitates duplicate elimination. As the tree is created, attempts to insert a duplicate value are recognized because a duplicate follows the same go left or go right decisions on each comparison as the original value did. Thus, the duplicate eventually is compared with a node containing the same value. The duplicate value could simply be discarded at this point. Searching a binary tree for a value that matches a key value is also fast, especially for tightly packed trees. In a tightly packed tree, each level contains about twice as many elements as the previous level. So a binary search tree with n elements has a minimum of log2n levels, and thus at most log2n, comparisons would have to be made either to find a match or to determine that no match exists. Searching a (tightly packed) 1000-element binary search tree requires at most 10 comparisons, because 210 > 1000. Searching a (tightly packed) 1,000,000-element binary search tree requires at most 20 comparisons, because 220 > 1,000,000. TERMINOLOGY binary search tree enqueue binary tree FIFO (first-in, first-out) binary tree sort head of a queue child node inorder traversal of a binary tree children inserting a node delegating leaf node deleting a node left child dequeue left subtree duplicate elimination level-order traversal of a binary tree dynamic data structures LIFO (last-in, first-out)
In case you need quality webspace to host and run your web applications, try our personal web hosting services.