Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Radix sort #147

Closed
vipuluthaiah opened this issue Nov 27, 2020 · 7 comments
Closed

Radix sort #147

vipuluthaiah opened this issue Nov 27, 2020 · 7 comments

Comments

@vipuluthaiah
Copy link
Contributor

how can write the bellow code in dart
//js code
let digitBuckets = Array.from({length: 10}, () => []);
//dart code
List digitBuckets = List.from({});//confused here

//how can i write this: Array.from({length: 10}, () => []);
//in dart List digitBuckets = ??

@Parowicz
Copy link
Contributor

Parowicz commented Nov 27, 2020

Hello
From what i see in js Array.from is similar to dart List.generate - well at least your use case is.

var x = List.generate(10, (_) => []);

@vipuluthaiah
Copy link
Contributor Author

also i am facing a problem in
js code
nums = [].concat(...digitBuckets);
dart code
nums=[].addAll(...digitBucketsd);//facing problem here and confused
image

how can i do this
nums = [].concat(...digitBuckets); in dart?

@Parowicz
Copy link
Contributor

You want to flatten that list? I think closest function would be List.expand

List<List<int>> digitBuckets = [[1], [1, 2], [3, 10, 15, 100], [4]];

List<int> nums = digitBuckets.expand((lst) => lst).toList();

@vipuluthaiah
Copy link
Contributor Author

Thanks a lot!

@vipuluthaiah
Copy link
Contributor Author

vipuluthaiah commented Nov 28, 2020

Can i add my radix sort to this repo??

@Parowicz
Copy link
Contributor

Yea, we don't have that one yet.
You can make pull request.

@vipuluthaiah
Copy link
Contributor Author

sure!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants