3. Let Σ = {a, b} be an alphabet and let · denote concatenation. Compute (ba · ε) · abb, where ε is the empty word.
Q: b. Drawing a polygon Now that you can draw a circle, the next step is to draw a polygon inside the…
A: def DrawPolygon(N): theta = 0 dTheta = 2*np.pi/N for i in range(N):…
Q: The greatest common divisor (GCD) for a pair of numbers is the largest positive integer that divides…
A: Here is your solution step by step -
Q: A DFA for { strings, when interpreted as a base-3 number, are even numbers } b-) c-) A DFA for {…
A:
Q: 7. We usually write numbers in decimal form (or base 10), meaning numbers are composed using 10…
A: a) S = set of 2 digit hexadecimal in which first digit is E or F Then where A is the set of 2 digit…
Q: # Exercise 1. Implement the algorithm covered in lectures that determines if an integer n is prime.…
A: The code and the output is given in step 2.
Q: Assume x and y are positive integers representing input size for the following pseudocodes.…
A: Part 1) This part of code is running in infinite time So, we cannot determine T(n) [ As T(n) used…
Q: Define function print_popcorn_time() with parameter bag_ounces. If bag_ounces is less than 3, print…
A: PROGRAM INTRODUCTION: Start the definition of the function to print the popcorn time. Use the if…
Q: 3. Define a function to count how many 1's in an integer number. Return this count: int…
A: Based on the given syntax, the required function is in C or C++ programming language. For this…
Q: Let K(x) be the statement "x has a pet koala," let G(x) be the statement "x has a gazelle," let U…
A: In this question we have to express each statements about ownership of animals (koalas, gazelles,…
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: #include <iostream>using namespace std;bool isLeap(int year){ // if year is divisible by 4…
Q: Write function pay() that takes as input an hourly wage and the number of hours an employee worked…
A: def pay(hourly_wage,num_of_hours): if num_of_hours < 40:…
Q: characters that represents a maze. Each position can contain either an X or a blank. Starting at…
A: Write a function that accepts an 8 by 8 array of characters that represents a maze. Each position…
Q: [Unbalanced kod] Given a set of n weights {w₁,..., w} and a rod of length n - 1 inches, we can…
A: Greedy Algorithm A greedy algorithm is an algorithmic approach that follows the heuristic of making…
Q: 2. Let {a, b, c} be an alphabet. List all of the words in Σ2
A: Σ2 means list of words of length 2 using the alphabets {a, b, c}
Q: text = "ALICE was beginning to get very tired of sitting by her sister on the bank, and of having…
A: The task specified in the question is to write a R program to write a function that predicts a set…
Q: Assume x and y are positive integers representing input size for the following pseudocodes.…
A: Given data: def function(n): t=0 for a in range(n): for b in range(b): for c…
Q: A3 = {w ∈ {1,0}* | every odd position in w is an 1}. Provide regular expression. explain in detail…
A: The regular expression that represents the language A3 = {w ∈ {1,0}* | every odd position in w is a…
Q: Clarification: Q.2 You are counting points for a basketball game, given the amount of 3-pointers…
A: In this question we have to understand the code for python program of counting points for a…
Q: CodeWorkout X265: Recursion PIogramming Exercise:
A: Lets see the solution.
Q: a. Following pseudocode on slide # 30, implement a function to perform binary a The function takes…
A: Dear Student, As no programming language is mentioned I am assuming it to be C++, code,…
Q: 4. Langauge concatentation (a) Let L = {X, a}. Characterize L20. (b) Let L E*. {aa, bb} E*.…
A: Here we are going to find out L20 using given language L. We have to concatenate Language L 20 times…
Q: How many ways are there to navigate through a grid (w * h): Start How Many Paths? Examples End…
A: Please refer to the following step for the complete solution to the problem above.
Q: Assume that we have a function "double getDistance(struct point p1, struct point p2)" that…
A: The formula for Euclidean distance between two points P(x1,y1), Q(x2,y2) is (x2-x1)2 + (y2-y1)2…
Q: 7. ax^2+ bx + c = 0 a,b,c are constants number entered by the user. Find roots for equation and…
A: 7. ax^2+ bx + c = 0 a,b,c are constants number entered by the user. Find roots forequation and…
Q: Given a sentence, write a function that counts its number of words.
A: I have provided PYTHON CODE along with CODE SCREENSHOT and OUTPUT SCREENSHOT--------------
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: # Modified Code def is_leap_year(user_year): if((user_year % 4 == 0 and user_year % 100 != 0) or…
Q: Implement the quadratic_formula() function. The function takes 3 arguments, a, b, and c, and…
A: Below is the modified python code to implement the quadratic equation and find its roots: -…
Q: Please code in OOP C++, show example output to see if no errors Crossword Puzzles An unlabeled…
A: The program for the above-given question is given below:
Q: a. Consider the Boolean expression ((x 100)) Why is this expression probably not what the…
A: Kindly Note: As per our guidelines we are supposed to answer only one question. Kindly repost other…
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: # Modified Code def is_leap_year(user_year): if((user_year % 4 == 0 and user_year % 100 != 0) or…
Q: Suppose you have to unify the following two expressions: • R{u, T(z, Z), z, T(Q{B), z)) • R(T(Q(B),…
A: Making two logical expressions identical by substitution is called unification
Q: Write a function to determine the resultant force vector R of the two forces F₁ and F2 applied to…
A: Required Python code provided below in next step with screenshots of sample output
Q: Output the information as a formatted histogram. Each name is right justified with a width of 20.…
A: The setw( int width) function: The function, setw takes an integer argument that sets the number of…
Q: Let S(x) = "x is a student in our class" and P(x) = "x lives in Wahiawa" a. Assume the u.d. for x is…
A: The answer is given below...
Q: 27. Develop an algorithm to find the time when an observed object by a surveillance camera becomes…
A: Dear Student, The answer to your question is given below -
Q: 4. In addition to the °cos' pre-defined function, which is found in the "cmath' library, the cosine…
A: Given: In addition to the "cos pre-defined function, which is found in the 'cmath' library, the…
Q: 10. Draw a DFA of strings where the 2nd last symbol is a. Σ= {a,b} [You may draw the NFA for this…
A:
Q: A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to…
A: ⦁ User will enter the year as an input.⦁ Then we check the condition, if the year is divisible by…
3. Let Σ = {a, b} be an alphabet and let · denote concatenation. Compute (ba · ε) · abb,
where ε is the empty word.
![](/static/compass_v2/shared-icons/check-mark.png)
Given
The answer is given below.
Step by step
Solved in 2 steps with 1 images
![Blurred answer](/static/compass_v2/solution-images/blurred-answer.jpg)
- Given 2 strings, return their concatenation, except remove the last character of each and swap the order of the inputted words. The strings will be at least length 3. Ex: If the input is: bird penguin the output is: pengiubir Ex: If the input is: loving csce the output is: csclovinA year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400; therefore, both 1700 and 1800 are not leap years Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is 1712, the output is: 1712 - leap year Ex: If the input is 1913, the output is: 1913 - not a leap yearProblem: Write a C++ program that would implement the function called roman Tolnt which returns the integer equivalent of a given string s in Roman numeral. Roman numerals are represented by seven different symbols each with corresponding values: I 1, V = 5, X = 10, L = 50, C = 100, D = 500 and M = 1000. - Roman numerals are usually written largest to smallest from left to right. However, the numeral for four is not IIII. Instead, the number four is written as IV. Because the one is before the five, we subtract it making four. The same principle applies to the number nine, which is written as IX. There are six instances where subtraction is used: I can be placed before V (5) and X (10) to make 4 and 9. . X can be placed before L (50) and C (100) to make 40 and 90. . C can be placed before D (500) and M (1000) to make 400 and 900.
- Part (a) Write a python function that computes the binomial coefficient ("). The function should return the correct answer for any positive integer n and k where k=m pass Part (c) Suppose that the number of people in the trial is 100. Then: • Plot a curve that shows how the probability of type 1 error changes with the choice of m, for m = 1,...n assuming that the null hypothesis holds (in red), • On the same picture, plot the probability of type 2 error vs the value of m in the case in which the new drug is effective with proability 0.68 (in blue). You can plot the two curves using matplotlib.pyplot. You can select the color by passing color='r' or color='b' to the plt.plot() function. [4]: n - 100 # your code here def plot_curve (): pass [5]: plot_curve() Part (d) Based on the picture above, what value of m do you think would be suitable to keep both type 1 and type 2 error small at the same time? (You may assume that the company claims the new drug has 68% accuracy) [6]: # your…Task 2: The formula for the area, A, of a triangle with sides of length a, b, and c is V[s(s – a)(s – b)(s – c)] A = Where (a + b + c) s = Write, test, and execute a function that accepts the values of a, b, and c as parameters from a calling function, and then calculates the values of s and [s(s - a)(s - b)(s - c)]. If this quantity is positive, the function calculates A. If the quantity is negative, a, b, and c do not form a triangle, and the function should set A = -1. The value of A should be returned by the function. Test the function by passing various data to it and verifying the returned value.w=7 means the total number of bits is 7. If it says w=8, the total number of bits in the number system is 8. 1. For float f=60000.0, which one best describes f*f? (b) f*f 0, (c) f*f>= 0, (d) f*f 0, (c) i*i>= 0, (d) i*i 0, (c) i*i >= 0, (d) i*i w, (d) v = w, (d) v <= w, (e) none of the above 6. When the following loop is executed: for (i=0;i<10;i++) d = fun(i); what is the earliest iteration that can start triggering "Segmentation fault (core dumped)" when compiled without stack protector? (a)2, (b)3, (c)4, (d)5, (e) none of the above typedef struct { int a[4]; double d; double fun(int i) { volatile struct t s; s.d = 3.14; s.a[i] = 1073741824; return s.d; } } struct_t;
- Use R studio Let Xt be the grid (matrix). Xt(i, j) = 0, 1, 2 Write a function in R that takes a grid X and the point(i, j) and computes the number of 1.Midterm Practice Problems 1. Use recursion to write a function count_ones that returns how many Is there are in a number n when represented in decimal (base 10). For example, 1231 has two 1s. You can assume that n is nonnegative and at most 9 digits long. Do not use global (or static) variables. In main perform at least three tests of count_ones and use assert to check that the returned value is correct. Your function should have the following prototype: // count_ones (n) returns the number of is in the decimal representation of n // requires: 0 <= n < 10^9 int count_ones (int n);Create a function that returns the nth catalan number. In combinatorial mathematics, the Catalan numbers form a sequence of natural numbers that occur in various counting problems, often involving recursively-defined objects. They are named after the Belgian mathematician Eugène Charles Catalan (1814-1894). For more info, check out the resource tab. Examples getCatalanNumber (0) → 1 getCatalanNumber (6) → 132 getCatalanNumber (8) 1430 Notes Inputs are zero and positive integers.
- Complete the function ConvertToWeeksAndDays to convert totalDays to weeks and days. Return weeks and days using the TimeWeekDay struct. Ex: 26 days is 3 weeks and 5 days. Only lines 11-13 can be added onto, the rest of the program can't be changed.2. For each of the following sets, determine whether each of these statements is true or false. Write T or F. _e. {x} C {x} f. {x} C {{x}} g. {x} € P({{x}}) _h. {x} C P({x}) La. 0 E Ø _b. {0} C Ø _c. Ø E {0} _d. {ø} C {Ø, {Ø}}38. The geometric mean g of n numbers x; is defined as the nth root of the product of x;: g=Vx1x2X3•…Xn (This is useful, for example, in finding the average rate of return for an investment which is something you'd do in engineering economics). If an investment returns 15% the first year, 50% the second, and 30% the third year, the average rate of return would be (1.15*1.50*1.30)") Compute this.
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)
![Database System Concepts](https://www.bartleby.com/isbn_cover_images/9780078022159/9780078022159_smallCoverImage.jpg)
![Starting Out with Python (4th Edition)](https://www.bartleby.com/isbn_cover_images/9780134444321/9780134444321_smallCoverImage.gif)
![Digital Fundamentals (11th Edition)](https://www.bartleby.com/isbn_cover_images/9780132737968/9780132737968_smallCoverImage.gif)
![C How to Program (8th Edition)](https://www.bartleby.com/isbn_cover_images/9780133976892/9780133976892_smallCoverImage.gif)
![Database Systems: Design, Implementation, & Manag…](https://www.bartleby.com/isbn_cover_images/9781337627900/9781337627900_smallCoverImage.gif)
![Programmable Logic Controllers](https://www.bartleby.com/isbn_cover_images/9780073373843/9780073373843_smallCoverImage.gif)