Relative Content

Tag Archive for algorithms

How to check if 4 points form a square?

Assume I have 4 points (they are 2-dimension), which are different from each other, and I want to know whether they form a square. How to do it? (let the process be as simple as possible.)

Container types in Golang

For a non-OOP language like google Go, is it idiomatic to go about implementing new container types using datatypes like arrays or lists so as to implement convenient functionality like contains method which is absent from all in built container types?

Help with algorithmic complexity in custom merge sort implementation

I’ve got an implementation of the merge sort in C++ using a custom doubly linked list. I’m coming up with a big O complexity of n^2, based on the merge_sort() > slice operation. But, from what I’ve read, this algorithm should be n*log(n), where the log has a base of two.