Binary Tree

part 1

create a sample database with one table. Your deliverable should be a Word document with screenshots showing the sample database and table you have created, and discuss the issues that you had for this project related to SQL Server and how you solved them.

. It should contain all of these elements:  a Title page,  an introductory paragraph that describes the purpose in objective of the assignment,  brief narrative writing in the body of the paper that describes your processes for creating the database and the table (how did you create these? Code? Management Studio Interface? See “.  neatly formatted and labeled screenshots that are described in the paper, and references (in-text citations in the body of the paper and the full reference in the reference list.

Part 2

Problem

Use a multidimensional list to store information about individuals who have donated to a charity.

The program will demonstrate the following:

  • How to create a multidimensional list;
  • How to enter and change data in a list;
  • How to access and use data in a multidimensional list.

Solving the Problem

Step 1

The first step in storing data in a program is to decide how you will store the data. Lists are one of the most basic data structures and will be used often in programs. However, when storing multiple pieces of information about something, using separate lists for each data item can be confusing. As an alternative, you can use a multidimensional list with each column of the array as a data category and each row representing a record, like a relational database. The first step is to create the lists.

Step 2

With the multidimensional list created, you now have to start putting the data into the data structure. Each location in a multidimensional list is represented by two indices, [][]. To add the data from the user, ask for the data and store them in the list using the append method.

Step 3

To change a value that is already entered into the array, access it using the two indices of the location, and set the value as you would any variable.

Step 4

The purpose for using lists is to make processing data much easier than individually accessing each item. Loops are the preferred method for accessing and processing lists of data.

part 3

Problem

Write a program that keeps track of where cars are located in a parking garage to estimate the time to retrieve a car when the garage is full.

This program will demonstrate the following:

  • How to create a list for use as a stack,
  • How to enter and change data in a stack.

Solving the Problem

Step 1

In Python, the stack data structure is actually implemented using the list data structure with a few additional functions. These functions come as part of the list structure, so it is really more about how to access the list to make it function like a stack rather than it actually being a different data structure from the list.

Step 2

To add cars to the stack, use the append method of the list structure like you would with any normal list.

Step 3

To find how long it will take to retrieve a certain car, you will have to use the pop() function of the list until you find the required vehicle in the garage stack and count the number of vehicles.

Step 4

Once the number of cars in front of the vehicle are found, the time taken to retrieve the car can be calculated based on the average time it takes to move a vehicle plus the time to retrieve the car.

Step 5

Finally, the estimated time to retrieve the vehicle can be output to the user to inform the car owner.

Documentation Guidelines:

Use good programming style (e.g., indentation for readability) and document each of your program parts with the following items (the items shown between the ‘<‘ and ‘>’ angle brackets are only placeholders. You should replace the placeholders and the comments between them with your specific information). Your cover sheet should have some of the same information, but what follows should be at the top of each program’s sheet of source code. Some lines of code should have an explanation of what is to be accomplished, this will allow someone supporting your code years later to comprehend your purpose. Be brief and to the point. Start your design by writing comment lines of pseudocode. Once that is complete, begin adding executable lines. Finally run and test your program.

Deliverable(s):

Your deliverable should be a Word document with screenshots showing the source code and running results, and discuss the issues that you had for this project related to AWS and/or Python IDE and how you solved them for all of the programs listed above as well as the inputs and outputs from running them. Submit a cover sheet with the hardcopy of your work.

part 4

Problem

You need to organize guests at a wedding based on last name, and you need to balance the room as well as possible as they arrive.

This program will demonstrate the following:

  • How to create a binary tree,
  • How to use a tree to organize data.

Solving the Problem

Step 1

To create a tree structure in Python, a class must be created to represent nodes in the tree. The initial node, called the root, will act as the pivotal point in the tree, and each new node added will be added to the left or right of the tree based on the value held in that node.

Step 2

You can now create the root node and give it an initial value to sort the guests on. Guests with names that start with letters less than this will be sorted to the left, and those with first letters that are greater will be sorted to the right.

Step 3

The easiest way to manipulate tree structures is with recursive functions. You will need to create a recursive function to add nodes to the tree based on the first letter of the guest’s name. The function will take in the root node and the guest to be added. It then traverses the tree, making comparisons and adding a new guest. If there is no node found, a new one is created. If there is a node found, then the function recurses further down into the tree until an empty node is found. If the names are the same, then the guest is added to the existing node’s data member.

Step 4

You can now add items to the tree, and they will be sorted to the left and right based on the value of the name given.

Step 5

To print the tree, another recursive function needs to be created to traverse the tree. In this code, a node is entered into the function, and the data are printed for that node if it is not null. The left and right nodes of the current node are then passed to the recursive call.

Step 6

You can now print either the entire tree or each side of the tree. In this case, you will print out each side separately.

Documentation Guidelines:

Use good programming style (e.g., indentation for readability) and document each of your program parts with the following items (the items shown between the ‘<‘ and ‘>’ angle brackets are only placeholders. You should replace the placeholders and the comments between them with your specific information). Your cover sheet should have some of the same information, but what follows should be at the top of each program’s sheet of source code. Some lines of code should have an explanation of what is to be accomplished, this will allow someone supporting your code years later to comprehend your purpose. Be brief and to the point. Start your design by writing comment lines of pseudocode. Once that is complete, begin adding executable lines. Finally run and test your program.

Deliverable(s):

Your deliverable should be a Word document with screenshots showing the source code and running results, and discuss the issues that you had for this project related to AWS and/or Python IDE and how you solved them for all of the programs listed above as well as the inputs and outputs from running them. Submit a cover sheet with the hardcopy of your work.

Need help with this assignment or a similar one? Place your order and leave the rest to our experts!

Quality Assured!

Always on Time

Done from Scratch.