1,592 views
0 0 votes
As we know the time complexity of solving the greedy knapsack algorithm depends mainly on the sorting algorithm used, Can we use counting sort as the sorting algorithm to reduce the time complexity to O(n)?

1 Answer

Position:
Show:

Related questions

1 1 vote
1 1 answer
2.6k
2.6k views
sumitr asked Apr 10, 2019
2,630 views
What is the best case and worst case of the algorithm? And when will best case and worst case will happen??int main() { for(i=1 ; i<=n ; i++) { if(n%i == 0) { for(j=1 ; j...
2 2 votes
1 answers 1 answer
1.1k
1.1k views
halfcodeblood asked May 26, 2024
1,100 views
How to approach this type of questions?
0 0 votes
1 1 answer
1.3k
1.3k views
eyeamgj asked Aug 25, 2018
1,252 views
suppose we are given a sorted array ....and we need to extract minimum every tym what is the time complexity??and what is the tym complexity to delete the minimum ? are ...
1 1 vote
1 answers 1 answer
703
703 views
gopal_gate asked Sep 13, 2023
703 views
#include <stdio.h>void SSort(int [], int);void swap(int *,int*);int main() { int arr[] = {5,4,3,2,1,0}; int n = sizeof(arr)/sizeof(arr[0]); SSort(arr,n); for(...