Questions
True False The enqueue and dequeue operations in a priority queue take O(lg n) time, while...

True False

The enqueue and dequeue operations in a priority queue take O(lg n) time, while linked list and array implementations take O(1) time.

A binary heap is a (nearly) complete binary tree.

Heaps usually use a linked node structure for implementation.

When implementing heaps as arrays, you can leave a blank space at the front. If you do, the parent of a node at index i can be found at index floor(i/2).

When implementing heaps as arrays, if you don't leave a space at the front, you can find the children of the node at index i at 2i and 2i+1.

The heap order property states that each node must contain a value greater than its left child and less than its right child.

Insertion in a heap is done by adding at the end of the array and "percolating up".

The average case for insertion in a heap is O(lg n). The worst case is O(n).

Deletion in a heap requires removing the root item and shifting all other items over one space.

Building a heap by adding values one at a time is an O(n) operation. Building a heap "all at once" with the heapify() method (called buildHeap() in the textbook) is O(n lg n).

In: Computer Science

I need to implement a code in python to guess a random number. The number must...

I need to implement a code in python to guess a random number. The number
must be an integer between 1 and 50 inclusive, using the module random function randint. The user will have four options to guess the number. For each one of the failed attempts, the program
it should let the user know whether is with a lower or higher number and how many tries they have left. If the user guess the number, the program must congratulate the user and tell him how much he won. If you are a user, hit on the 1st attempt
He wins first $ 100, on the second $ 75, on the third $ 50, on the fourth $ 25. If the user misses all four opportunities, the program must inform the user that he owes money  $ 60 and what was the number that the computer generates randomly.

In: Computer Science

Explain the diagram of Computer System which includes (Hardware, OS, application program and users).

Explain the diagram of Computer System which includes (Hardware, OS, application program and users).

In: Computer Science

create an array with a bunch of animal

create an array with a bunch of animal

In: Computer Science

The five major activities of an operating system in regard to process management are?

The five major activities of an operating system in regard to process management are?

In: Computer Science

You have decided to enter a South African Innovative App Competition. The competition requires you (and...

You have decided to enter a South African Innovative App Competition. The competition requires you (and your team) to think of an innovative idea that could lead to the development of an App aimed at assisting and benefiting South African citizens in government services

Some fundamental assumptions and project requirements:
• Preferably, the system approach/project information system approach is to be followed;
• Budget is limited to R500 000;
• A minimum of five team members must be involved in the running of the project from start
to finish. You are expected to conduct your own research regarding the product, project
team selection and developing a project schedule and management;
• Project duration must not exceed 10 months;
• Additional assumptions and requirements must be adequately added.

This question may be completed using any suitable application software, including Microsoft Word.

Create a Project Activity List for your chosen project using the following format. The Activity List should include but is not limited to the following information:

Task | Task Name | Duration | Start Time | Finish Time | Predecessors | Budget Number

The solution should include the following tasks:
 An activity list of no less than 40 activities for the chosen project;
 Identify all activities:
o Number each task;
o Name each task;
o Provide the duration of each task;
o Schedule, and sequence project accordingly;
 Use phases, summary tasks, deliverables, and work packages;
 Use at least (minimum) of four team members as resources;
 Use at least (minimum) of six milestones;
 Estimate the cost of each task;
 Project summary;
 Show the total cost (budget) of the project.

PROJECT ACTIVITY LIST
Activity list +/‐ 40 activities for the chosen project; Duration of each of the identified activities;
Scheduling (including resources) of each of the identified activities;
Sequencing (including numbering, predecessors, etc.) of each of the identified activities;
Use phases, summary tasks and deliverables;
Use at least (minimum) of four (4) team members;
Use at least (minimum) of six (6) milestones;
Budget of the project

In: Computer Science

def main(): phrase = input('Enter a phrase: ') # take a phrase from user acronym =...

def main():
phrase = input('Enter a phrase: ') # take a phrase from user
acronym = '' # initialize empty acronym
for word in phrase.split(): # for each word in phrase
acronym += word[0].upper() # add uppercase version of first letter to acronym
print('Acronym for ' + phrase + ' is ' + acronym) # print results

main()

The program should then open the input file, treat whatever is on each line as a phrase and make its acronym using the function you wrote. It should print the acronyms, one per line to the output file. Assume that the input file will be already present in your default Python folder. The output file will be expected to get saved to the same folder. See below for an example input file input.txt and its corresponding output file output.txt that the program should generate.

Input: personal computer

Output:PC

In: Computer Science

Write a Java program to do the following USING ARRAYS 1) input 15 integers (input validation,...

Write a Java program to do the following USING ARRAYS

1) input 15 integers (input validation, all numbers must be between 0 and 100)

2) find the largest number.

3) Find the Smallest Number

4) Find the Sum of all numbers in the Array

Display:

Largest Number

Smallest Number

Sum of all numbers

the original Array

DO NOT USE METHODS OR FUNCTIONS

In: Computer Science

USE C++ for the program and kindly keep it as simple as possible , use recursion...

USE C++ for the program and kindly keep it as simple as possible , use recursion and do not use loops please keep program simple and comment if possible

Suppose you have been given the task to design a text editor which will take any
multiline text from user and then display the statistics like total number of characters i.e.,
characters_count (excluding the white space and punctuations), words_count, and

