CamScanner 10-11-2023 23
.pdf
keyboard_arrow_up
School
University of Missouri, St. Louis *
*We aren’t endorsed by this school
Course
3130
Subject
Computer Science
Date
Oct 30, 2023
Type
Pages
4
Uploaded by MajorSteelPheasant21
Fall
2023,
CS3130,
Dr.
W.
He
Homework
Assignment
1
(25
Questions:
Answers)
(Due
10/7/2023
Saturday)
Noqw
V
Name:
¢l
l.
Given
a
polynomial
as
follows,
2
4
6
8
1
\
e
P(z)
=
ap
4+
a12®
+
apx®
+
azz®,
<9,
&
Qd\.
vugh
+
X
to
evaluate
it
for
arbitrary
coefficients
{ag,
a1,
as,
a3}
and
some
given
value
z,
the
P
)
X{
minimum
number
of
multiplications
that
one
needs
is:
=
44
4
Qq'
+
(qfl
b
Ak
)q\
‘
q
4
)
5
(c¢)
6
(d)
7ormore
Ko
2.
Nobody
can
find
a
solution
to
find
the
minimum
in
an
n-element
array
with
fewer
than
n
—
1
comparisons,
even
after
100
years.
(a)
true
false
3.
Which
of
the
following
growth
functions
has
the
highest
order
of
growth?
(a)
»n
(b)
logn
(c¢)
nlogn
n2
4.
When
we
use
the
linear
search
on
many
different
input
arrays,
sometimes
we
have
unordered
arrays
and
sometimes
we
have
ordered
arrays.
Which
of
the
following
statements
about
the
efficiency
is
correct?
(a)
We
will
get
better
efficiency
whenever
we
process
the
ordered
arrays.
(b)
We
will
get
better
efficiency
whenever
we
process
the
unordered
arrays.
¢
We
will
get
the
same
efficiency
no
matter
we
process
the
ordered
or
unordered
arays
aoes
not
contain
any
adjacent
inversion,
then
it
does
not
contain
LON.
i€
b}
false
ble
that
one
can
find
the
solution
for
the
problem:
Finding
the
minimum
ray
with
n
elements
with
an
algorithm
that
is
in
©(n)?
yes
(b)
no
7.
To
evaluate
a
monomial
z*®
for
a
given
value
2z,
what
is
the
minimum
number
of
multiplications
that
you
need?
,
:
)
(
]
7R
4
=
‘
¢
*
4
q’(\(%;x\"x
-
N
,X-X;
:
)
TS
Ans:
K-
A
=%
w2
KT
X
R
X
o
*
A8y
A
good
iden
o
APy
the
P
wee
fwotoresateon
Mothod
G
Do
Ve
groadeat
Sor
ob
o
1000t
posttive
intepera’
\;\‘
AR
\\l\“
no
O
Let
moand
n
be
two
posttive
integers,
and
m
e
Phen
we
npply
Lhee
Diiaion
Hgoniiim
and
get
the
following
equation
for
some
tntegers
¢
nnd
r,
me=gn
e
with
0
e
Which
of
the
following
equalitios
is
correct?
(&)
god(mn)
=
ged(g.n)
()
ged(ryn)
=
ged(g,n)
()
god(m
n)
=
ged(q,
1)
w
ped(mn)
pod(n,r)
10.
Given
a
polynomial
as
follows,
3
7
P(x)
=
ag
+
a,2°
+
aga”
+
aga!
+
a2
)
to
evaluate
it
for
arbitrary
coeflicients
{ay,
ay,ay,
a3,
a4}
and
some
given
value
z,
the
minimum
number
of
multiplications
that
one
needs
is:
(a)
5
@/
6
(¢)
7
(d)
8ormore
11.
Which
of
the
following
growth
functions
has
the
lowest
order
of
growth?
(a)
vn*+4n+7
(b)
27
@
=
(d)
log
n
12.
§
n
+
logn
Vhich
of
the
following
growth
functions
has
the
lowest
order
of
growth?
e
n®
+
5n
+
8
logn
(b))
———
B
(c)
n0000001
(d)
/mlogn
of
the
following
functions
increases
faster
in
the
long
run?
N
(a)
)1.0000001"
(b)
n34578%
J
14.
Given
a
5-element
array,
say
{z;,
&2,
3,
24,
T5},
it
is
known
that
1
vy
<
@4
and
Z;
<
o9.
Based
on the
given
information,
which
element
cannot
be
the
(a))
z;y
(b)
=z
(c)
/
b
median?
zz
(d)
x4
15.
Given
a
chessboard,
we
want
to
find
those
squares
of
different
sizes
with
2
black
squares
and
2
white
squares
at
its
4
corners.
Ho
w
many
such
squares
can
you
find?
AR
=
I8
=
L/
7/
\
/
{
«~
|
:
/,‘
+
R)
%
L
-
7
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
- Access to all documents
- Unlimited textbook solutions
- 24/7 expert homework help
Related Questions
Q2} Write a user-define function that add or subtracts two polynomials of
any order. Use the function to add and subtract the following
f₁(x)=x5-7x4+11x³-4x²-5x-2 and f₂(x)=9x²-10x+6
polynomials:
arrow_forward
Brute force equation solver
this is python program.
Numerous engineering and scientific applications require finding solutions to a set of equations. Ex: 8x + 7y = 38 and 3x - 5y = -1 have a solution x = 3, y = 2. Given integer coefficients of two linear equations with variables x and y, use brute force to find an integer solution for x and y in the range -10 to 10.
Ex: If the input is:
8 7 38 3 -5 -1
Then the output is:
3 2
Use this brute force approach:
For every value of x from -10 to 10 For every value of y from -10 to 10 Check if the current x and y satisfy both equations. If so, output the solution, and finish.
Ex: If no solution is found, output:
No solution
You can assume the two equations have no more than one solution.
Note: Elegant mathematical techniques exist to solve such linear equations. However, for other kinds of equations or situations, brute force can be handy.
''' Read in first equation, ax + by = c '''a = int(input())b = int(input())c = int(input())
''' Read in…
arrow_forward
C language
arrow_forward
C language programming
arrow_forward
MATLAB
arrow_forward
/sites/Sem1 20202021 TK1114 Lab IT1IT2/Shared%20Documents/General/LabFinal(Taksir).
E D Page view A Read aloud I
Input Standard Input
Output Standard Output
Topic Medium Problem
Marks 6
Problem Description
The dot product is an algebraic operation that takes two equal-length sequences of numbers
(usually coordinate vectors) and returns a single number.
The dot product of two vectors a = [a , a2, ..., an ] and b = [bi , b2, ..., bn ] is defined as:
a.b =
aibı + azb2 +...+ anbn
where E denotes summation and n is the dimension of the vector space. For instance, in three-
dimensional space, the dot product of vectors [1, 3, -5] and [4, -2,-1] is:
[1,3, -5] [4,-2,-1] = (1 x 4) + (3 x -2) + (-5 x -1)
= 4 – 6+ 5
= 3
Write a program to find the dot product of the given vectors.
Input
First line of input is an integer N (1
arrow_forward
MATLAB
arrow_forward
Problem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…
arrow_forward
Problem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…
arrow_forward
Problem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…
arrow_forward
Q1} write program to calculate the resistance, R, to fluid flow a long two pipe is
connected where
L1-L₂ cote
R=
L₁
T₂ singe
Where k is a constant, L₁, L2 are length of the first pipe and second pipe
respectively, r₁, r2 are the radius of the first pipe and second pipe respectively.
Define
with element ranging from 30° to 85° with spacing 0.5°. Calculate R/k for
each value of 0, And find the minimum value of R.
k+
-k
arrow_forward
12
- fx =sort(StudentList!A2:F38,2, true)
A
C
1
Student ID Surname
Forename
10009lAkins
Lewis
10026 Allen
Mary
Explain the formula highlighted above and each of the parts in the formular.
In other words, briefly describe in your own words what it does and what the result is.
For this question, describe the following parameters in the formula above:
- StudentList!A2:F38 is the range of cells (A2:F38) pulled from the sheet labeled
Studentlist!
- ,2 is
- ,true is
arrow_forward
c++
PLEASE TRACE THE FUNCTION
Given the code:void d(int n) { if(n<2) { cout << n << " "; return; } cout << n << " "; d(n/3);}
1. Trace the function when n is 12.
arrow_forward
MULTIPLE FUNCTIONS AND RECURSIVE FUNCTIONS
Use #include<stdio.h>
arrow_forward
in C++
arrow_forward
Only problem 1
C++ language
Using Functions easy way not complicated
arrow_forward
In c++
The Fibonacci numbers are a series of numbers that exhibit the following pattern:
0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144, …
The series starts with 0 and 1, and each subsequent number in the series is the sum of the previous two numbers. The Fibonacci sequence, Fn, is defined by the following recurrence relation:
Fn = Fn-1 + Fn-2
Where the initial values are F0 = 0 and F1 = 1. Write a program that prompts the user to enter in a positive integer N and generates the Nth Fibonacci number. Your main function should handle user input and pass that data to a function called Fib that takes integer N as input and returns the Nth Fibonacci number. Include the functions preconditions and postconditions as comments in your source code. Include some basic input validation to make sure the function’s preconditions are met before the function is called. Show your source code and a sample of your program output.
arrow_forward
Send me help with my Assignment1. Write the Algorithm for this c program.
arrow_forward
Chapter 4 write a program in C++ language
to name a row with the name (Count) to
calculate the number of inhabitants of the
city of N as a function of the number of years
T, noting that the primary population N is 3
million people and that the city is subject to
the following population growth equation: N =
Z (No + (700 -) No) exp
arrow_forward
Python question
Application: Big-O Notation (Q8-11)
For each of the time complexities in this segment give the tightest bound in terms of a simple polylogarithmic function using big-O notation.
Note: use the ‘^’ symbol to indicate exponents, i.e., write O(n^2) for O(n2).
Question 8 (Big-O Notation 1)
T(n) = n2+ log n + n
Question 9 (Big-O Notation 2)
T(n) = n/3 + 4 log n + 2n log(n)
Question 10 (Big-O Notation 3)
T(n) = 7n5 + 2n
Question 11 (Big-O Notation 4)
T(n) = (n%5) + 12,000
arrow_forward
None
arrow_forward
please code in python
A mining company conducts a survey of an n-by-n square grid of land. Each row of land is numbered from 0 to n-1 where 0 is the top and n-1 is the bottom, and each column is also numbered from 0 to n-1 where 0 is the left and n-1 is the right. The company wishes to record which squares of this grid contain mineral deposits.
The company decides to use a list of tuples to store the location of each deposit. The first item in each tuple is the row of the deposit. The second item is the column. The third item is a non-negative number representing the size of the deposit, in tons. For example, the following code defines a sample representation of a set of deposits in an 8-by-8 grid.deposits = [(0, 4, .3), (6, 2, 3), (3, 7, 2.2), (5, 5, .5), (3, 5, .8), (7, 7, .3)]Given a list of deposits like the one above, write a function to create a string representation for a rectangular sub-region of the land. Your function should take a list of deposits, then a set of parameters…
arrow_forward
lable Thursday 8:00 am to 4:00pm) - Google Chrome
m/mod/quiz/attempt.php?attempt-D1623348&cmid%3823067
NG SYSTEM (ACADEMIC)
Check all that apply to Python variables
O a. A data type is associated with the variable's name
O b. A variable is a reference to a value
Oc.
When assigned a new value, a variable's present value is lost
O d. Avariable is a memory location with a name
Which one of the following operator computes the quotient and discards the fractional part?
O a V
O b. /
O d. %
CLEAR MY CHOICE
SFAT
here to search
arrow_forward
in js asap program
arrow_forward
pythn opython
arrow_forward
SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Related Questions
- Q2} Write a user-define function that add or subtracts two polynomials of any order. Use the function to add and subtract the following f₁(x)=x5-7x4+11x³-4x²-5x-2 and f₂(x)=9x²-10x+6 polynomials:arrow_forwardBrute force equation solver this is python program. Numerous engineering and scientific applications require finding solutions to a set of equations. Ex: 8x + 7y = 38 and 3x - 5y = -1 have a solution x = 3, y = 2. Given integer coefficients of two linear equations with variables x and y, use brute force to find an integer solution for x and y in the range -10 to 10. Ex: If the input is: 8 7 38 3 -5 -1 Then the output is: 3 2 Use this brute force approach: For every value of x from -10 to 10 For every value of y from -10 to 10 Check if the current x and y satisfy both equations. If so, output the solution, and finish. Ex: If no solution is found, output: No solution You can assume the two equations have no more than one solution. Note: Elegant mathematical techniques exist to solve such linear equations. However, for other kinds of equations or situations, brute force can be handy. ''' Read in first equation, ax + by = c '''a = int(input())b = int(input())c = int(input()) ''' Read in…arrow_forwardC languagearrow_forward
- C language programmingarrow_forwardMATLABarrow_forward/sites/Sem1 20202021 TK1114 Lab IT1IT2/Shared%20Documents/General/LabFinal(Taksir). E D Page view A Read aloud I Input Standard Input Output Standard Output Topic Medium Problem Marks 6 Problem Description The dot product is an algebraic operation that takes two equal-length sequences of numbers (usually coordinate vectors) and returns a single number. The dot product of two vectors a = [a , a2, ..., an ] and b = [bi , b2, ..., bn ] is defined as: a.b = aibı + azb2 +...+ anbn where E denotes summation and n is the dimension of the vector space. For instance, in three- dimensional space, the dot product of vectors [1, 3, -5] and [4, -2,-1] is: [1,3, -5] [4,-2,-1] = (1 x 4) + (3 x -2) + (-5 x -1) = 4 – 6+ 5 = 3 Write a program to find the dot product of the given vectors. Input First line of input is an integer N (1arrow_forwardMATLABarrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…arrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…arrow_forwardProblem Statement: The mathematician Conway imagined a game, called game of life, whichconsidered cells that are susceptible to reproduce, disappear, or survive when they obey certainrules. These cells are represented by elements on a grid of squares, where a grid has an arbitrarysize. Thus, each cell (except those on the boundaries of the grid) is surrounded by eight squaresthat contain other cells. The rules are stated as follows:1. Survival: Each cell that has two or three adjacent cells survives until the next generation.2. Death: Each cell that has at least four adjacent cells disappears (or dies) by overpopulation.Also, each cell that has at most one adjacent cell dies by isolation.3. Birth: Each empty square (i.e., dead cell) that is adjacent to exactly three cells gives birthto a new cell for the next generation.It is worth noting that all births and deaths occur at the same time during a generation.Write a program that simulates this game and displays all successive…arrow_forwardQ1} write program to calculate the resistance, R, to fluid flow a long two pipe is connected where L1-L₂ cote R= L₁ T₂ singe Where k is a constant, L₁, L2 are length of the first pipe and second pipe respectively, r₁, r2 are the radius of the first pipe and second pipe respectively. Define with element ranging from 30° to 85° with spacing 0.5°. Calculate R/k for each value of 0, And find the minimum value of R. k+ -karrow_forward12 - fx =sort(StudentList!A2:F38,2, true) A C 1 Student ID Surname Forename 10009lAkins Lewis 10026 Allen Mary Explain the formula highlighted above and each of the parts in the formular. In other words, briefly describe in your own words what it does and what the result is. For this question, describe the following parameters in the formula above: - StudentList!A2:F38 is the range of cells (A2:F38) pulled from the sheet labeled Studentlist! - ,2 is - ,true isarrow_forwardarrow_back_iosSEE MORE QUESTIONSarrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Browse Popular Homework Q&A
Q: In 1992 a national vital statistics report indicated that about 2.7% of all births produced twins.…
Q: a) The parameter of interest is [Select]
>) The null hypothesis Ho : µ
alternative hypothesis Ha:
C)…
Q: How do you believe society increased its control of women’s sexuality and women’s bodies throughout…
Q: 987 m/s =
=
km/hr
4392 km/h =
m/s
Q: The function f is graphed below. State the values that fulfill the following requirements.
If there…
Q: Exercises for Input-Output Analysis
13. Suppose that you have been given the following data on the…
Q: How are universal religions different from other kinds of religions? How is this difference…
Q: There are 8 people at an office meeting. How many handshake
Q: define what it means to be an “American woman.” Despite the many differences that divide American…
Q: Table 1 contains price and quantity information for two products produced by Apple,
the iPhone and…
Q: Action Travel has 10 employees each working 40 hours per week and earning $20 an hour. Federal…
Q: Problem 5.
Remove the node with key '12' from the following red-black tree
3
4
5
7
6 8
10
11
12…
Q: Which of the following positions in options benefit if the underlying stock price increases? Assume…
Q: How many moles of Ag+ are needed to react with 25.75 mL of 0.432 M CrO42-?
2 Ag+ (aq) + CrO42- (aq)…
Q: 2. Suppose a random sample of 52 National Football League players from Greensboro had an
average…
Q: Vaughn is a manufacturer that specializes in three types of toy instruments: xylophones, electronic…
Q: 20. When the reaction 2H₂S(g) 2H2(g) + S2(g) is carried out at 1065°C, Kp = 0.012.
Starting with…
Q: An “unnatural” sugar found as a component of hemicellulose was found to contain 40.00% C and 6.71% H…
Q: In a group of 35 Virginia residents, 28 Maryland residents, and 23 Delaware residents, two people…
Q: 21.
hall in terms of time.
y
-5-3
+ postove x-ve
HKH
3
X
-4y = (x + 3)²-4
Q: Todine atoms combine to form molecular iodine in the gas phase
I(g) + I(g) → 1₂ (g)
This reaction…
Q: medication order states administered 1 gram in 500ML of DSW at 150mg/hr via infuse pump. What is…
Q: Please help me answer question #29 meeting the requirements for both part a and part b.
Note that…
Q: Find the derivative of: - 3 sin² ( – 5x6).
Q: Exercise 7.2.1 Find the eigenvalues and eigenvectors of the matrix
5 -18 -32
4
2
-5 -11
One…