814 byte By
evanzsa at 2007-9-29 7:38:53
This is just out of curiosity, but have any of you ever try to code algorithms to go from a NDFA(Non-Deterministic Finite Automaton) into a DFA(Deterministic Finite Automaton), or I'de say those that define regular language?. What is that O (or even better, the Theta of it) of it? What about ...
Hey all, this is my first post here, so please bare with me. For the last week I have been tinkering with optimizing an algorithm to remove numbers from a randomly ordered input set and a base set such that after I remove them the two sets are identical. Currently I have a recursive solution ...
146 byte By
kerevia at 2007-9-29 7:43:02
Hi, someone can tell me what is the complexity of nextInt(int n) in class Random?I need the upper bound (Big O). is it O(1) ?
854 byte By
ahaweba at 2007-9-29 7:49:50
I've been sorting lists by throwing them into a TreeMap then retrieving them in order (especially for fairly evenly distributed lists of strings), thereby leveraging its binary tree characteristics.My belief is that sorting this way takes N log N time, just as quicksort (as in Arrays.sort) ...
if this is in the wrong section please move it.I'm very new to java and have been given a progect to do for college over the summer (no help from teachers :( )i have to create and print a random integer using:int randomInt(int min, int max)i have to do it using that, thats all ive been ...
Imagine a graphical class browser where the graph is generated from the source code and each class' interactions are connected by lines. (interaction could be inheritance, ownership, etc) In laying out plotting the class elements, the lines cross. i.e. (ascii art to the rescue!)AB- C \|/\ | /\ ...
490 byte By
kbw1022a at 2007-9-29 7:53:31
Hi,I am trying to write a recursive method that will show all the teams that can be created from a group (n things taken k at a time). For example, I may have a max group size of 26 letters {A to Z}. My input my be something like groupSize = 6 and teamSize = 3. I need to find all the possible ...
Hi all, I'm having trouble getting my head round how to translate some grid reference coordinates into screen coordinates including a scale. The three things i'd pass to the method would be something like thispublic int[] translateGridRef(int gridCoords[], int[] screenSize, int scale)Through ...
Does anyone know of a TSP algorithm that, instead of looping back to the origin, has 1 origin, a destination, and does a least cost route through the rest of the nodes? I would think there's some modification of nearest neighbor that takes "stragglers" into account as it ...
2076 byte By
plumonea at 2007-9-29 8:04:55
Hi,Does an algorithm such as this exist in Java?I have a byte array that has been populated after reading in a binary file. I would like to at a different specific points in the loaded byte array grab sets of bits.The algorithm would be something like thisStarting at element x in the byte array ...
Hey dude,I have a quick question on using a List.I want to store objects in a particular order:ex.list.add(2, object1);list.add(0, object2);list.add(1, object3);Then iterate through the list:(Object)list.get(i);/// returns object2, object3 and object1 based on the id in the add method.What's ...
Does anyone know a class that can use to implementing graph model?I want to use graph model in my program. Does java already have it?(PS. i also need help on Disjoint Set[what class ?]);My homework would be easier if i use java, isn't it?
Hi,I'm designing the data structures for representing simple undirected graphs in my application, and came across JGraphT http://jgrapht.sourceforge.net (it's also been mentioned in this forum).If there's anyone here who's used JGraphT, could I get some feedback on the scalability etc? I'm ...
I am trying to run sound through an algorithm, yet to be determined, and I need to move information from an input source run the algorithm, then out put it, the information will either be 8-bit , i know how to process this, or 16-bit signed, this I need to turn into a form that I can use, then ...
can anybody help me with comming up with an fft spectrum analysis of a sound, either byte array or file.
Hi, my question is about using hashcode. For example if i have got to String objects1 - apple = hashcode is 930292102 - pear = hashcode is 3436774class Teneke {public String a ;public String b ; public int hashCode() {return a.hashCode() + b.hashCode();}}public class BasitTest {public static ...
Hi, my question is about using hashcode. For example if i have got to String objects1 - apple = hashcode is 930292102 - pear = hashcode is 3436774total is 96465984Are they anyway to find that "apple=93029210" is in this total; like taking mod (%)Here is sample ...
Hi,In a real-time program which performance is the most critical factor, what is the best idea for tracing and debugging the program execution.Thanks,S.
Hello, I have an entity WHOLE(PERSON) which contains one or more PART entities(CONTACTS, ROLE, etc...). The user can update any of this entity. To find out what are the entities that user updated I remember using the logic like giving a number to each entity WHOLE ENTITY 1 PART ENTITY1 2 PART ...
191 byte By
asjfa at 2007-9-29 9:23:28
hi, if I have two points Point2D.Double p; Point2D.Double q; how do you find the angle between them (measured from a vertical bar)?thanks,asjf
Hello All,I have two arrays with meProducer arrayP1,P2,P3,P4,P5...PnConsumer arrayC1,C2,C3,C4,C5...CnLet us take arrays having 5 elementsP1 P2 P3 P4 P51 2 3 4 5C1 C2 C3 C4 C554 3 2 1The output should beResult1(P1,C5),(P2,C4),(P3,C3),(P4,C2),(P5,C1).Results ...
Hi,I have a number of small texts, say 100-1000 bytes. They contain similar kind of texts and if I zip with all of them together it gives excellent compression. However, I need to zip them 1 by 1, since I will later access only one of them and I don't want to fetch all texts, I only need one. ...
Hello All,I have two arrays with meProducer arrayP1,P2,P3,P4,P5...PnConsumer arrayC1,C2,C3,C4,C5...CnLet us take arrays having 5 elementsP1 P2 P3 P4 P51 2 3 4 5C1 C2 C3 C4 C55 4 3 2 1P1 P2 P3 P4 P51 2 3 4 5C1 C2 C3 C4 C55 4 3 2 1The output should ...
I'm looking for an algorithm to generate a license key from a person's name. I've been searching these forums and the web all day but haven't come up with much.Can you give me any ideas?Thanks,Philip
I have a problem which is so simply stated it seems that it must be a classic, but I don't recognise it as one. Can anyone point me in the right direction?Given:Set SSet Zs = {0, |S| - 1}Symmetric function f : S x S -> N (or R if you prefer)Symmetric function g: Zs x Zs -> N ...
702 byte By
detlya at 2007-9-29 10:24:05
I wanted to seek people's advice on using Java for simulation of physical/numerical processes, for example (but not only), Monte Carlo simulations. Are there any distinct advantages/disadvantages in using Java over, say, Fortran, C++ or other, more common (indeed, more "acceptable") languages ...
I have written a method using the Pattern class to capitilize the first letter in every word but isnt very sophisticated. For example it breaks words at apostrophe boundaries creating two words from one.I was wondering if anyone had written a more sophisticated method I could steal .I was also ...
Hello!Here is my problem:I have n squares. For every i in the set {1,...,n} the square s_i has the next properties:- the length of its edge is a_i- the coordinates of its bottom left point are x_i and y_i and they are greater than 0.What is the area covered by this squares ?I would like an ...
286 byte By
xyqa at 2007-9-29 10:41:05
Hello friendsI want to print this diamond shape by using nested for structures**** ***** ******* ********* ******* *********How do I get started ?Does anyone have sample codes ?Thank you !
273 byte By
tlozinaa at 2007-9-29 10:42:33
I need advice on how to go about drawing a DAG (directional acyclic graph). Alot of stuff on the Internet about traversing a DAG and analyzing a DAG but I couldn't find any info about a algorithm to actually draw the graph. Anyone know any resources that can help ?
Hi.I have 2 program.First program is to open and choose the file to run so it will display the choosen file's path and filename and most importantly - its results on a Window.Second program is design to run an external file e.g. music.mpeg and count number of services inside this file.Question ...
276 byte By
b00gera at 2007-9-29 10:55:23
Hi everyone, I wanted to know if you could help me conver the following DOS code to its Java equivalent. Thanks in advance for any help...<code>for %%i in (*.crd) do call ..\run-xalan %%1 ..\MapToDeconflictor.xslt ..\goodxmls\%%1</code>
I'm working in a programa that have to read PDFs to extract some data.Till this moment i've extracted the text objects with the size, font, text and position (x1,y1,x2,y2). After that the program recognizes text blocks and achieve again its position.The document can have 1,2 or 3 columns and ...
I would need an invers sinus function but i couldn't find anything about it in lang.Math..Or did i miss something?regards
Hi,I am trying to create recursive method for ternary knapsack problem.Int n - (number of items I could take,leave or take 2) is 1<=n<=14.The output should be exactly:ex:0000 0 00001 5 100002 3 8 .. Where 1st colomn represents items I took,and 2nd and 3rd colomns are some values ...
Hello!Is there an algo to solve the position of the tangent points and circle center between two given lines?ThanksMaelvon
157 byte By
feleexa at 2007-9-29 11:11:11
Hi !I have a matrix 11x11 and I need a 2D Guassian Fitting algorithm !Does anyone know where i could find one ?ThanksFelix
Hi! There is such problem: on mouse click on the certain picture, it is necessary to distinguish in what area of a picture have got ( transparent or color ). Whether there is a ready decision of this problem? Clearly, what it is necessary to receive bitmap a picture and to address to parameter ...
586 byte By
RGbeana at 2007-9-29 11:16:57
I'm working on a equation parser (using recursion).I'm getting a stack over flow error on the first recursive call by making with parameters consiting of only:1) 1 TreeNode containing a very short string2) 1 ArrayList containing only 1 element at that time.Now I'm confused about how stack ...
Hello All,I need to write a program to accomplish this.if we have a set of Producers and a set of ConsumersegP1 P2 P3 P4 P55 67 8 9C1 C2 C3 C4 C51 34 21As a first step I need to find out the all the sets of {Pi,Ci} where Pi >= Ci and store them.I am not supposed to use arrays or any data ...
Hello All,We have two sets A={1,2,3,4,5,6}B={5,6,7,8,9}I am not sure if this is B * A with condition Bi<=Aieg :Answer needed is(5,1),(5,2),(5,3),(5,4),(5,5)(6,1),(6,2).....(6,6)(7,1)....(8,1)...(9,1)...The sets could be as long as the user wants.In case there are no pairs that satisfy the ...
Hello All,We have two sets A={1,2,3,4,5,6}B={5,6,7,8,9}I am not sure if this is B * A with condition Bi<=Aieg :Answer needed is(5,1),(5,2),(5,3),(5,4),(5,5)(6,1),(6,2).....(6,6)(7,1)....(8,1)...(9,1)...The sets could be as long as the user wants.In case there are no pairs that satisfy the ...
Hello All,This is the problem I am stuck with right now.I have two array lists one producer array list and one consumer array list denoted by a and bP1 P2 P3 P4 P55 6 78 9C1 C2 C3 C4 C52 3 45 6Now we find all those producer consumer pairs which satisfy the criteria Pi>=CiWe have the ...
Hello All,This is the problem I am stuck with right now.I have two array lists one producer array list and one consumer array list denoted by a and bP1 P2 P3 P4 P55 6 7 8 9C1 C2 C3 C4 C52 3 4 5 6Now we find all those producer consumer pairs which satisfy the criteria Pi>=CiWe have the ...
I have a simple binary search tree and was wondering if anyone had a good algorithm to determine the number of levels the tree has.thanks
Hi! Can any one help me to progam K-number Running Average in java? A K-number running average of is the arithmetic average of the last K values in the list. When a new item is inserted in the list, a new running average is recomputed on the last K values. examples of 6-number running average: ...
I have difficulty solving the following problems:A vending machine must be able to determine a way of returning the change. In order to do so, one must be able to find the number of different ways to give exactly K cents in change. Please write a program using recursion to find such a number. ...
Hi, I am trying to implement depth-first algorithm.(directed graph, no loops). Here what I have so far.//form a one-element stack with the root node.Stack st=new st(); boolean goalflg=false; st.push(?)//do I need to clone the value from the tree, if yes, how can I do this? Should it be a ...
Can anyone helps me on this program? Each term of a Fibonacci sequence is defined to be the sum of the previous two terms of the sequence, where the first two terms are intialized to 1. For instance, x0 = x1 = 1 (first two terms)x2 = x1+x0 = 2 (third term)x3 = x2+x1 = 3 (fourth term)x4 = x3+x2 ...
HiI'm currently using Karel the Robot. I have a problem where Karel has to retrieve a beeper at the west wall and return to the corner on which it started. I have to use recursion - no iteration. I also cannot use instance variables( so I can't use an index to know how far the robot is to ...