What is the big-o run-time of the c++ function

Assignment Help C/C++ Programming
Reference no: EM13833050

1. What is the big-O run-time of the following C++ function. It can be assumed that rand() runs in constant time (Show your work):

template <typename T>

void Foo (T a r r [ ] , int n)

{

for ( int i = n - 1 ; i > 0 ; --i )

{

int j = rand ( ) % i ;

T tmp = a r r [ j ] ;

a r r [ j ] = a r r [ i ] ;

a r r [ i ] = tmp ;

}
}

2. What is the big-O run-time of the following C++ function (Show your work):

template <typename T>

void Baz (T ar r , int n)

{

for ( int i = 0 ; i < n ; ++i )

{

for ( int j = i + 1 ; j < n ; ++j )

a r r [ i ] [ j ] = 0 ;

}

}

Reference no: EM13833050

Questions Cloud

Comprehensive functional behavioral assessment report : Develop and outline a comprehensive Functional Behavioral Assessment Report. The specific objective of your Functional Behavioral Assessment Report is to demonstrate synthesis of the course material related to FBA's as they have been presented in ..
Calculated field query and define a new field timespent : Calculated field query with table JOIN: Find the ticket numbers and the users submitted the tickets, for those tickets that take more than 5 days to resolve, define a new field TimeSpent, which is the time resolved minus the time ticket was submit..
Which term is used to describe these characteristics : Rita's mental representation for Halloween includes knowledge, beliefs, and expectations. Which term is used to describe these characteristics
Determine prevalence of clinical needamong adolescents : What is the level of agreement between a normative (clinical) assessment and a self-perception of orthodontic treatment need - The descriptive statistics and one regression model.
What is the big-o run-time of the c++ function : What is the big-O run-time of the following C++ function
What do you think should be required to obtain that license : If a license was required to become a parent, as suggest by David Lykken, what do you think should be required to obtain that license
Sports beverages should ideally contain : Sports beverages should ideally contain
Explain how would you define the term family and why : Explain how would you define the term "family" and why? Be sure to list the key elements necessary for a social group to be defined as a "family
Write a java application that calculates the internet cost : Write a java application that calculates and displays the internet cost and GST (10% Goods & Services Tax) for N customers. N should be declared as a constant and it should be equal to the largest digit of your student ID number.

Reviews

Write a Review

C/C++ Programming Questions & Answers

  Create program that uses functions and reference parameters

Create program that uses functions and reference parameters, and asks user for the outside temperature.

  Write a program using vectors and iterators

Write a program using vectors and iterators that allows a user to maintain a personal list of DVD titles

  Write the code required to analyse and display the data

Calculate and store the average for each row and column. Determine and store the values for the Average Map.

  Write a webservices application

Write a webservices application that does a simple four function calculator

  Iimplement a client-server of the game

Iimplement a client-server version of the rock-paper-scissors-lizard-Spock game.

  Model-view-controller

Explain Model-View-Controller paradigm

  Design a nested program

How many levels of nesting are there in this design?

  Convert celsius temperatures to fahrenheit temperatures

Write a C++ program that converts Celsius Temperatures to Fahrenheit Temperatures.

  Evaluate and output the value in the given base

Write C program that will input two values from the user that are a Value and a Base with which you will evaluate and output the Value in the given Base.

  Design a base class shape with virtual functions

Design a base class shape with virtual functions

  Implementation of classes

Implementation of classes Chart and BarChart. Class barChart chould display a simple textual representation of the data

  Technical paper: memory management

Technical Paper: Memory Management, The intent of this paper is to provide you with an in depth knowledge of how memory is used in executing, your programs and its critical support for applications.

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd