Questions
Write a Python program containing a function named scrabble_sort that will sort a list of strings...

Write a Python program containing a function named scrabble_sort that will sort a list of strings according to the length of the string, so that shortest strings appear at the front of the list. Words that have the same number of letters should be arranged in alphabetical order. Write your own logic for the sort function (you may want to start from some of the existing sorting code we studied). Do NOT use the built-in sort function provided by Python.

One optional way to test your function is to create a list of random words by using the RandomList function in PythonLabs and passing 'words' as an argument. For example:

>>> from PythonLabs.RecursionLab import *

>>> a = RandomList(20, 'words')
>>> scrabble_sort(a)
>>> print(a)

['mum', 'gawk', 'tree', 'forgo', 'caring', ... 'unquestioned']

Note: you do not need to include the above test case in your solution, but be sure to include at least 2 test cases to verify your scrabble_sort function works.

In PyCharm

In: Computer Science

For this problem you must write the functions in a recursive manner (i.e. the function must...

For this problem you must write the functions in a recursive manner (i.e. the function must call itself) – it is not acceptable to submit an iterative solution to these problems.

A. Complete the recursive function gcd(m, n) that calculate the greatest common denominator of two numbers with the following rules:

# If m = n, it returns n

# If m < n, it returns gcd(m, n-m)

# If m > n, it returns gcd(m-n, n) #

def gcd(m,n):
    return None  # Replace this with your implementation

B. Complete the following function that uses recursion to find and return the max (largest) value in the list u.

# find_max([1, 7, 4, 5] returns 7
# find_ max ([1, 7, 4, 5, 9, 2] returns 9
#
def find_max(u):
    return None  # Replace this with your implementation

C. Complete the following recursive function that returns the zip of two lists u and v of the same length. Zipping the lists should place the first element from each into a new array, followed by the second elements, and so on (see example output).

# zip([1, 2, 3], [4, 5, 6]) returns [1, 4, 2, 5, 3, 6]
#
def zip(u, v):
    return None  # Replace this with your implementation

D. Complete the following recursive function that removes all occurrences of the number x from the list nums.

# remove_number(5, [1, 2, 3, 4, 5, 6, 5, 2, 1]) returns [1, 2, 3, 4, 6, 2, 1]
#
def remove_number(x, nums):
    return None  # Replace this with your implementation

E. Write a recursive function removeLetter(string, letter) that takes a string and a letter as input, and recursively removes all occurrences of that letter from the string. The function is case sensitive.

Some example test cases are below:

>>> removeLetter("test string", "t")
es sring

>>> removeLetter("mississipi", "i")
mssssp

>>> removeLetter("To be or not to be is a question.", "t")

To be or no o be is a quesion.

In PyCharm

In: Computer Science

How does a person become a leader? where do our values come from and Why do...

How does a person become a leader?

where do our values come from and Why do we care about what we care about?

What is the value of disagreement and opposition?

I would appreciate if you guys could answer all of the above,

thank you in advance!

In: Operations Management

For each of the following reactions, calculate ?H?rxn, ?S?rxn, ?G?rxn at 25?C. State whether or not...

For each of the following reactions, calculate ?H?rxn, ?S?rxn, ?G?rxn at 25?C. State whether or not the reaction is spontaneous. If the reaction is not spontaneous, would a change in temperature make it spontaneous? If so, should the temperature be raised or lowered from 25?C?

2CH4(g)?C2H6(g)+H2(g)

?H?rxn, ?S?rxn, ?G?rxn at 25?C???

In: Chemistry

For the following, copy the questions into a text file and write your answers for each...

For the following, copy the questions into a text file and write your answers for each question.

I. Place the following algorithm time complexities in order from fastest (least number of comparisons) to the slowest: nlogn, n, n2, 2n, logn, 2n
II. In your own words, explain the two characteristics that a recursive solution must have.
III. Why are divide-and-conquer algorithms often very efficient in terms of time complexity?
IV. Write in your own words 3 different examples of cases where people around you are giving up their privacy to use some service in exchange for a benefit. State for each example what data is being collected and what benefits the user receives in exchange.

In: Computer Science

C++ Program Create Semester class (.h and .cpp file) with the following three member variables: ▪...

C++ Program
Create Semester class (.h and .cpp file) with the following three member variables:
▪ a semester name (Ex: Fall 2020)
▪ a Date instance for the start date of the semester
▪ a Date instance for the end date of the semester

The Semester class should have the following member functions
1. Create a constructor that accepts three arguments: the semester name, the start Date, and the end Date. Use default values for all the parameters in the constructor
2. Overload the << operator for this class
▪ Have it output the semester name and dates in a manner similar to this:
Semester: Fall 2020 (08/31/2020 - 12/10/2020)
3. Overload the >> operator for this class
▪ Have the >> operator accept input for the Semester name, start date and end date.
4. Create the get and set functions for each variable - Do NOT recreate the Date class - reuse code from Date Class.

Below is the Date .h and .cpp file

Date.h
========================================

#define DATE_H
#include <iostream>
using namespace std;

class Date
{
   friend ostream& operator << (ostream&, const Date&);
   friend istream& operator >> (istream&, Date&);

private:
   int month;
   int day;
   int year;
   void checkDate();

public:
   Date(int = 1, int = 1, int = 1990);
   ~Date();
   Date& setDate(int, int, int);
   Date& setMonth(int);
   Date& setDay(int);
   Date& setYear(int);

   int getMonth() const;
   int getDay() const;
   int getYear() const;

   bool operator< (const Date&);
   bool operator> (const Date&);
   bool operator<= (const Date&);
   bool operator>= (const Date&);
   bool operator== (const Date&);
   bool operator!= (const Date&);
};

Date.cpp
========================================

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

Date::Date(int m, int d, int y)
{
   setDate(m, d, y);
}

Date::~Date()
{

}

Date& Date::setDate(int m, int d, int y)
{
   setMonth(m);
   setDay(d);
   setYear(y);

   return *this;
}

void Date::checkDate()
{
   static const int daysPerMonth[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };

   if (month <= 0 || month >= 12)
   {
       month = 1;
   }

   if (!(month == 2 && day == 29 && (year % 400 == 0 || (year % 4 == 0 && year % 100 != 0)))
       && (day <= 0 || day > daysPerMonth[month]))
   {
       day = 1;
   }

   if (year <= 1989)
   {
       year = 1990;
   }
}

Date& Date::setMonth(int m)
{
   month = m;
   checkDate();
   return *this;
}

Date& Date::setDay(int d)
{
   day = d;
   checkDate();
   return *this;
}

Date& Date::setYear(int y)
{
   year = y;
   checkDate();
   return *this;
}

int Date::getMonth() const
{
   return month;
}

int Date::getDay() const
{
   return day;
}

int Date::getYear() const
{
   return year;
}

bool Date::operator<(const Date& right)
{
   bool status;
   if (year < right.year)
       status = true;
   else if ((year == right.year) && (month < right.month))
       status = true;
   else if ((year == right.year) && (month < right.month) && (day < right.day))
       status = true;
   else
       status = false;

   return status;
}

bool Date::operator>(const Date& right)
{
   bool status;
   if (year > right.year)
       status = true;
   else if ((year == right.year) && (month > right.month))
       status = true;
   else if ((year == right.year) && (month > right.month) && (day > right.day))
       status = true;
   else
       status = false;

   return status;
}

bool Date::operator<=(const Date& right)
{
   bool status;
   if (year <= right.year)
       status = true;
   else if ((year == right.year) && (month <= right.month))
       status = true;
   else if ((year == right.year) && (month <= right.month) && (day <= right.day))
       status = true;
   else
       status = false;

   return status;
}

bool Date::operator>=(const Date& right)
{
   bool status;
   if (year < right.year)
       status = true;
   else if ((year == right.year) && (month < right.month))
       status = true;
   else if ((year == right.year) && (month < right.month) && (day < right.day))
       status = true;
   else
       status = false;

   return status;
}

bool Date::operator==(const Date& right)
{
   bool status;
   if (year == right.year && month == right.month && day == right.day)
       status = true;
   else
       status = false;
   return status;
}

bool Date::operator!=(const Date& right)
{
   bool status;
   if (year != right.year && month != right.month && day != right.day)
       status = true;
   else
       status = false;
   return status;
}

ostream& operator<<(ostream& output, const Date& obj)
{
   output << setfill('0') << setw(2) << obj.month << '/' << setfill('0') << setw(2) << obj.day << '/' << obj.year;

   return output;
}

istream& operator>>(istream& input, Date& obj)
{
   input >> obj.month;
   input.ignore();
   input >> obj.day;
   input.ignore();
   input >> obj.year;

   obj.checkDate();
   return input;
}

In: Computer Science

Example (8): A slurry containing 50 percent of the mass of solid materials with a density...

Example (8): A slurry containing 50 percent of the mass of solid materials with a density of 2,600 kg / m is filtered on a rotary cylinder filter, with a diameter of 2.25 m and a length of 2.5 m, which works with immersion of 35% of its surface in the slurry and under vacuum 600 mm Hg. A laboratory test on a slurry sample, using a 100 cm² paper filter and covered with a cloth identical to that used on a cylinder, produced 220 cm of filtration in the first minute and 120 cm of filter the next day a minute when the paper was under a vacuum of 550 mm Hg. The apparent density of the moist cake was 1600 kg / m and the filter density was 1000 kg / m3. Assuming the cake was not compressible and left 5 mm of cake on the cylinder, determine the theoretical maximum flow rate of the filter that could be obtained. What is the speed of the cylinder that will give the filter rate 80% of the maximum?

In: Other

Explain the concept of “global talent acquisition.” How does it differ from domestic talent acquisition? What...

Explain the concept of “global talent acquisition.” How does it differ from domestic talent acquisition? What is the “War for Talent” and what are some of the strategies that companies have used to compete for talent in the global labor market? What are some of the key factors that should be considered in creating a global staffing plan? Specifically, how are competency models used in creating global staffing plans and what are some examples of basic competencies for a global HR professional. Discuss the four approaches to global staffing. What are some advantages and disadvantages of each approach? Finally, how is the staffing pattern likely to change over time in the foreign subsidiary of a multinational enterprise?

In: Operations Management

Problem #2 PERT Analysis: The following represents a project with four activities. All times are in...

Problem #2

PERT Analysis: The following represents a project with four activities. All times are in weeks.

Activity

Immediate

Predecessor

Optimistic

Time

Most

Likely

Time

Pessimistic

Time

A

-

3

8

14

B

-

8

8

9

C

A

6

9

18

D

B

6

11

17

According to the data in the above Table:

What is the critical path?

What is the minimum expected completion time for the project?

According to the above Table, there are four activities in the project. Assume the normal distribution is appropriate to use to determine the probability of finishing by a particular time. If you wished to find the probability of finishing the project in 20 weeks or fewer, it would be necessary to find the variance and then the standard deviation to be used with the normal distribution. What is the probability of completing this project in 20 weeks or fewer?

In: Operations Management

STEP 1: Respond to the following prompt in a post between 200 and 400 words: Pick...

STEP 1: Respond to the following prompt in a post between 200 and 400 words:

Pick one of the mental disorders you learned about in this module. Think of a fictional character who you think might fit, at least to some extent, that type of disorder. Consider cartoon characters, Disney princesses, favorite sitcom characters, etc. Do some more research on the disorder to write up a diagnosis. Explain which disorder the character may have, describe the disorder, then provide at least three evidences or examples of how or why that character meets the description of the mental illness.

In: Psychology

During June, the following changes in inventory item 27 took place:             June   1     Balance           &nb

During June, the following changes in inventory item 27 took place:

            June   1     Balance                         1,400 units @ £24

                    14     Purchased                        900 units @ £36

                    24     Purchased                        700 units @ £30

                      8     Sold                                 400 units @ £50

                    10     Sold                              1,000 units @ £40

                    29     Sold                                 500 units @ £44

Perpetual inventories are maintained in units only.

Instructions

What is the cost of the ending inventory for item 27 under the following methods? (Show calculations.)

(a)   FIFO.

(b)   Average Cost.

In: Accounting

1. Given a string of at least 3 characters as input, if the length of the...

1. Given a string of at least 3 characters as input, if the length of the string is odd return the character in the middle as a string. If the string is even return the two characters at the midpoint.

public class Class1 {
  
public static String midString(String str) {
//Enter code here
}
}

-----------

2. Given an array of integers return the sum of the values stored in the first and last index of the array. The array will have at least 2 elements in it

public class Class1 {
  
public static int endSum(int[] values) {
//Enter code here
}
  
}

-----------

3. The method takes a string as a parameter. The method prints treat if the string is candy or chocolate (of any case, such as CaNdY) Otherwise print trick

import java.util.Scanner;

public class Class1 {
public static void trickOrTreat(String str) {
//Enter code here
}
  
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
trickOrTreat(s.nextLine());
}
}

