S O U N D W A V E
BAN USER- 3 Answers How to delete an account?
I've emailed careercup support 5+ times already (no response) about having this account deleted. Does anyone work actively on this site at all?
- S O U N D W A V E November 27, 2013
I occasionally get emails for recent comments to questions even though I'm not subscribed to this.
The unsubscribe link in this email leads to nothing useful (as I'm not subscribed to this service to begin with).
How do I contact the people who run careercup? How to stop the sporadic spam emails?
I just got this email (which is considered spam now) :
undefined has commented on a question.
You are given an array in which you’ve to find a subarray such that the sum of elements in it is equal to zero.
He algo is nice.
However, In java it is not easy using the hashMap to get the key of values if we use hashmap(index,value). And if we want to use hashtable(value,index), the array cannot have dup as it will have the same key and cover the previous value. We can use a biMap to handle it.
if we don't want to use biMap here is my solution using two hashMap.
static void sumEqZero()
{snip}
View » | To unsubscribe, login and click here.| Flag | PURGE
Define in place for m != n ? There are partial in-place algorithms, but probably not worth the effort.
- S O U N D W A V E October 02, 2013Need to reread this after a coffee... woah
- S O U N D W A V E October 02, 2013while( something )
{ putchar('0'); putchar('1'); fflush(stdout); }
? Was it Google Research ?
Write your own atoi, itoa (easy) or use library function (equivalents). Combine these to solve your problem.
- S O U N D W A V E September 30, 2013Ok, so you get top left and bottom right coordinates for two rectangles?
Call top left point, "U" and bottom right "L"
// if either rectangle is totally to the right of the other, return false:
if( rec1.U.x > rec2.L.x || rec2.U.x > rec1.L.x) return false;
// if either rectangle is totally above the other, return false ...
if( rec1.L.y > rec2.U.y || rec2.L.y > rec1.U.y) return false;
// else return true ...
return true;
Someone verify/check this...
- S O U N D W A V E September 30, 2013Can someone explain the question to me ? What blocks is he/she talking about?
- S O U N D W A V E September 30, 2013Did you not read Hingle's answer? There are "better" reasons for using bubble and selection sort than the weak one in your answer.
My suspicion was correct (based on the fact that you must have spend < 1 min. on this page and skipped reading better answers).... you simply googled the topic and copy pasted an answer from: stackoverflow.com/questions/1933759/when-is-each-sorting-algorithm-used
Bubble/insertion/merge sorts are stable.
Selection/quick/heap sorts are not stable.
Quicksort:
Also, I don't understand your "we have to use quicksort" comment.
For very unbalanced splits QS produces good results ... you should explain this better. Also, no mention of the fact that QS isn't often used in hard real time systems if the worst case (n^2) can't be tolerated for some inputs.
Also, the usual implementation of quicksort (subroutine partition) does too many swaps when there are duplicate keys. So often quicksort is avoided when the data will have a lot of repeated keys.
+1 for not simply pasting code
any traversal visiting all the nodes will work
I like your flip idea, let me modify my code for a variant of flip (but using a bool variable):
//external/global variables
BOOL evenlevel=true
evensum, oddsum (numeric type matching node values)
//wrapper for other function
sum(root)
{
evensum=oddsum=0 // reset sums
rec_sum(root) // call main recursive function
return evensum, oddsum // or return difference
}
rec_sum( node )
{
if( node == nil) return
if(evenlevel) evensum += node.val
else oddsum += node.val
evenlevel=!evenlevel //children are diff type
rec_sum(Node.left)
rec_sum(Node.right)
evenlevel=!evenlevel //back to original type
}
+1
Scanned the page from top to bottom, say no pseudocode nor analysis.
fix the bug Anonoymous
- S O U N D W A V E September 28, 2013Why do you need the heap?
When you increase a key/count, are you going to run heapify(heap_root) ? Why heapify (why not increase_key) ?
Can you calculate all the complexities step by step?
In the end, what you are trying to do can be done in two separate stages:
1) Maintain the hash table of counts.
2) Sort (heap sort in your case) the internal table of hash table based on the count column.
But for 2) we should be able to get away with a linear sort like count/radix. So this should be doable in O(n) in practice.
Sedgewick says:
Bags. A bag is a collection where removing items is not supported—its purpose is to
provide clients with the ability to collect items and then to iterate through the collected
items (the client can also test if a bag is empty and find its number of items). The order
of iteration is unspecified and should be immaterial to the client.
If m < n, you can simplify your comp. to O(n*lgn )
But note, question just said elements in a bag. We can't assume the elements are (total order) comparable.
If we can, here is another way via sorting:
1) Sort the smaller bag O(m*lgm)
2) Binary search each element of larger bag in result of 1) above:
O(n*lgm)
Total comp: O( mlgm + nlgm ) = O(n*lgm)
//external/global variables
h=0, even, odd
//wrapper for other function
sum( node)
{
even=odd=0 // reset sums
h=0 // not really needed
rec_sum(node)
return even, odd
}
rec_sum( node )
{
if( node == nil) return
if(h%2==0) even+= node.val
else odd += node.val
++h // increment height value for my children
sum(Node.left)
sum(Node.right)
--h // unwind height
}
GLOBAL VARS:
h=0, even, odd
//wrapper for other function
sum( node)
{
even=odd=0 // reset sums
h=0 // not really needed ( rec_sum will unwind it to 0 )
rec_sum(node)
return even, odd
}
rec_sum( node )
{
if( node == nil) return;
if(h%2==0)
even+= node.val
else
odd+= node.val
++h // increment height value for my children
sum(Node.left)
sum(Node.right)
--h // unwind height
}
Google for BINET's FORMULA
- S O U N D W A V E September 19, 2013
Repmylakleinm, Quality Assurance Engineer at Coupon Dunia
Articulate and accomplished admin executive experience at keeping an office running smoothly. A communicator and collaborator who is efficient in ...
Repherminanmuller87, Animator at 247quickbookshelp
Hello,I am a literacy teacher. I completed my degree from Chicago and now am a literacy teacher in a ...
Repjanistbennett, Blockchain Developer at AMD
I am JanisBennett working as a journalist, having years of experience in my career. I have covered various stories.Great ...
Repgarlandkrebs, Animator at ADP
Highly focused and seasoned magazine editor with vast experience in all stages of weekly and monthly magazine production. My aim ...
Repannawellson007, Area Sales Manager at 8x8
Hey my name is anna And i am working as a content writer in Search engine optimization company.My component ...
Repneshujaha, Member Technical Staff at BMO Harris Bank
I am Neshu, a Camera Operator with a creative eye for detail and dedication to quality work. I am always ...
RepLooking for the best child development center in Charlotte? Pal A Roos provide summer camp for children Charlotte. Our experienced ...
RepRobertBaumbach, Administrative Manager at Meridian Mechanical Services
Reprafaeltanner210, Associate at 247quickbookshelp
I am Labor relations directors, oversee employment policies in union and nonunion settings. I draw up, negotiate, and administer labor ...
Repcolettehenna, OOPS Freshers at Bosch
I am Colette , policy analyst at Sunflower Market , with 3 years of experience building and maintaining relationships with elected officials ...
RepIndianastrologyguru, Data Scientist at ABC TECH SUPPORT
Hey I'm Shelly Renee and I'm working as a system developer. Currently working part time on a project ...
Repelisahbuff, Apple Phone Number available 24/7 for our Customers at Altera
I have previous work experience in a customer focused environment. I like to Enjoy my Free Time Playing football.I ...
Reptaylamowll, Analyst at AMD
Aspire to work in a challenging environment, where my exceptional skills and abilities are completely explored, and I can easily ...
Repamayalopez800, Accountant at A9
I am Amaya ,working in the field of training and development coordinator for three years, focusing on teaching English as ...
Reploragurrero, Research Scientist at Absolute Softech Ltd
I am Lora , an empathetic and dedicated Community Organizer with a deep passion for helping others and a strong determination ...
RepKellyLabbe, Animator at Future Advisor
My name is Kelly and I am currently a freshman Fitness trainer in Vibrant Man company .I have learned a ...
Repkarinkwalton, Backend Developer at Broadsoft
I am working as a Support clerk in an MVP Sports company. I love traveling and exploring facts about technology ...
RepTimothyAYocum1, Android Engineer at ABC TECH SUPPORT
I am a medical or osteopathic doctor who specializes in eye and vision care. My work Ophthalmologists differ from optometrists ...
RepGinaSanchez, Computer Scientist at Autoportal.com
Ginna from New York.Successfully managing a high volume of work assignments without compromising quality to exceed client expectations.Apart ...
RepDonnaArvin, Analyst at Apple
Hii am from the United States. I work as a computer control programmer at Dynatronics Accessories. I am a social ...
Reppamilarbowman, Animator at ABC TECH SUPPORT
Je travaille en tant que Web Manager dans la société Forum Cafeterias. Je veux tout savoir sur le marketing numérique ...
where is M?
- S O U N D W A V E October 02, 2013