Question
i need answers with explanation please. this is the whole question. a)the output of each algorithm below b)the number of assignment operations in each (show
i need answers with explanation please.
this is the whole question.
a)the output of each algorithm below
b)the number of assignment operations in each (show work)
c)the number of print operations in each (show work)
d)the complexity of each algorithm in terms of Big O notation (show work)
1.
Let n be a given positive integer, and let myList be a three-dimensional array with capacity n for each dimension.
for each index i from 1 to n do
{
for each index j from 1 to n do
{
for each index k from 1 to n do
{
myList[ i ] [ j ] [ k ] = i;
Print the element at myList[ i ] [ j ] [ k ];
}
}
}
2.
Let n be a given positive integer, and let myList be a three-dimensional array with capacity n for each dimension.
for each index i from 1 to n do
{
for each index j from 1 to n/2 do
{
for each index k from 1 to n/2 do
{
myList[ i ] [ j ] [ k ] = i;
Print the element at myList[ i ] [ j ] [ k ];
}
}
}
3.
Let n be a given positive integer, and let myList be a three-dimensional array with capacity n for each dimension.
for each index i from 1 to n do
{
for each index j from 1 to n/4 do
{
for each index k from 1 to n/4 do
{
myList[ i ] [ j ] [ k ] = i;
Print the element at myList[ i ] [ j ] [ k ];
}
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started