2,040 Posted Topics

Member Avatar for gotto

And if it is between O(n) and O(n^2), you can use O(nlogn)... But watch out for O(cn) because it is the same as O(n)...

Member Avatar for gotto
0
397
Member Avatar for roachae
Member Avatar for i.nikei

I don't understand what the meaning of the value inside the array parenthesis? It looks like if there are more than 1 value inside the parenthesis, it is a table.

Member Avatar for NormR1
0
140
Member Avatar for ibthevivin

OK, I will simplify it into a mathematic equation for you (a little algebra but at the end it will become arithmatic). Look at the first line in main() `E e = new E(5);`, the value saved in the class will be a constant which will be used in computation …

Member Avatar for richard89AZ
0
255
Member Avatar for will.penfold.71
Member Avatar for jamesmadison43

You do not need to do any sorting before creating an ArrayList. You could simply read the data and try to insert the element at the correct location using add(index, E) to the array list. intArray <- an integer array arrayList <- an empty array list for each element of …

Member Avatar for jalpesh_007
0
303
Member Avatar for jalpesh_007

You simply copy the value of the aa5 to another new array before you put it in the temp. String[] aa5 = m1.get(key3); String[] newAA = new String[aa5.length]; // create a new array with the same length for(int i=0; i<aa5.length; i++) { newAA[i] = aa5[i]; } // copy each value …

Member Avatar for jalpesh_007
0
751
Member Avatar for delta_frost

Is it a [Combo box](http://docs.oracle.com/javase/tutorial/uiswing/components/combobox.html) class you are looking for?

Member Avatar for Taywin
0
121
Member Avatar for oneoderja

When you do a swap, you should not use the `for(int tmp : arr)` or any for-loop because it is ambiguous and won't work with many other cases. What you should do is to directly access the array using array indices. In your case, you have array size of 2 …

Member Avatar for Taywin
0
156
Member Avatar for jamesmadison43

Please start a new thread, don't hijack other's thread. To answer your question, it means that if 2 lists already have different sizes, it implies that both are not equal (return false). Therefore, you do not need to check each element equality at all. Otherwise, you need to check for …

Member Avatar for Taywin
0
178
Member Avatar for kiail

The indexOf() function for string or array returns -1 if not found, not an empty string or null... Your major issue should be with the browser is IE (not sure if the current version still has this problem) because it does not have the build-in indexOf() function. Is that what …

Member Avatar for Taywin
0
182
Member Avatar for rammiesteyn

>f(x : double) : double >post: return x > >integral(og : double, bg : double, step : double) : double >post : return (f(og) + f(og+stap) + … + f(bg)) * step Your function definition doesn't really make much sense. The f(x) function does nothing but returns the same value …

Member Avatar for rammiesteyn
0
265
Member Avatar for techyworld

If you are talking about using pure JavaScript to control audio level, I doublt it can because the language is not a audio player...

Member Avatar for techyworld
0
108
Member Avatar for sharonC

In your first code, take the code line 20 out and place it in line 24... Your method returns a correct number, but you are displaying a minimum number every time it gets change. In other words, the display doesn't affect the return value.

Member Avatar for NormR1
0
220
Member Avatar for RozenKristal

>can you explain what you did to make it work? Please read NormR1 link. The index range of an array can be from 0 up to n-1 where n is the size of the array. For example, array size 5 is declared as `int[] arr = new int[5];` will have …

Member Avatar for jamesmadison43
0
184
Member Avatar for zeroliken

It is obvious that you do not understand how internal database works. This may be a problem dealing with database because it is not exactly the same as programming. In SQL, there usually is a unique identification number (ID) created with a table (when someone creates a table), so that …

Member Avatar for Taywin
0
269
Member Avatar for yoganath

>college academic controlling all departments >i want new ideas to this project in java. How about let one department control all college academic? That would be a new idea. =)

Member Avatar for Taywin
0
96
Member Avatar for FUTURECompEng

I am confused about your approach to the minmax method. Are you trying to evaluate from each slot or from each column? Also, how do you come up with scoring (line 31)? The way you score right now always gives higher score to any odd columns. That's also the problem …

Member Avatar for Taywin
0
269
Member Avatar for code739

