Can someone give me the answere to this question:An array contains N numbers and you want to determine whether two of the numbers sum to a given number K. For example,if the input is 8,4,1,6 and K is 10,the answere is yes(4 and 6).A number may be used twice. Give an O(NlogN)algorithm to solve ...
hi, everyone, I'm implementing AI to a little board game using alpha-beta, the one below seems to be the standard and best one I found so far.Basically, I'm using Vector to store each Move, and each Move are represented by two Points, Move(from, to), where each point has the two integer: ...
197 byte By
AndyJoel at 2007-9-30 5:09:10
Say I have an equation with two or three variables, y = f(x,y,z), and I want to find the values of those variables for which y is a minimum, how do I do it? Any ideas?AJ
248 byte By
asjf at 2007-9-30 5:10:41
hi, does anyone know (or of any links that talk about) where java/perl (they are the same?) regular expressions fit in the chomsky hierachy (and which operators take them out of the regular languages?)?thanks,asjf
7538 byte By
Techno1 at 2007-9-30 5:15:33
hi there. for some calculation i am getting the answer as 0. i kinda know why but do not know how to sort it out.calcs like:3 * 1 - 2 + 1gives me 0i have the entire code zipped up but not going to put a link here for obvious reasons (ppl trying to copy or ppl thinking im giving the answer when ...
46 byte By
UlrikaJ at 2007-9-30 5:16:18
http://www.nist.gov/dads/
I need to provide a user-friendly interface for string substitution. If you don't care about what the requirements are and want to get directly to what my question is, skip down to the bolded "Performance Issue" and "Question" listed below.RequirementsSpecifically, given a String s that ...
1103 byte By
Techno1 at 2007-9-30 5:33:36
hmfor some reason im getting an empty stack exception. im trying to make the program work with brackets.basically, if a ( is occured (this is my logic, re thought 4 times or more), then push to stack do whatever else...like push other operators on stack if token is a ) then:while the stack does ...
412 byte By
sam2004 at 2007-9-30 5:36:11
Hi,im doing image compression techniques for my final year project and desperatly need some code written in java to compress a image file using the huffman code. im using the BufferedImage class to store the image (jpeg) and need a a bit more code to do the huffman coding! i have tried most ...
1071 byte By
vishnura at 2007-9-30 5:40:07
Hi, I having problems justifying the need for a database for my system and was wondering if you could criticise my methods. Basically i have a database storing data about the nodes and edges as well as adjacency information.It does not seem practical to me to keep querying the database for this ...
528 byte By
David78 at 2007-9-30 5:40:45
Hi guys,I am involved in a work that deals with job shop scheduling of some 2 stage process. Does anyone has any idea if there are ready made commercial / free API available for such purpose.I am consider the use of genetic algorithm to do the job if no such API is available. Would appreciate ...
Hi,I would like to know why is Long objects are not cached internally and pooled in Java. Since Long objects are immutable there shouldn't be any problem in doing this right? Let me know am I missing anything here...Currently for one of my applications Iam planning to do this caching of Long ...
570 byte By
hkurt at 2007-9-30 5:50:08
Hi everybody!Can you help me?I need to write such thing:for example, I jave array:1,2,3,4....n.I need to get ALL variants of these numbers, that in summing = n.Sorry, for my bad English - I'm Russian, I'll try to explain:for example, I have:1,2,3So all variants are:1,1,1 (1+1+1=3)1,2 ...
Hi,I am using servlets on Unix/Tomcat server. I am getting a 'Page Not Found' error on IE only (it works fine on Netscape) in one of the servlet applications for 'dial up' and 'cable modem' connection. There is no error, if you let it sit there for a while and try it again.This particular ...
86 byte By
IanYoung at 2007-9-30 5:55:54
thank you!!my oicq=123348292Email:kenjysn@std.uestc.edu.cn
100 byte By
asjf at 2007-9-30 5:57:02
just for interests sake :) http://research.microsoft.com/~nick/polyphony/
Hi,Someone know an compression Algorithms that compress more that GZIP. I need use from my program. I like use LZWA or LZW9 but I need an implementation easy to use in Java.It is possible LZWAInputStream o LZWAOutputStream (similar to GZIp..) or an encode decode for bytes[]Than in avance. ...
Part of some code is listed below. Using such an iterative algorithm, how would one prevent totalNo = number if n is 0 (zero)? In other words totalNo should be zero if n is zero. public static double someMethod(int n, double t) {totalNo = number;for (int i = 1; i < n; i++)totalNo *= ...
129 byte By
jstillha at 2007-9-30 6:03:21
What is a Iterator ( Iterator Class ) doing with a Tree? How does the Iterator know the order of the Childs?
157 byte By
keratox at 2007-9-30 6:06:35
How do I do to find each combinations of a words?Example:"bye"byebeyybeyebebyeyb
if i want to fill a triangle what is the more eficient algorithm to do that?I dont want to use the API, so anyone can give an simple ideia to do that?
Just confirming that the below is a true iterative algorithmpublic static double someMethod(int n, double t){ if (n==0) {totalNo = n; } else {totalNo = number;for (int i = 1; i < n; i++)totalNo *= somePercentage; } return totalNo;} Recursive algorithms differ in the fact that they make a ...
4550 byte By
Techno1 at 2007-9-30 6:18:17
hithought i had this sorted out but guess i didnt - which annoys me alot. i think i have done it right but for some reason its wrong. a calc like://( 4 * 2 ) * ( 2 * 2 ) - 30 / 4 + 2// 4 - 1 + ( 3 * 10 + 5 / 2 ) / 6 a: 3.41//( 4 * 5 / 2 ) + 7 - 4 * ( 5 + 9 ) - 1:34.8125//( 5 + 5 - 1 * 3 ) + ...
public static double calculateTotal(int n, double total) {if (n == 0)return 0;else{grandTotal = total;if (n == 1)return grandTotal;elsereturn grandTotal = (dailyTot * addAmount)*calculateTotal(n-1, grandTotal);} } Is this a true recursive algorithm. I have my doubts as the second part (see ...
Is there a standard algorithm that has been devised for inserting objects into an array. The java code is not required, this I understand, but the notation for doing the insertion. Is the notation and algorithm below correct? If it is required to insert staff by surname, how is this ...
Do I have to do the undomove same as makeMove, or just remove the element from the vector: While(v.hasMoreElements())? acutally I have tried both, but it still not working as long as I put depth on, it is ok for 0 deoth. could some one help me and explain how the makeMove and UnmakeMove works ...
i have some points (three dimensional ) randomly located, now i took a bounding box for these points, so i have all points in a box now, and suppose now i take another one point outside the bounding box, now i want to find the nearest neigbhor of this point from the set of points in the ...
Help needed on devising an algorithm for inserting objects of type Staff into an array. The java code is not required, just the actual algorithm itself in correct notation.Regards
332 byte By
asjf at 2007-9-30 6:28:32
hi, i keep bumping into people who talk about co-routines? does anyone know if there is any difference between this and a thread (internet definitions don't seem to suggest so..), if there is no difference is this just a historical term? is it tied to any particular ...
605 byte By
SachD at 2007-9-30 6:29:39
Hi everybody,I was wondering if anyone could help me out on how i should go about solving this problem.I have a given set of non scheduled sports activities and i need to schedule them into a timetable in an optimal way that takes into account the staff constraints.The timetable structure ...
hi ya i have created an iterative algorythm to calculate a fine in an "ADT loan". I have to calculate e fine on a certain amount for loans overdueAssuming a charge of 2% per day the algorythm should be this:td=today's datedd=dueDatepublic CalculateFines{}Gregorian Calendar today= new Gregorian ...
2032 byte By
Scott84 at 2007-9-30 6:40:30
Even if I input 11111111111 or some funny numbers, it will output as valid, does anyone know why? Thanks.public void checkCc(){String checkCCNum=checkCcNum.getText(); int totalSum=0;int totalEven=0;int totalOdd=0; int even;int odd; String temp; for (int i=0;i<checkCCNum.length();i=i+2){temp ...
So, I am taking an intro java course and I am having a little difficulty with this question: The file Squeezeros.java contains an application for testing a method that "squeezes the zeros" out of an integer array. That is, it shifts all nonzero elements of the array down so that the zeros are ...
I kind of feel like this is an abuse of the forum, but i don't know anyone that is good with programming, so i have no where else to turn (I am a Mechanical Engineering major, so if anyone ever needs help along those lines let me know). So, here is the deal: I need to write a recursive ...
hi, i am just wondering how i can access the value of a variable that i declared in a public class from a private routine. i had my code here, i want to access "line" (String) in the public class "Life" from the private function "position". i created a life1 object that belongs to Life class, ...
hi, i am just wondering how i can access the value of a variable that i declared in a public class from a private routine. i had my code here, i want to access "line" (String) in the public class "Life" from the private function "position". i created a life1 object that belongs to Life class, ...
Hi,I would like a tip (algorithm or code) on how to achieve this:When a user changes passwords make sure that they are really different that the previous passwords. To check if they are exactly the same is easy, but how about checking if they are almost the same e.g.Old passwordPassword0New ...
997 byte By
mathuoa at 2007-9-30 6:55:25
Hi, After googling about "Java + BLAS" i found a dozen of BLAS impementations in Java. 1. Do you know which of them are "good" enough? Most of them were updated for last time before 2000. 2.Is there any package providing BLAS methods (even a subset of BLAS) which guarantees forward ...
182 byte By
sam_hoff at 2007-9-30 6:55:47
I learned, that mergesort is O(n log n),now, java before when creating new arrays places 0s/nulls into each slot; would that not make the algorithm O(n^2 log n)?
Hello,I am looking for an algorithm to find the contours of a map when I only have a pixel within it. Let me explain this better. My program loads a gif-file that contains a map of a country, subdivided in its regions, in black and white. Based upon other parameters sometimes one or more ...
544 byte By
JayTanna at 2007-9-30 7:01:35
Hi everybody,I have been given set of non scheduled sports activities and i need to schedule them into a timetable in an optimal way that takes into account the staff constraints.The timetable structure should be an array within an array.I need help on how to create this data structure and an ...
1617 byte By
NiLOSTEP at 2007-9-30 7:02:30
I have to implement a tree with linked items. But there is something for which I can't find a solution. Le me explain in abstract manner. I have a tree and a list.TreeRootABCDEFGHListItem 1Item 2..Item NThis is what makes it difficult ( for me anyway ) ...if item 1 is assigned to some node it ...
1411 byte By
mathuoa at 2007-9-30 7:07:00
Hi, Is there any (noticable) difference between A and B? public LargeObject a(){return b();} public LargeObject b(){return c();} public LargeObject c(){return d();} public LargeObject d() {return new LargeObject();} A.....LargeObject lo=d();.... B.....LargeObject lo=a();....I believe that ...
341 byte By
raahulm at 2007-9-30 7:08:41
I'm trying to decode some Jpegs that i receive from a LAN (IP) camera. It seems to me that JPEGS from different camera's are organised differently in terms of headers and quantization tables .. etc Can anyone direct me to a generic implementation of the JPEG decoding algorithm . Thanx-R ...
113 byte By
szhnaqvi at 2007-9-30 7:14:26
I can easily manage simple string search in single file. But how to search a string in many files?
hi,i have 4 coordinates [(x1,y1),(x2,y2),(x3,y3),x4,y4)] of a rectangle.then i have to generate a unique ID for this recangle using this coordinates.finally by decrypting that ID we shold be able to retreive original coordinates.IF you can pls help methanks, regards,kelum ...
448 byte By
Jodival at 2007-9-30 7:21:26
Finding an effective and memory saving ways to reorder an ArrayList.a = an object arraylist(1) The simpliest wayproduces a new arraylist a' with same size as a and bases on a factor in the object in a to determine the ordering and then put the result into a' one by one. Finally, return a' as ...
The task i need to do is as follows. A User will input a single character. This method would take the Char and convert it to its Ascii Decimal equivilet. I am Stuck on how to do this?!?! so far i have this public int convert();{char tempChar;System.out.print("enter your ascii value");//MyInput. ...
578 byte By
asgshe at 2007-9-30 7:25:17
Hi I have an Array that has x amount of rows. The Array has value long. I want to search the Array to see if two longs are the same. If they are the same, I want to display these in a specific way. i.e if two longs are found I would like to do this:(printout of the Array)140000100001000Found ...
451 byte By
csbham at 2007-9-30 7:26:09
Consider two improvement for Quicksort.1. Chose a better pivot so that it never has just 1 key in a partition.2. Only call the recursion when the array having length >16 (or greater).The question is: do these improvement change the worst case and average-case complexities of the algorithm ...