Can someone help me with this
Consider the Java program fragments given below. Assume that n, m, and k are non-negative ints and that the method e and f have the following characteristics:
The worst case running time for e(n,m,k) is O(1) and it returns a value between 1 and (n+m+k).
The worst case running time for f(n,m,k) is O(n+m).
Determine a tight, big oh expression for the worst-case running time of the following program fragment:
for (int i = 0; i < e (n, m, k); ++i)
f (n, 10, 0);
I think that the answer is (n+m+k)*O(1)*O(n+m)?
Am I right?
1 1575
Can someone help me with this
Consider the Java program fragments given below. Assume that n, m, and k are non-negative ints and that the method e and f have the following characteristics:
The worst case running time for e(n,m,k) is O(1) and it returns a value between 1 and (n+m+k).
The worst case running time for f(n,m,k) is O(n+m).
Determine a tight, big oh expression for the worst-case running time of the following program fragment:
for (int i = 0; i < e (n, m, k); ++i)
f (n, 10, 0);
I think that the answer is (n+m+k)*O(1)*O(n+m)?
Am I right?
how about (n+m+k)*O(1)*O(n+10)?
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ye Zhou |
last post by:
Hi all,
I am trying to convert a perl program into java and I got stuck in the
regular expression part. It seems like java.util.regex couldn't help
much. I checked with Apache regexp and didn't...
|
by: Phil Powell |
last post by:
<cfquery name="getAll" datasource="#request.dsn#">
SELECT U.userID, U.fname, U.lname, U.phone, U.lastLoggedIn,
U.choiceId, U.experience, T.label AS teamLabel, R.label AS
roleLabel
FROM User U...
|
by: Mark |
last post by:
Hi,
why oh why doesn't this work as per any other language I
have used regexes with;
--------
Regex r = new Regex("{2}");
bool test = r.IsMatch("ACD");
--------
The boolean 'test' is...
|
by: Oleg Paraschenko |
last post by:
Hello,
those who are still interested in "lisp vs xml" and "xml is a poor copy
of s-expressions" issues, might find my recent writings interesting:
Towards s-expression based XPath/XSLT...
|
by: bumwipe |
last post by:
I am trying to create a program that takes string expressions and solves them mathematically (i.e. string "5 + 4 * 2" will evaluate as 13). i have this much of the program made, but I am not sure...
|
by: =?Utf-8?B?RXJpY2E=?= |
last post by:
I am trying to dynamically create a javascript link. But, I get the following
error:
BC32017: Comma, ')', or a valid expression continuation expected.
Here is the line I try creating the...
|
by: Bloody Viking |
last post by:
Namaste, Y'all!
I've got a valid XQuery expression that I need to convert to XPath
2.0. This expression will be stored in a resource file and applied to
XML by a Java program with saxon8.jar...
|
by: rajesh619 |
last post by:
I'm new to programming. I have created a servlet which retrieves values from the database after a value is put into the HTML page to which it is attached. But during compilation, it shows two errors....
|
by: gimme_this_gimme_that |
last post by:
This may be so easy no one responds.
What is the XPath expression that fetches the value PPV - the
PersistentTicket?
The namespace thing is throwing me off.
Thanks.
<?xml version="1.0"...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
| |