Assuming line break is between each name. 1)separate each name using line break delimiter ==> `A_LIST.split(/\r?\n/)` 2)separate each of the name using white spaces ==> `A_NAME.split(/\s+/)` 3)determine what to go using the size of array after splitting 3.1)If the array size is 1, it is the first name (and may …

Member Avatar for code739
0
174
Member Avatar for Lavanya1312

I'm not sure what you really want? Please give us some cases/examples that you want to test. Sometimes, you could use try/catch in the test. When certain values should not be there but it all the sudden gets to there, you could throw an exception. Then catch the exception in …

Member Avatar for JamesCherrill
0
334
Member Avatar for riahc3

Try to check where the delay is from by adding some println in various places, especially in your finally clause. Try to pin point where exactly is the cause and you should be able to handle that easier.

Member Avatar for Taywin
0
263
Member Avatar for crownedzero

Do you want to keep all as string or else? If they are all string, then in your constructor would be... String[] rowData; public recordRowObject(String[] data) { if (data==null) { throw new IllegalArgumentException("\nData cannot be null!"); } rowData = new String[data.length]; foreach(String s : data) { rowData[i] = s; } …

Member Avatar for Taywin
0
260
Member Avatar for cody.reddoor

You could do 2 ways, either pass in a string for concatenation and return it at the end, or return a built string plus its own at the end. If you are using a local variable, use it to concatenate with the return value from recursion call. To me, the …

Member Avatar for Taywin
0
283
Member Avatar for h0rryp0tter

Try a syntax error type of error in your code? Add something like `alert('intend to be error'` which would trigger the error of javascript somewhere in your script that it will get call while it is in the loop or so.

Member Avatar for Troy III
0
351
Member Avatar for gm.rupert

In your main class, create a GUI using JFrame and a JPanel to accept the inputs from a user. Once you are done with the input, compute and display it out to the same or another JPanel... A very simple JFrame with a button... import java.awt.*; import java.awt.event.*; import javax.swing.*; …

Member Avatar for NormR1
0
2K
Member Avatar for Huck44

It's your homework. Do some google and you should find the exact answers... Also, this is for you to think, not for you to ask for answers. <snip> PS: The format of the code is in C/C++. It is not Java.

Member Avatar for stultuske
0
122
Member Avatar for minnie.taylor.524

There is no nextString() for Scanner class ([API doc](http://docs.oracle.com/javase/6/docs/api/)). Use nextLine() or next(), but I prefer nextLine() though.

Member Avatar for Taywin
0
200
Member Avatar for sk8ergirl

The method name move() looks like it should be called setLocation() instead... To move, it should indicate the number of step moving to x axis and y axis, not assign the value to x and y... If you want it to really call move(), you need to add the incoming …

Member Avatar for NormR1
0
356
Member Avatar for laguardian

Line 26, you are assigning the *s* which is an object of Scanner class into an int[] datatype. Also, you are using a wrong index. You will get an array out of bound exception as well because array uses 0-index. In other words, an array size *n* will have indices …

Member Avatar for NormR1
0
1K
Member Avatar for Bremen Emeth

1)Line 3, the function must be getElement**s**ByTagName(...) 2)It is not a good idea to create your own customize tag in HTML. If you want a field, use **div** tag instead. 3)You could simply use getElementsByTagName("input") and work only those with type *radio* and the specific name. 4)The *visibility* attribute won't …

Member Avatar for Bremen Emeth
0
3K
Member Avatar for arjuna_wahid

Not sure about your sorting algorithm. In the algorithm ([WikiPedia](http://en.wikipedia.org/wiki/Insertion_sort)), it starts from a node right after the first one and compares the node value with the previous node value. In your algorithm, you starts from the head and compares the node value with the next node value...

Member Avatar for rubberman
0
1K
Member Avatar for O_mini

I am not sure that a newbie would understand what logic in solving a problem even though the problem is trivia... Anyway, the problem lies in the for-loop condition and how you need to break out of the loop to return a value. Let's talk about the loop first. You …

Member Avatar for Taywin
0
3K
Member Avatar for jalpesh_007

>Problem is at line 32, when i am putting value again in temp from m1, instead of value the location of value of m1 is also replaced. That is exactly what NormR1 said "there is a single object that is used as the value in both HashMaps [or are objects …

Member Avatar for NormR1
0
360
Member Avatar for s1lkman

1)Next time, **you need to ask the right question. Not just dump your code and expect others to look through for you**. 2)Your insert & remove methods definitions are exactly the same. The only method that has correct definition is the insertAtHead() method. The rest are wrong. 3)Now, ask the …

Member Avatar for Taywin
0
120
Member Avatar for Akira01

