Here is the JS implementation of count sort
Here is the count sort implementation using python
Node Weekly
If you are a CTO - will you choose Express.js/Koa2/Hapi.js or anything else and why
June 29, 2018
Recently, I was reading through a few node.js performance reports and articles. I then got this question - "If I start an product and decide to build its backend with node.js, which middleware will I choose and why?"
This question is like - "of course as this blog talks about, I am in love with node.js yet what if I am the CTO of a company and I sit down with my tech team to decide on the technology, how do I select a middleware for my node.js"
So, I went through few articles and here is what I found:
A stackoverflow thread where a similar question was asked where the comparison was between Express and Restify. However, it does have few more points that might be of an interest for us.
Of course the performance reports guy in the node.js framework space - Raygun.com report for 2017.
A few points to keep in view -
Express does have a good concurrent requests handling mechanism and still a strong boy in the group.
Though Koa2 takes a lead with its new overhaul version, I believe apps that are already in Express will remain loyal.
All these benchmarks are on a simple GET ops so the results might vary and will be different from what the above chart says.
In the coming days of the upcoming week, I will publish a report for Node8 LTS and Node10. Stay tuned.
This question is like - "of course as this blog talks about, I am in love with node.js yet what if I am the CTO of a company and I sit down with my tech team to decide on the technology, how do I select a middleware for my node.js"
So, I went through few articles and here is what I found:
A stackoverflow thread where a similar question was asked where the comparison was between Express and Restify. However, it does have few more points that might be of an interest for us.
Of course the performance reports guy in the node.js framework space - Raygun.com report for 2017.
Image credits: Raygun.com from the above link. |
A few points to keep in view -
Express does have a good concurrent requests handling mechanism and still a strong boy in the group.
Though Koa2 takes a lead with its new overhaul version, I believe apps that are already in Express will remain loyal.
All these benchmarks are on a simple GET ops so the results might vary and will be different from what the above chart says.
In the coming days of the upcoming week, I will publish a report for Node8 LTS and Node10. Stay tuned.
selection sort:
time complexity: O(n^2)
space complexity: O(1)
time complexity: O(n^2)
space complexity: O(1)
From today, I will be posting on Sorting algorithms in Python
First of the sorting algorithm is insertion sort.
Time complexity: O(n^2)
space complexity: O(1)
Since the elements are swapped in-place of the array, there is no extra space that is consumed
For the current index, we take a variable that helps us hold our previous index until we reach the 0th index of the array.
when we find that the current element is smaller than its immediate previous element, set the current index value to previous index value and then set the previous index value to current element. now reduce the previous index value by 1 thus making the while loop break when we reach the 0th index.
Here is the code for insertion sort
Hackerrank practice problems are below: https://www.hackerrank.com/challenges/insertionsort1/problem
https://www.hackerrank.com/challenges/insertionsort2/problem
First of the sorting algorithm is insertion sort.
Time complexity: O(n^2)
space complexity: O(1)
Since the elements are swapped in-place of the array, there is no extra space that is consumed
Approach:
Always assume that the first element(index=0) of the array is sorted. Start the comparison from index=1.For the current index, we take a variable that helps us hold our previous index until we reach the 0th index of the array.
when we find that the current element is smaller than its immediate previous element, set the current index value to previous index value and then set the previous index value to current element. now reduce the previous index value by 1 thus making the while loop break when we reach the 0th index.
Here is the code for insertion sort
Hackerrank practice problems are below: https://www.hackerrank.com/challenges/insertionsort1/problem
https://www.hackerrank.com/challenges/insertionsort2/problem