redundant_words_count. Create a structure named Text_Editor having four type members
namely inserted_text (of type string), characters_count (of type unsigned int),
words_count (of type unsigned int), and redundant_words_count (of type unsigned int).
The structure should also have member functions namely Insert_Text( ) for obtaining the
multiline text from user and assigning to input_text member-variable. End of text insertion
should be specified by ‘#’ character. Moreover, there should be a separate member-function
of the created structure named Count_Ch( ), Count_Words( ), and
Count_Redundant_Words( ) that should process the input text in order to calculate and
print the relevant statistics. All these different tasks are to be implemented using recursion
technique.

In: Computer Science

Lab 1 – Numbers in Descending Order Design an application that accepts 10 numbers and displays...

Lab 1 – Numbers in Descending Order

Design an application that accepts 10 numbers and displays them in descending order

For the programming problem, create the pseudocode and enter it below.

Enter pseudocode here

In: Computer Science

Please no plagiarism and must be in your own words. (4 pages minimum) Case: You run...

Please no plagiarism and must be in your own words. (4 pages minimum)

Case: You run cybersecurity operations for the for a healthcare emergency response logistics firm with global contracts with contracts with the United States and the Canadian government. COVID-19 had caused your organization to move to telework.

Write an overview of 3-4 pages introduction paper explaining what is currently happening. the paper should address the following questions:

  1. What is the impact of COVID 19 on organizations?
  2. What are some key statistics about COVID 19 costs to organizations?
  3. What are the staffing and employee safety issues related to COVID 19?
  4. What are organizational responses to COVID 19 (Telework, Social Distancing, etc.)?

In: Computer Science

Describe the fundamental differences between “White Hat, Black Hat, and Grey Hat” Hackers. What do all...

Describe the fundamental differences between “White Hat, Black Hat, and Grey Hat” Hackers. What do all these different types of hackers have in common? What positive and negative consequences could their actions have? Include a question that responding students can reply to within your initial post.

In: Computer Science

Create a for which will have the following controls. 1. Label for First Name and TextBox...

Create a for which will have the following controls.

1. Label for First Name and TextBox for the First Name

2. Label for Last Name and TextBox for the Last Name

3. Label for bank account balance and TextBox for the bank account balance (assume $1000 in the bank account)

4. Create a button Name. The user will click the button and the first name and last name will be displayed on the label. You will create a label called lblFirstLastName to display the First and last Name.

5. Create a button bankbalance. The user will click the button and the balance will be displayed on the label. You will create a label called lblBankbalance to display the bank balance.

6. Create a Cancel button to cancel the form

------------------------------------------------------------------------------------------------

package swing;
import javax.swing.*;
public class SwingInheritance extends JFrame
{
   private static final long serialVersionUID = 1L;
   SwingInheritance()
   {
       JTextField userName = new JTextField();
       //userName.setBounds(x, y, width, height);
       userName.setBounds(80,100,100, 40);
       userName.setText("Hello");
       JLabel lblText = new JLabel();
       lblText.setBounds(80,150,300, 40);
       lblText.setText("You Entered: " + userName.getText());
       JButton button=new JButton("click");
       //create button
       button.setBounds(80,200,100, 40);
       JButton close = new JButton("Close");
       close.setBounds(80,250,100, 40);
       close.addActionListener(e ->
       {
           dispose();
       });
       //add to JFrame
       add(button);
       add(close);
       add(userName);
       add(lblText);
       //set frame properties
       setSize(400,500);
       setLayout(null);
       setVisible(true);
       }
   public static void main(String[] args)
   {
       new SwingInheritance();
   }
}

In: Computer Science

Write a full MIPS assembly code for: Function Compare(int A[][], int B[][], int M, int N,...

Write a full MIPS assembly code for: Function Compare(int A[][], int B[][], int M, int N, int i, int j, int k, int l). This function compares the elements of the array A placed between (i,j) and (k,l) with the corresponding elements of the array B placed between the same indexes. The function returns the number of elements of both matrices that coincide in the same position (c,d). That is, it is necessary to check each element A[c,d] with the element B[c,d], with (c,d) inside the corresponding indexes to (i,j) and (k,l), both included. The function accepts 8 arguments:

A: starting address of an integer matrix of MxN dimension.

B: starting address of an integer matrix of dimension MxN.

M: number of rows of the A and B matrix.

N: number of columns of the A and B matrix.

i: an integer corresponding to the row of the first element of the matrix to be considered.

j: a whole number corresponding to the column of the first element of the matrix to be considered. o

k: a whole number corresponding to the row of the last element of the matrix to be considered.

l: a whole number corresponding to the column of the last element of the matrix to be considered.

The function returns two values. In case of error, it simply returns a result with value -1. The possible errors are: o M or N are negative or zero. o The indexes passed as arguments (i,j,k, and l) are out of range. o The element (k,l) is previous in the matrix to the element (i,j). It will not be considered an error if (i,j) and (k,l) have the same value and refer to the same element. If no error is detected, the function returns as a first result the value 0 and as second the number of elements that coincide in the same position in the arrays A and B.

In: Computer Science

a)     Write a program that reads a list of integers, and outputs all even integers in the...

a)     Write a program that reads a list of integers, and outputs all even integers in the list. For example, if the input list is [1, 2, 13, 14, 25], the output list should be [2, 14].

b)    Based on your code for part (a), write a program that reads a list of integers, and reports True if all numbers in the list are even, and False otherwise. Example: For input [1, 2, 13, 14, 25], the output should be False.

Your program must define and call the following two functions.

evens() returns all even integers in the list are even.

all_even() returns True if all integers in the list are even and false otherwise.

Your code could look like this

#Your name here

def evens(thelist):
#your code goes here



def all_even(thelist):
#your code goes here



evens([1, 2, 13, 14, 25]) #should return [2,14]
all_even([1, 2, 13, 14, 25]) #should return False

In: Computer Science