If the question asks for the whole program, then yes (O(3) == O(1)). Though, it is trivia if that is the question. If the problem is asking for the time complexity of the function, that will be a huge difference. The reason is that the function can go into an …

Member Avatar for Taywin
0
354
Member Avatar for Yarra

Well, how about look at this [link](http://docs.oracle.com/javase/tutorial/2d/geometry/primitives.html) to get start with drawing 2D curved lines?

Member Avatar for Taywin
0
110
Member Avatar for caswimmer2011

Or pass the value which you want to use in the loop inside to the recursive method. That way, the value will be updated every time you call. // i.e. public simpleRecursive(int val) { if (val>0) { for (int i=0; i<val; i++) { System.out.print(i+" "); } System.out.println(""); simpleRecursive(val-1); } } …

Member Avatar for Taywin
0
148
Member Avatar for regina.elmose

Line 14, you are assigning toString() value to the variable *animalName* instead of taking an input from a user. Change it to `input.nextLine()` to get an input from a user after the user press *Enter* key. Line 16, you are adding an empty Animal object (assuming that the Animal class …

Member Avatar for Taywin
0
571
Member Avatar for Hemanth.Satkuri

This is Java forum, not MySql... Anyway, you can use CURDATE(), DAYOFWEEK(DATE), and ADDDATE(DATE, NUMBER_OF_DAYS) functions to do what you want.

Member Avatar for Taywin
0
89
Member Avatar for riahc3

That's the root directory (where every directory is branched off, read this [intro to unix file system](http://www.december.com/unix/tutor/filesystem.html)). Why would you allow public to read/write the root directory? It is not Windows. What you may need to do is to allow access to a correct directory from the root, not the …

Member Avatar for riahc3
0
195
Member Avatar for gajoline.marascino

Because you use count++ in the if condition, you would confuse yourself. Think about what happen right after the condition? The count value is increased right after the comparison before throwing the exception statement. if (count++ == 0 ) Throw new ThreeException(); // is similar to... if (count==0) { count++; …

Member Avatar for gajoline.marascino
0
160
Member Avatar for ragonss

1)Your answer is somewhat correct. As nmaillet said, it is difficult to determine what it would be. Assume (or regardless) the *read number* will handle any invalid input in some way and will always return a valid input, your answer would be correct. 2)Let's see how modulo work. If -2 …

Member Avatar for Taywin
0
119
Member Avatar for niyasc

It depends on how you want to deal with and how each resource becomes available. I don't think there is an absolute algorithm to solve the problem due to so many factors are involved.

Member Avatar for Taywin
0
109
Member Avatar for silvercats

It is possible but not complete if you have another reference column... Let's say last name. Sort the last name column first, and sort the relationship column second (in the sorting list). The incomplete part is that the daughter who married another family may have her last name changed. That …

Member Avatar for Taywin
0
71
Member Avatar for Kunal Lakhani

If I understand you correctly, the program correctly works under GUI mode. But after your create .jar file for the program and runs it under command line, it doesn't work? Do you import any class that aren't in the standard libraries? If not, you may also need to correctly add …

Member Avatar for Taywin
0
316
Member Avatar for Hemanth.Satkuri

Can't pin point the exception cause by looking at that small piece of codes... Usually, it is from a loop that does not end properly. As a result, the program keeps creating references/objects in the memory. I used the word *references* because it includes more than just Java objects.

Member Avatar for JamesCherrill
0
185
Member Avatar for Hemanth.Satkuri

Not exactly sure what you want, but it looks possible. If you want a loading image to mask on top, you could simply overlay or place a component on top of what you want to prevent users to access. Once it is done, remove the component or replace it with …

Member Avatar for dmanw100
0
130
Member Avatar for code_r

You have a problem understanding scope of variables. Line 6, you call the function (lines 8~13) to compute the value of time. The function return a proper value but you did not store the value in any variable. Then, line 15, you attempt to use variable *time* which is not …

Member Avatar for theHop
0
210
Member Avatar for mikias.kidane.9

The problem is from your Line 6. You hard-coded the size of the array, and then use the value as the max limit of the for-loop. I guess that the *compiler optimization* of Java code changed the code to be a constant instead of keep checking for the array size. …

Member Avatar for Taywin
0
1K
Member Avatar for Matth963

I am guessing you are thinking that `h.username = l.username;` would automatically create a new String object from Login object and store in HomeworkFrame object. I believe that the value is disposed when you do dispose(). One way to try and see if that might be the cause is to …

Member Avatar for Taywin
0
2K

The End.