This is a complete Java program doing this:
class X {
public static void main(String[] args) {
int n = 5732;
int len = ((new Integer(n)).toString()).length();
int[] array = new int[len];
for (int i = 0; i < len; i++) {
String x = ((new Integer(n)).toStr
How do you specify the 2 rectangles? For e.g. do you specify the (x,y)
coordinates of the 4 vertices of both the rectangles?
Regards,
Mukul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
T
anurag wrote:
> write a function to print all permutations of a string.can anyone
> please help me
Here is a generic program (written in Java) which does this for a
collection of objects. You can easily adapt it for a string.
import java.util.List;
import java.util.Iterator;
import java.util.Col
Thanks for your comments..
I feel, this portion of code can be optimized as per your suggestion
(I'll try to measure the improvement)
> BufferedReader temp = new BufferedReader(new FileReader("out.txt"));
> FileWriter ot = new FileWriter("temp.txt");
> String l = "";
> while ((l = temp.readL
I experimented with your suggestion 1. Following is the modified
function
public static void cross(List sets) throws Exception {
if (sets.size() == 2) {
FileWriter op1 = new FileWriter("temp.txt");
FileWriter op2 = new FileWriter("out.txt");
for (int i = 0; i < ((Integer[])set
Just to add to my question, I would like the cartesian product program
to scale upto 81 sets, and the cardinality of each set can be maximum
9.
I calculated that the resulting cartesian product will have
1.9662705047555291361807590852691e+77 elements. I think it is difficult
to store this cartesi
I think you are right. Thanks for your comments..
Regards,
Mukul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to algogeeks@googlegroups.com
To unsubscri
Please see here
http://www.personal.kent.edu/~rmuhamma/Algorithms/MyAlgorithms/Sorting/bubbleSort.htm
It says the parallel time complexity of this algorithm is O(n)..
Regards,
Mukul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to th
I am trying to find cartesian product of sets(with integer elements)
using Java. I have written a program as shown below.
import java.util.List;
import java.util.ArrayList;
public class SetUtil {
public static ArrayList cross(List sets) {
ArrayList result = new ArrayList();
if (s
Since the iterations of nested for loop are done in parallel, the
complexity is O(n)..
Regards,
Mukul
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
"Algorithm Geeks" group.
To post to this group, send email to al
Parallel bubble sort (shown below) has O(n) complexity.
PARALLEL BUBBLE SORT (A)
For k = 0 to n-2
If k is even then
for i = 0 to (n/2)-1 do in parallel
If A[2i] > A[2i+1] then
Exchange A[2i] ↔ A[2i+1]
Else
for i = 0 to (n/2)-2 do in parallel
If A[2i+1] > A[2i+2
11 matches
Mail list logo