Questions
Data structure Give three distinct binary search trees for the following data:   1 2 3 4...

Data structure

  1. Give three distinct binary search trees for the following data:   1 2 3 4 5 6 7. One of these trees must have minimum height and another must-have maximum height.
  2. Draw the BSTs that result from each sequence of add operations. (2) a. 10, 20, 30, 40 b. 30, 20, 40, 10 c. 20, 10, 30, 40

In: Computer Science

Background For this exercise, you will write an Appointment class that tracks information about an appointment...

Background For this exercise, you will write an Appointment class that tracks information about an appointment such as the start and end times and a name for the appointment. Your Appointment class will also have an overlaps() method that takes another Appointment object as an argument and determines whether the two appointments overlap in python.

Instructions

Write a class called Appointment with methods as described below:

__init__() method Define an __init__() method with four parameters: self name, a string indicating the name of the appointment (for example, "Sales brunch"). start, a tuple consisting of two integers representing the start time of the appointment. The first integer represents an hour in 24-hour time; the second integer represents a number of minutes. For example, the tuple (10, 30) would represent 10:30 am. end, a tuple similar to start representing the end time of the appointment. The __init__() method should create attributes name, start, and end, and use them to store the information from the parameters.

overlaps() method Define an overlaps() method with two parameters, self and other, where other is another Appointment object. This method should return True if self and other overlap and False if they do not. Be sure to return a boolean value rather than a string. Note that two appointments overlap if the start time of one appointment occurs between the start and end times of the other appointment (including if the start times are equal), OR the end time of one appointment occurs between the start and end times of the other appointment (including if the end times are equal) For this assignment, if the start time of one appointment is equal to the end time of the other appointment, the two appointments are not considered to overlap. Hints Assuming you have two values a and c such that a is less than c, you can determine if a third value b is between a (inclusive) and c (exclusive) with an expression like this: a <= b < c When Python compares two sequences (such as tuples), it compares each item in the first sequence to the corresponding item in the second sequence until it finds a difference. For example, given the expression (10, 4, 12) < (10, 5, 1), Python first compares 10 to 10. Because they are the same, Python then compares 4 to 5. Because 4 is smaller than 5, Python stops comparing and the expression evaluates to True: (10, 4, 12) is considered less than (10, 5, 1) in Python. A boolean expression such as a <= b < c evaluates to True or False. You don’t need to put it inside a conditional statement to return a boolean value. In other words, instead of this: if a <= b < c: return True else: return False you can do this: return a <= b < c

Docstrings Write a docstring for your class that documents the purpose of the class as well as the purpose and expected data type of each attribute. For each of the methods you wrote, write a docstring that documents the purpose of the method as well as the purpose and expected data type of each parameter other than self (you never need to document self in a docstring). If your document returns a value, document that. If your document has side effects, such as modifying attributes or writing to standard output, document those as well. Be sure your docstrings are the first statement in the class or method they document. Improperly positioned docstrings are not recognized as docstrings by Python.

Using your class You can use your class by importing your module into another script. Below is an example of such a script; it assumes the Appointment class is defined in a script called appointment.py which is located in the same directory as this script. use_appointment.py from appointment import Appointment def main(): """ Demonstrate use of the Appointment class. """ appt1 = Appointment("Physics meeting", (9, 30), (10, 45)) appt2 = Appointment("Brunch", (10, 30), (11, 00)) appt3 = Appointment("English study session", (13, 00), (14, 00)) if appt1.overlaps(appt2): print(f"{appt1.name} overlaps with {appt2.name}") else: print(f"{appt1.name} does not overlap with {appt2.name}") if appt1.overlaps(appt3): print(f"{appt1.name} overlaps with {appt3.name}") else: print(f"{appt1.name} does not overlap with {appt3.name}") assert appt1.overlaps(appt2) assert appt2.overlaps(appt1) assert not appt1.overlaps(appt3) assert not appt3.overlaps(appt1) assert not appt2.overlaps(appt3) assert not appt3.overlaps(appt2) if __name__ == "__main__": main()

In: Computer Science

**** Using C Sharp **** ***If possible please include screenshot of output *** **Also, if possible,...

**** Using C Sharp ****

***If possible please include screenshot of output ***

**Also, if possible, please provide info from .txt files created**

You are to write a program which is going to use inheritance. It should start off with the base classes

Account: contains the string name, int accountnumber, double balance.

Savings: Derived from Account class, it should contain double interest rate.

Checkings: Derived from Account class, it should contain double overdraftlimit.

CreditCard: Derived from Checkings class, it should contain int cardnumber.

