Binary tree

4 stars based on 77 reviews

You must do the programming assignment by yourself. The file you submit should be an assembly language file called directory. You will design the user-interface of a university directory that associates each student with a student ID. Your program will prompt the user for a student ID and print the name of the student. We now discuss each step in turn. Prompting for a student ID: Your program will print on the screen the string "Type a student ID and press Enter: To simplify the program, we will assume that the university has no more than ten students so the student ID consists of a single decimal digit e.

You will find a match for the ID in the directory only if the ID exists in the directory. Note that it is possible to not find a match in the directory. The directory is organized as a data-structure called a binary search tree. The workings of the binary search tree is described below. The address of the first node the root of the directory is stored in memory location x before the program is run. Printing the student name: If your program finds a match in the directory, your program will print the name.

You will then print a line feed character ASCII code x0A to the console to bring the cursor to the next line in the console. The program will return to step 1 and prompt the user for another student ID Halting the machine: The Binary Search Tree In class, we learned about two different data structures for storing data in order: Like a linked list, a binary search tree consists of a set of nodes connected to each other via pointers.

However, unlike a linked list, each node in the binary search tree contains pointers to two other nodes in the binary search tree. We call x in this context a NULL pointer. For a given node, its descendants are all the nodes that are its children, or children of its children, or children of children of its children, and so forth.

Think of the way descendants and ancestors work in a family tree. Unlike a family tree, however, each node in a binary search tree only has one parent, and each node has at most two children. A binary search tree wherein each node has a unique identifier has the following special property: The value of the left child of a node is less than the value of the node, and the value of the right child of a node is greater than the value of the node. Furthermore, cycles are not permitted in a binary search tree.

That is, a node cannot be both the descendant and ancestor of another node. Equivalently, this means if you start from any node in the tree and keep following pointers, you will eventually reach a node with no children. The following images show two examples of binary search trees. Note that, for a given set of values, there is not a unique binary search tree, as both examples below are valid binary search trees for the same set of values.

The particular tree used depends on how it is created. Luckily, you do not have to worry about creating a binary search tree in this program. You are simply searching for a value in it. In our particular example of a binary search tree representing a directory of student nameseach node consists of four words in the following order: The pointer to the left child.

The pointer to the right child. The string is null-terminated, i. Below we show an example directory implemented as a binary search tree. This directory contains four nodes: The node containing the student with ID 6 is at the root of the tree. To search the binary search tree, your program will visit the first node the root of the tree and compare the student ID at that node with the ID entered by the user.

It will continue to visit nodes until either a match is found or it reaches a node with no appropriate child e. This implies that a match was not found. You should adhere to these guidelines to receive full credit for this assignment.

Your program should prompt the user for the student ID from the keyboard, as follows: Print a string "Type a student ID and press Enter: The prompt should always begin on a new line on the console. You need to find a way to convert the decimal digit received from the keyboard from its ASCII value e. For each student the user looks up, your program should output one of two strings depending on the outcome of the directory lookup. When the student ID entered by the user is found in the binary search tree, output to the screen the name as recorded in the directory, followed by a line feed character ASCII code x0A.

When the student ID entered by the user is not found in the binary search tree, output to the screen: When the user has no more students to look up and enters 'd' as the student ID, you should halt the machine. When program halts, the TRAP x25 service routine will print a line feed character to the console, followed by the message " Halting the processor ". Shown below is a sample of what output your program will produce when the user looks up students on the example directory provided.

You should verify that your program matches this output exactly. Pay special attention to the capitalization of letters.

Type a student ID and press Enter: Binary tree stored in the memory shown on the left.

How to read binary options signals howwetrade

  • 60 second binary option trading systems

    Binary options app referral code

  • Best intraday trading books india

    Preferred binary options reviews preferred binary options review indicador obv forex daily forex con

Vietnam airlines optiontown price

  • Soyez le premier a commenter l article binary options chart strategies quotes

    Binaryoptions 0 1 net

  • Auto binary signals results of summerslam

    Ig markets binary option

  • First trading online stock brokerage accounts for beginners

    Forex schule pdf

V k ramasamy trading options

25 comments Rainbow trading corporation

Binary systems private limited mangalore karnataka

AIMDek Technologies Private Limited Aimee Taylor AIMING GLOBAL SERVICE, INC. AIONAV Systems AG brokers zeng aiping zheng aiquan yang Air Conditioning Contractors of America Air Job Pty Ltd Air Liquide Air Mas Perkasa Air Stylist LTD AiRango airatel Inc. AIRESPACES, LLC Airlapp AIRMED PATHOLOGY PRIVATE Geraldton AirMenu airmud playcrab Airpac S. Airpoint Technologies Company Limited AirService Airservices Australia Airship, LLC Airtight Mobile Brokers Residential SAS Airwire products.

Aissam Hafidi AISSAM KHIRI Aitor Fernandez Aitor Landa Aitzaz Khalid AIUEO-KAN Aivars Francis Aixing Ma AixMobil Aiyidi Abuduweili AJA SOFTTECH AND CONSULTANCY AJA.