give algorithm for the following -:
1. sort a 2-d array
2. sort a 2-d array in snake order
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Q) You are given a string in which the characters are sorted. Write a
program to generate all the combinations of characters such that only
the lexicographically lowest permutation of every combination is
printed. (ie. If the string is abcd then ab is a valid
combination, but ba is not). Further,
Q) The array T represents the diameters of various teacups, and the
array S, the diameters of saucers, both the arrays sorted in non-
decreasing order. The 'i'th cup (whose diameter is T[i]) can be
paired with the 'j'th saucer (whose diameter is S[j]) if and only if
S[j] = T[i].
Given the
Q) You are given a root-less tree (which can also be thought of as an
undirected acyclic connected graph). The problem is to choose one of
the nodes from the tree as root such that the height of the resultant
tree is minimum.
Device an appropriate data-structure and write a program for the
Q) A city has a number of roads that meet at various junctions (A
junction is a point where two or more roads meet). The traffic police
department is severely short of policemen and therefore wants to know
the minimum number of policemen required to be placed at junctions so
as to cover all the
Every programming intro book has an example of a 2D array sort. Just
crack a book, or google it. Every sort algorithm will be different.
I presume snake order is column major key and row minor key sorting
of the 2D array?
Since the normal row major key column minor key sorting would have
Use the property that one of the diagonals has squares of odd numbers.
So given a co-ordinate in that diagonal you know the number at that
position. For positions not on that diagonal you can add/subtract
appropriately and obtain the number you need.
-Dhyanesh
On 10/18/07, mukesh tiwari [EMAIL
Dear friends,
I have a recurrence to solve but I'm lost
T(N)= [T(N-1)]^2.
Then I need to develop this recurrence by iteration/expasion.
T(n-1)=[(T(N-2)]^2
T(n-2)=[(T(N-3)]^2
T(n-3)=[(T(N-4)]^2
Then
T(N)= [T(N-1)]^2
T(N)= [T(N-2)]^4
T(N)= [T(N-3)]^8
T(N)= [T(N-4)]^4
.
:
hello Allysson here is the link for discussion of problem
http://groups.google.co.in/group/comp.programming/browse_thread/thread/4a06904cbbd7c2d3/69c5adbf6badbd8c#69c5adbf6badbd8c
On Oct 22, 5:19 am, Allysson Costa [EMAIL PROTECTED] wrote:
Dear friends,
I have a recurrence to solve but I'm
Hi,
Can some provide me hint or solution to the following problem.
If a graph has O(|V|) edges , then show that it can be colored
with (O|V| ^ 1/2) colors.
Thanks
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the
On 10/18/07, mukesh tiwari [EMAIL PROTECTED] wrote:
21 22 23 24 25 26
20 7 8 9 10
19 6 1 2 11
18 5 4 3 12
17 16 15 14 13
let the coordinate of 1 is (0,0) ie origin then
Check out these 2 links which discuss the same problem. Some codes are also
posted.
http://groups.google.com/group/programming-challenges/browse_thread/thread/88bcbea02029c2bf
http://groups.google.com/group/programming-challenges/browse_thread/thread/9acf71cb87e9ffd3
This is a good group
12 matches
Mail list logo