How to implement the shaker sort?
468 byte By
Brannos at 2007-9-30 7:31:44
Hello,I remember people used to say dont define your attributes public. Have them private and write getter and setter public methods to access those attributes from outside the class. I've been doing this all the time. But now it's time to know why ;-) What's the difference between this ...
I have the following problem to solve, and I hope some kind person has some ideas about how best to tackle this. I have n sets of numbers, each of which can be an arbitrary size, and the problem is simply this: obtain a list of k numbers which appear in the collection of sets most often, ...
3832 byte By
asjf at 2007-9-30 7:36:15
hi, JAXB is a tool that takes an XML schema, and generates java classes so that you can manipulate object trees directly rather than through a generalized API like DOM.eg for a simple XML file like<PETS><PET name="fido" smell="stinking"><NOTES> fido is ...
hello i have a 3D quadrilateral and a 3D line ,now i want to find the point of intersection of line and this quadrilateral and to check wheather this point of intersection lies insde the quadrilateral or not . how to do this, i found the point of inersection by taking the quadrilaral as plane ...
705 byte By
payner35 at 2007-9-30 7:57:51
Hey all. Big of a tricky question to explain, but ill do my best!I have 4 sliders, all initialized to 25 (max 100).I want all of the sliders to work in proportion to each other. If slider 1 is increased by 30 then each of the other 3 sliders is decreased by a value of 10. Etc...The sum of the ...
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.This particular application is working fine on IE with LAN connection. In this servlet, ...
4163 byte By
JosAH at 2007-9-30 8:11:21
I've been playing a bit lately with the classic "Cutting Stock" problem.The basic problem runs like this -- suppose there's an infinite amountof one dimensional stock; think of steel pipes, rolls of paper etc. etc.There's a finite order set, i.e. so and so many pipes of length such andsuch ...
Hey everyone, I have been looking around for information on the A* algorithm. I understand what it is, but I would like to see some actual code, if possible, or some tutoril / more information on it. The information I have seen is for C#.Basically, in my app I have a bunch of 2D icons on a ...
Hello,I need write a thread to copy new files from a specific directory to another directory. Could you tell me how I can monitor the files in the directory and fire up the copy thread when the files are there? Codes..Thanks in advance!Marks
721 byte By
dvst8ive at 2007-9-30 8:12:19
let's say i have a graph with 3 vertices. then let's say i have 2 edges connecting vertex 1 (v1) with vertex 2 (v2), and there's one edge connecting v2 with vertex 3 (v3). i want only to print edges going to each vertex, not 'back' edges. how do i do that?//given - Graph 'g'Iterator it = ...
702 byte By
qsyph at 2007-9-30 8:22:27
I've pretty much finished my algorthim, it's all set, finally done... however I have no idea how to test it from a file of 200000 pairs of numbers.In my graph deffinition I state the following:for (StringTokenizer t = new StringTokenizer(edgeListStr, ","); t.MoreTokens() ; ) {String str = ...
Hi,For a chromosome it will be represent as 1010101011. In implementation to code, 1010101011 should be a bit string or in array?
1042 byte By
rkippen at 2007-9-30 8:28:54
Should the Cubic B-spline and the B-Spline with degree = 3 produce the same curve? Initially, I thought they should, however the results are not the same.Here is the middle section blending function that defines the cubic B-spline: b[0] = u3 / 6;b[1] = t3 / 2 - t2 + 2.0 / 3;b[2] = (-t3 + t2 + ...
Hi...I have to simulate a one bit ALU in GUI. Its for a a project, and I am really stuck. I'm kind of a newbie.Does anyone have a program I can look at?Thanks a lot.
667 byte By
dbayoj at 2007-9-30 8:32:45
Hi,I have to develop an algorithm that calculates the distance between two points (Point2D) avoiding any area (Polygons). If between the two points there is no area, it's very easy (Pithagoras). But, how can I know what is the shortest path (always exists two paths like the figure) ?. I always ...
587 byte By
payner35 at 2007-9-30 8:34:09
Hey all..I want to make a random generator, which will pick a random object from a vector. Each object in the vector has been assigned a weighted INT value between 1 -> 100.I want the generator to distribute the generated choices: to pick more values that have been set with a higher weight ...
hi everybody,i have an image.here i want to zoom that image.in this case suppose i clicked on a point. (say 20,30).then i have to zoom it.so now the selected point does not belong to (20,30)but i want that coordinates to reamin the same as before zooming.how can we achive this.pls help ...
378 byte By
mseele at 2007-9-30 8:50:21
hi,i need a algorithm which random a sequence of numbers(0 - n) like this:given sequence : 0,1,2,3,4,5,6,7,8,9random result:2,4,7,1,3,0,8,6,9,5given sequence : 0,1,2,3,4,5,6,7,8,9random result:9,4,1,0,5,3,6,8,2,7....how can i get this with a minimal cpu-cost? is there a good method for my ...
hi,i have a map(image) of some land.first we have to identify the objects on the land(houses)then i hava a mecanism to get bounded rectangle for that object.then we hava to generate id for that rectangle.because 2 objects can not have same rectangle.so it is unique.now a days i am thinking ...
Hi,I have a problem which i would like to see solved. I'm breaking heads over this problem for over 5 hours already, and because i'm not a mathematician i cannot find the solution.I have a function like this:public int faculty (int number) {return (number == 1) ? 1 : number * faculty(number - ...
1061 byte By
jim.cp at 2007-9-30 9:00:21
I am looking for internet resources that would help me find pointers to the mathematical foundations of common programming problems. As I am not a mathematician I lack the overview of the core topics in mathematics and how they relate to computer sciences.For example if I want to design a new ...
423 byte By
tnguyen at 2007-9-30 9:03:12
This was a simple algorithm taught in Discrete Math (which i learned and forgot...many years ago)what I want to find out is the total number of possibility for the followingA B Cresult inA BCABBCACABCwhich the total is 7now suppose it's ABCD or ABCDE or ABCDEFGHIJKLMNOPi need to know the ...
534 byte By
volenin at 2007-9-30 9:04:21
Hi everyone,If anyone here is interested in approximate string search algorithms, take a look at this prototype: http://scientechs.com/servlet/smartsearch.test.ApproxiMatchServlet . Keyword DB was compiled from the list of canadian business names and has right now ~200K of words, so don't ...
Hi,My task is to find a string(name) in an array-base data structure with the following restriction: if name starts with C, then the algorithm should only have to look through the entries in the data structure that starts with C, etc.I'm trying to set up a data structure such that most of the ...
1225 byte By
asjf at 2007-9-30 9:11:59
hi, I have a situation where I need to generate a hashCode for a list of 4 + 2n Strings where n>=0At the moment I simple do something likeint hashCode = 0;for(Iterator i = list.iterator(); i.hasNext(); ) {hashCode += ((String)i.next()).hashCode();}and it works because the contract for ...
local directory is defined as the one that's running the .class file.Thanks!
494 byte By
reikster at 2007-9-30 9:21:48
hi. iam running a website built with java/jsp that includes a fulltext search. now in the logs i see thatpeople search for "shoes" but in the database the entries are kept as "shoe". I was wondering if therewas any library I could use that adds fuzzy logic, by "generating" similar words from a ...
172 byte By
mseele at 2007-9-30 9:25:17
hi,does somebody know a good, fast and easy algorithmus how to layout different (size) rectangles into the best order with minimum space?thanks!
Hi,I'm not too sure about the implementation of Vector in Java. Currently, this is what think:Vector.remove(0) - this is O(n), because you have to shift all the following elements upVector.remove(size-1) - this is O(1), because you don't have to do anything elseIs this correct?ThanksFeng ...
Hi all,I need a function to calculate a CRC16 according V.41 of ITU (CCITT). I have found a lot of algorithms in C but no one in Java.Mi first question is, is it true that for "123456789" entry data the CRC16-CCITT it's "29B1"? I have different results from different C algorithms but the only ...
475 byte By
paulpkh at 2007-9-30 9:35:52
Hi all,Does anyone knows why the following happen when i add 1 year to 29 Feb 2004 ?29 Feb 2004 becomes 28 Feb 2005.Should not it be 1 Mar 2005 ?The codes are as follows :GregorianCalendar gc = new GregorianCalendar();gc.setTime (oldDate);gc.add (Calendar.YEAR, 1);Whereas for other days like 5 ...
1311 byte By
jim.cp at 2007-9-30 9:37:59
A META question ;-) My question is...: Where to post a question like this? Where are the chances to get some quality advice best? I haven't got a clue about the subject... What is my 'problem' ?I have a collection of > 100 Java books in e-formats like CHM, HTML and PDF. I want to be able ...
160 byte By
p-g at 2007-9-30 9:46:49
Does anyone know simplex implementation in Java ?I need working, documented and free one.Thanks for reply in advancePG
Hi all,After going through the threads in the forum abour combinatorics many of my problems were solved. But i had a few questions, and that is why the new thread.The earlier threads talk about specific combinations like 42,6 etc meaning out of a pool of 42 numbers finding all possible subsets ...
Hi,The following is the BookingSystem class: public class BookingSystem{ int n; Resource[] resources; //- //constructor public BookingSystem(int n) {this.n = n;resources = new Resource[n];for (int i = 0; i < n; i++){resources[i] = new Resource[n];} } //-- public boolean book (int bookerId, ...
Hi, Let me try explaining once again, the way you had said, and i would simplify a bit.L = {1,2,3,4}M = {1,2}, {1,3}, {2,4} etc, all the combinaions of the above values. -- this part is simple combinations - i have a program which works, but is not the best one.. so any ideas coul be ...
This isn't really a Java question, but...Continuing fractions -- has anyone ever experimented with using implementing arithmetic operations on computers with continuing fractions? It would seem to provide a more way to represent most rationals quite compactly, and to represent irrationals ...
Hi AllI have this problem. The maximum no. of combinations of n items taking none or all items at a time is 2^n.so say I have 5 records so max combinations possible is 2^5 = 32. but the issue is that how to write code to generate all possible combinations for n records. ...
Hi,I am working on a project in which I have to create random numbers in 8 digits daily and I have to ensurethat numbers created today are different from previous day's numbers without comparing with pre. daysnumbers(numbers are being created in large block e.g 25000).How to make sure numbers ...
Hello, I have just begun starting to look at some algorithms and I am finding it very hard to understand them, I wondering can someone give me some help. I am a good java programmer but I dont understand whats going on.Here is an alogrithm I have:Turn: Integer Range 1..2... :=1;task body P1 is ...
We are lookin' for an algorithm that permits to create a combination of matches like a soccer league calendar. (not home, away, only home)Example for 4 teamsTeams: A B C DTurn1: AB CDTurn2: AC BDTurn3: AD BC
Hi All,i was using this particular program, which i got from forum, and i am having some problems with it. The program caculates all the partitions of a char string, with each character as a different element. But when there are more that 6 chars in the string the program output shows nothing. ...
927 byte By
geranm at 2007-9-30 10:41:15
I need to get all the hyper links on a webpage, I use this code but it dont work 100%public void parseLinks(){String A = "([Hh][Rr][Ee][Ff]\\s*=\\s*\")";String B = "(?!#|[Hh]ttp|[Mm]ailto|.cgi|.css)";String C = "(.*)";String D = "(\\s*\")";String exp = A+B+C+D;Pattern p = ...
I'm learning Trie and I want a quick start. Any good link?I have a choice to implement a Trie data structure using either reference-base ADT or index-base ADT. Which one is more efficient and which one is easier to implement?I'm suppose to insert new entry into my trie. However, an optional ...
Hello all.I have been having some trouble with developing and algorithm that will detect down a line in a 2 dimensional array of integer values.For example, when a player has the line vertically down, ie rectsel[0][0] all the way to rectsel[0][5], and they all equal a certain variable that ...
317 byte By
rsvjava at 2007-9-30 10:56:56
HiWe were asked to develop a web application using technologies like Java,JSP,Servlet,MySQL,Tomcat Server using MVC Architecture. Any idea from where we can get information on how to go about on this. What I mean is some web sites where the approach to MVC architecture is explained.thanks ...
415 byte By
rsvjava at 2007-9-30 10:56:57
HiWe were asked to develop a web application using technologies like Java,JSP,Servlet,MySQL,Tomcat Server using MVC Architecture. We all have experience in the above technologies, but don't have much idea on MVC(design issues).Any idea from where we can get information on how to go about on ...
i have an finite element mesh ,i constucuted a bounding box which passes through the mesh ,so now i want to detect the edge of the rectangle which intersects the mesh and construct a new mesh which resides in the rectangular box.how to do this.any kind of help is appreciated.P/\Q / \A |- ...
316 byte By
sabre150 at 2007-9-30 10:59:43
Somewhere in one of the forums I have seen a link to the web page of a group involved it trying to provide code for the evaluation of transcendental functions as accuately as possible. I have searched the forums and used Google but I have been unable to find the page. Can anyone point me to it? ...