CopyPastor

Detecting plagiarism made easy.

Score: 0.7516223788261414; Reported for: String similarity Open both answers

Possible Plagiarism

Plagiarized on 2013-06-19
by Hariharan

Original Post

Original - Posted on 2010-07-23
by eordano



            
Present in both answers; Present only in the new answer; Present only in the old answer;

It needs to be on both end in client side and server(callee and caller) side too.
Client :
1. This is most effective one. 2. Client validation will Reduce one request to server. 3. To reduce the bandwidth traffic. 4. Time comsuming (if it has delay responase from server)
Server :
1. Not to believe on UI data (due to hackers). 2. Mostly backend code will be reused, so we dont know whether the data will be null,etc,. so we need to validate on both callee and caler methods.
Overall, 1. If data comes from UI, Its always better to validate in UI layer and make an double check in server layer. 2. If data transfer with in server layer itself, we need to validate on callee and for double check, we requre to do on caller side also.
Thanks

Fenwick Tree. It's a data structure to keep count of the sum of all elements in a vector, between two given subindexes i and j. The trivial solution, precalculating the sum since the begining doesn't allow to update a item (you have to do O(n) work to keep up).
Fenwick Trees allow you to update and query in O(log n), and how it works is really cool and simple. It's really well explained in Fenwick's original paper, freely available here:
http://www.cs.ubc.ca/local/reading/proceedings/spe91-95/spe/vol24/issue3/spe884.pdf
Its father, the RQM tree is also very cool: It allows you to keep info about the minimum element between two indexes of the vector, and it also works in O(log n) update and query. I like to teach first the RQM and then the Fenwick Tree.

        
Present in both answers; Present only in the new answer; Present only in the old answer;