Create a program which will create an array of 3 Savings accounts, 3 Checkings accounts and 3 CreditCards.
Create 3 files. Savings.txt, Checkings.txt, CreditCards.txt which contains the information for each and infile the information from the file to the array of the classes. *You can come up with own information*

As for the Main, you will get the data from the file to populate the 3 arrays. Then you should simply do a display of all 3 savings, checkings and creditcards in a neat fashion.

In: Computer Science

what is etl?( extract tranform and load basics. what are etl manual processes? discuss stagung and...

what is etl?( extract tranform and load basics.
what are etl manual processes?
discuss stagung and configuration of ataging area.
Also explain about how mapping and operators work in OWB

In: Computer Science

Create a C structure which stores information about a book. Each book should have the following...

Create a C structure which stores information about a book. Each book should have the following data: Author (string), Title (string), Publisher (string), Year (int), ISBN (int), Genre (string), Price (float). Write a C program which creates an array of 100 of these structures, then prompts the user to enter book information to fill the array. The data entry should stop when the array is full, or when the user enters 0 for the ISBN.

In: Computer Science

Wireless Medical Sensor Network (WMSN) What a computer network is and what is the importance of...

Wireless Medical Sensor Network (WMSN)
What a computer network is and what is the importance of the computer network to this topic (Wireless Medical Sensor Network)?.  

Explain how a Wireless Medical Sensor Network (WMSN) differs from a Wireless Sensor Network (WSN). What kind of devices does it consist of? What kind of data do the devices collect? Please include information about authentication, user friendliness and user anonymity.

In: Computer Science

Write a C program that repeatedly prompts the user for input at a simple prompt (see...

Write a C program that repeatedly prompts the user for input at a simple prompt (see the sample output below for details). Your program should parse the input and provide output that describes the input specified. To best explain, here's some sample output:

ibrahim@ibrahim-latech:~$ ./prog1

$ ls -a -l -h

Line read: ls -a -l -h

Token(s):

ls

-a

-l

-h

4 token(s) read

$ ls -alh

Line read: ls -alh

Token(s):

ls

-a

-l

-h

2 token(s) read

$ clear

Line read: clear

Token(s):

clear

1 token(s) read

$ exit ibrahim@ibrahim-latech:~$

Note that the first and last lines are not part of program output (i.e., they are of the terminal session launching the program and after its exit). The program prompts the user (with a simple prompt containing just a $ followed by a space) and accepts user input until the command exit is provided, at which point it exits the program and returns to the terminal. For all other user input, it first outputs the string Line read: followed by the user input provided (on the same line). On the next line, it outputs the string Token(s):. This is followed by a list of the tokens in the input provided, each placed on a separate line and indented by a single space. For our purposes, a token is any string in the user input that is delimited by a space (i.e., basically a word). The string n token(s) read is then outputted on the next line (of course, n is replaced with the actual number of tokens read). Finally, a blank line is outputted before prompting for user input again. The process repeats until the command exit is provided. Hints: (1) An array of 256 characters for the user input should suffice (2) To get user input, fgets is your friend (3) To compare user input, strcmp is your friend (4) To tokenize user input, strtok is your friend Turn in your .c source file only that is compilable as follows (filename doesn't matter): gcc -o prog1 prog1.c Make sure to comment your source code appropriately, and to include a header providing your name.

In: Computer Science

In C++, dealing with Binary Search trees. Implement search, insert, removeLeaf, and removeNodeWithOneChild methods in BST.h....

In C++, dealing with Binary Search trees. Implement search, insert, removeLeaf, and removeNodeWithOneChild methods in BST.h. BST.h code below

#include <iostream>
#include "BSTNode.h"
using namespace std;

#ifndef BST_H_
#define BST_H_

class BST {

public:

        BSTNode *root;
        int size;

        BST() {
                root = NULL;
                size = 0;
        }

        ~BST() {
                if (root != NULL)
                        deepClean(root);
        }

        BSTNode *search(int key) { // complete this method
        }

        BSTNode *insert(int val) { // complete this method
        }

        bool remove(int val) { // complete this method
        }

private:

        void removeLeaf(BSTNode *leaf) { // complete this method
        }

        void removeNodeWithOneChild(BSTNode *node) { // complete this method
        }

        static BSTNode *findMin(BSTNode *node) {
                if (NULL == node)
                        return NULL;
                while (node->left != NULL) {
                        node = node->left;
                }
                return node;
        }

        static BSTNode *findMax(BSTNode *node) {
                if (NULL == node)
                        return NULL;
                while (node->right != NULL) {
                        node = node->right;
                }
                return node;
        }

        void print(BSTNode *node) {
                if (NULL != node) {
                        node->toString();
                        cout << " ";
                        print(node->left);
                        print(node->right);
                }
        }

        static int getHeight(BSTNode *node) {
                if (node == NULL)
                        return 0;
                else
                        return 1 + max(getHeight(node->left), getHeight(node->right));
        }
    
    static void deepClean(BSTNode *node) {
        if (node->left != NULL)
            deepClean(node->left);
        if (node->right != NULL)
            deepClean(node->right);
        delete node;
    }

public:

        int getTreeHeight() {
                return getHeight(root);
        }

        void print() {
                print(root);
        }

        int getSize() {
                return size;
        }
};

#endif

This is the expected output

****************** Test BST Correctness ******************
Inserting the following numbers: [11, 12, 15, 17, 12, 19, 4, 5, 11, 19, 20, 32, 77, 65, 66, 88, 99, 10, 8, 19,
15, 66, 11, 19]
*** BST Structure (after insertion) ***
<11, null> <4, 11> <5, 4> <10, 5> <8, 10> <12, 11> <15, 12> <17, 15> <19, 17> <20, 19> <32, 20> <77,
32> <65, 77> <66, 65> <88, 77> <99, 88>
Size of BST: 16
*** Searching BST ***
Found: [19, 12, 4, 5, 19, 20, 32, 99, 8, 12]
Did not find: [29, 3, 27, 34, 45, 37, 25, 25, 24, 16]
*** Deleting BST ***
Deleted: [12, 15, 5, 17, 19, 4, 20, 32, 99, 10, 8]
Did not find: [16, 5, 19, 17, 19, 39, 19, 15, 21]
*** BST Structure (after deletion) ***
<11, null> <77, 11> <65, 77> <66, 65> <88, 77>
Size of BST: 5
****************** Clean up ******************
Size of hash table: 0
Size of BST: 0

In: Computer Science

Suppose you have the following list of integers to sort: [1, 5, 4, 2, 18, 19]...

Suppose you have the following list of integers to sort:

[1, 5, 4, 2, 18, 19]

which list represents the partially sorted list after three complete passes of insertion sort?

1 2 4 5 18 19

1 4 5 2 18 19

1 4 2 5 18 19

None of the above

In: Computer Science

How does S/4HANAempower digital supply chain? Provide some examples on how this system is benefiting organisations...

How does S/4HANAempower digital supply chain? Provide some examples on how this system is benefiting organisations to compete?

In: Computer Science

Apply the different components of systems thinking on the zillow business scenario. In other words, the...

Apply the different components of systems thinking on the zillow business scenario. In other words, the different components of Zillow as system, the input, the output, and the different feedbacks.

In: Computer Science

C++ please You have been challenged with a menu program before, but this one is a...

C++ please

You have been challenged with a menu program before, but this one is a little more complex. You will use loops and you will use an output file for a receipt.

Using class notes, write an algorithm for a program which uses a loop system to allow customers to select items for purchase from a list on the screen. (List at least 8 items to choose from on your menu. You choose the items to be listed.).

When the user is finished choosing items, display the amount due and then accept the customer's payment. If the customer pays enough, display change due on the screen.

If the customer does not pay enough, use another loop system to get additional payment from the customer until the total due has been paid. When finished, have an output file that lists all items purchased along with prices, the subtotal, the tax amount, the grand total and total paid.

In: Computer Science

Written informative speech on artificial intelligence. Introduction only: attention getter, background, credibility, behavioral objective and thesis...

Written informative speech on artificial intelligence.
Introduction only:
attention getter, background, credibility, behavioral objective and thesis statement.
Cite sources if any are used.

In: Computer Science

Write a python code using a continuous random variable and using uniform distribution to output the...

Write a python code using a continuous random variable and using uniform distribution to output the expected weight of students in a class.

In: Computer Science

Construct a finite-state machine, using combinational logic, which reads in one bit at a time. When...

  1. Construct a finite-state machine, using combinational logic, which reads in one bit at a time. When a nibble (4 bits) are all zeros the output is set to one else the output is zero. The machine continues to read in bits and the output remains a one if zeros are read in. If it reads a one the output is a zero.
    1. What are the machine states?
    2. What are the inputs?
    3. What are the outputs?
    4. Draw state table.
    5. Draw the state diagram.
    6. Define the circuit for the next state and the output with the Boolean equations.
    7. Explain if you built a Mealy or Moore machine.

In: Computer Science