Given an array with two subparts sorted. How will you make a final sorted
array.
i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21
o/p:
1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23
Regards,
Akash Agrawal
http://tech-queries.blogspot.com/
--
You received this message because you are subscribed to the Google
Greater than,
On 12 April 2011 10:25, Lavesh Rawat lavesh.ra...@gmail.com wrote:
Mathematical Puzzle
What mathematical symbol can be placed between 5 and 9, to get a number
greater than 5 and smaller than 9?
*Update Your Answers at* : Click
use merge sort
On Tue, Apr 12, 2011 at 3:07 PM, Akash Agrawal akash.agrawa...@gmail.comwrote:
Given an array with two subparts sorted. How will you make a final sorted
array.
i/p: 1, 5, 7, 9, 11, 23, 2, 3, 8, 9, 21
o/p:
1, 2, 3, 5, 7, 8, 9, 9, 11, 21, 23
Regards,
Akash Agrawal
This is obvious solution what if u have contant space?
Regards,
Akash Agrawal
http://tech-queries.blogspot.com/
On Tue, Apr 12, 2011 at 3:48 PM, rajul jain rajuljain...@gmail.com wrote:
use merge sort
On Tue, Apr 12, 2011 at 3:07 PM, Akash Agrawal
akash.agrawa...@gmail.comwrote:
Given
dot.this will give 5.9 as answer
On Apr 12, 2:25 pm, Lavesh Rawat lavesh.ra...@gmail.com wrote:
Mathematical Puzzle
What mathematical symbol can be placed between 5 and 9, to get a number
greater than 5 and smaller than 9?
*Update Your Answers at* : Click
Maintain two pointers, and swap elements...
On Tue, Apr 12, 2011 at 4:42 PM, Akash Agrawal akash.agrawa...@gmail.comwrote:
This is obvious solution what if u have contant space?
Regards,
Akash Agrawal
http://tech-queries.blogspot.com/
On Tue, Apr 12, 2011 at 3:48 PM, rajul jain
@baghel: The method returns the desire output.
But looking for some algo which can do the same.
*Subhransu Panigrahi
*
*Mobile:* *+91-9840931538*
*Email:* subhransu.panigr...@gmail.com
On Tue, Apr 12, 2011 at 12:08 AM, baghel anant.bag...@gmail.com wrote:
This solution is incorrect.you are
Yes.. merge sort.
O(n) to find the starting of 2nd sub-array.
and O(n) for the merge process (similar to last step in merge sort)
O(n)
On Apr 12, 2:37 pm, Akash Agrawal akash.agrawa...@gmail.com wrote:
Given an array with two subparts sorted. How will you make a final sorted
array.
i/p: 1,
I don't there is any algorithm for this..
The recursive seems to the best approach for this.
does anyone know if there is any better approach available?
On Apr 12, 4:45 pm, Subhransu subhransu.panigr...@gmail.com wrote:
@baghel: The method returns the desire output.
But looking for some algo
That's linear space, not constant space.
Vaibhav's seems good for constant space solution
On 12 April 2011 13:17, sravanreddy001 sravanreddy...@gmail.com wrote:
Yes.. merge sort.
O(n) to find the starting of 2nd sub-array.
and O(n) for the merge process (similar to last step in merge sort)
@subhransu u sure that this code will return the desired output? chk
again dude. he is just considering ordered permutation not the random
permutation.
@sravanreddy yeah i tried for looking implementation of
next_permutation but seems like recursive approach is the best one as
far as producing
But Vaibhav's solution I think is O(n^2). For example, when input is
101 102 103 104 1 2 3 4
We first swap 1 and 101 and then bubble 101 to the end of the subarray 2 3 4
.
This bubbling we must repeat after each swap.
This results in n/2 + n/2-1 + n/2-2 + .. comparisons, which is O(n^2).
Okay, forgetting the information that two parts are sorted and treating it
as any other array, we can sort in O(nlogn) using, say, heapsort. Is O(n)
possible with constant space ?
Thanks,
Balaji.
On Tue, Apr 12, 2011 at 9:25 PM, Balaji Ramani rbalaji.psgt...@gmail.comwrote:
But Vaibhav's
int main(int argc, char* argv[])
{
char string[13];
char tmp[13];
int len, i, j, k, n;
printf(Length of string: );
fgets(string, 13, stdin);
sscanf(string, %d, len);
if (len 12) len = 12;
printf(Enter string: );
int main(int argc, char* argv[])
{
char string[13];
char tmp[13];
int len, i, j, k, n=1;
printf(Length of string: );
fgets(string, 13, stdin);
sscanf(string, %d, len);
if (len 12) len = 12;
printf(Enter string: );
*Nursing School Abroad
Island Paradise. New Facilities. Proven School. Quality program.
http://bit.ly/degreeZ
Two-year master's degrees
Study in the heart of Europe MA Int' Economy and Business
http://bit.ly/degreeZ
Study in English in China
UK Accredited Degrees in Shanghai ! Leeds, Sheffield
The owner of this group, please grant me the rights to ban such people and
that sexy bitch.
Praveen
On Tue, Apr 12, 2011 at 9:55 PM, Geo News 22au...@gmail.com wrote:
*Nursing School Abroad
Island Paradise. New Facilities. Proven School. Quality program.
http://bit.ly/degreeZ
Two-year
say we hav array {101,102,103,104(ptr1),1,2,3,4(ptr2)}
1.take end of 1 st array in ptr1end of 2nd array in ptr2
2.IF (ptr1ptr2)
bubble up ptr1 to ptr2;
ptr2--
ptr1--
ELSE
ptr2--;
1.compare last element of both arrays ie 104 4 since 1044
bubble up 104 to end since it will be
since we are bubbling up, it's again is a O(n^2).
Is there anything possible like O(n) in constant space. I tried on swapping
values but mees it somewhere... here are intermediate steps in my approach.
1, 5, 7, 9, 11, 2, 3, 8, 9, 21
1, 2, 7, 9, 11, *5*, 3, 8, 9, 21
1, 2, 3, 9, 11, *5, 7*, 8,
Hey Guys, these questions were asked from me during Broadcom India interview
rounds in my college. I hope this would be useful for those interested in
this firm.
They wanted a person with good knowledge of C + Networking + Microprocessor
and project in any of these technologies would be
Q1) What's a spinlock ? How it is different from a mutex ?
spinlock is used to provide synchronization between two processors
and mutex is used for single processor environment.
Q2) What's volatile keyword in C? What does the compiler does when I declare
a variable volatile ?
When you declare a
u can use Quick sort which is inplace
--
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 unsubscribe from this group, send email to
algogeeks+unsubscr...@googlegroups.com.
For
u can use Quick Sort which take O(nlogn) and it is also inplace
--
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 unsubscribe from this group, send email to
quick sort is worst case O(n^2)
On 12 April 2011 18:17, Akash Agrawal akash.agrawa...@gmail.com wrote:
since we are bubbling up, it's again is a O(n^2).
Is there anything possible like O(n) in constant space. I tried on swapping
values but mees it somewhere... here are intermediate steps in
http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html
take a glance on this merge sort this is Inplace and also stable
--
You received this message because you are subscribed to the Google Groups
Algorithm Geeks group.
To post to this group, send email to
Very interesting link!
As we only need to perform one merge we should be able to modify it to run
in O(n) time?
In a similar style as a strand sort?
On 12 April 2011 22:55, hary rathor harry.rat...@gmail.com wrote:
http://thomas.baudel.name/Visualisation/VisuTri/inplacestablesort.html
take
26 matches
Mail list logo