In: Computer Science

Thinking about Treatment STEP 1: Choose ONE of the following questions and respond to it in...

Thinking about Treatment

STEP 1: Choose ONE of the following questions and respond to it in a post of at least 200 words.

Psychoanalytic theory is no longer the dominant therapeutic approach, because it lacks empirical support. Yet many consumers continue to seek psychoanalytic or psychodynamic treatments. Do you think psychoanalysis still has a place in mental health treatment? If so, why?

What might be some advantages and disadvantages of technological advances in psychological treatment? What will psychotherapy look like 100 years from now?

Some people have argued that all therapies are about equally effective, and that they all affect change through common factors such as the involvement of a supportive therapist. Does this claim sound reasonable to you? Why or why not?

When choosing a psychological treatment for a specific patient, what factors besides the treatment’s demonstrated efficacy should be taken into account?

In: Psychology

(Area of a convex polygon) A polygon is convex if it contains any line segment that...

(Area of a convex polygon)

A polygon is convex if it contains any line segment that connects two points of the polygon. Write a program that prompts the user to enter the number of points in a convex polygon, then enter the points clockwise, and display the area of the polygon.

Sample Run

Enter the number of points: 7

Enter the coordinates of the points:

-12 0 -8.5 10 0 11.4 5.5 7.8 6 -5.5 0 -7 -3.5 -5.5

The total area is 244.575

In: Computer Science

Description: In April 2020, the Toyota-backed startup Pony.ai has teamed up with the online Asian ecommerce...

Description: In April 2020, the Toyota-backed startup Pony.ai has teamed up with the online Asian ecommerce site Yamibuy3 to delivery packages and groceries in Irvine, California due to Covid-19. Read the news story published by Bloomberg4 and visit the Pony.ai website5 to acquire background information. You may explore more information from other pieces of news and video clips. Now assumed that customers purchased groceries in the online website, they would like to use Pony.ai app for a home delivery. You are asked to develop diagrams to capture the main features of such autonomous delivery service. Remember, online shopping and checkout are not integral part of your application, but only autonomous delivery service (PonyPilot6 ). Tasks: Develop the following diagrams to capture the autonomous delivery service. You may make any assumptions as necessary since the PonyPilot app is not readily available to everyone (invitation only). 1. Use case diagram (focus on delivery service) 2. Sequence diagram (focus on delivery service) 3. ERD diagram to store necessary data (focus on delivery service)

In: Operations Management