473,395 Members | 1,652 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

Big Oh Expression in Java

1
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?
Nov 4 '06 #1
1 1575
r035198x
13,262 8TB
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)?
Nov 6 '06 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

1
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...
12
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...
6
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...
1
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...
3
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...
4
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...
3
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...
4
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....
4
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"...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
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...
0
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...
0
BarryA
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
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...
0
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...
0
Oralloy
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,...
0
jinu1996
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...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.