Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Nov 24 04:37
    mcthesw review_requested #431
  • Nov 24 04:37
    mcthesw review_requested #431
  • Nov 24 04:37
    mcthesw opened #431
  • Nov 23 14:23
    SpiderMath commented #427
  • Nov 23 14:22
    SpiderMath commented #427
  • Nov 23 02:29
    MVanderloo opened #430
  • Nov 20 04:40
    wingkwong review_requested #429
  • Nov 20 04:40
    wingkwong review_requested #429
  • Nov 20 04:40
    wingkwong opened #429
  • Nov 19 16:29
    wingkwong review_requested #428
  • Nov 19 16:29
    wingkwong review_requested #428
  • Nov 19 16:29
    wingkwong opened #428
  • Nov 18 09:44
    SpiderMath synchronize #427
  • Nov 18 09:24
    SpiderMath review_requested #427
  • Nov 18 09:24
    SpiderMath review_requested #427
  • Nov 18 09:24
    SpiderMath opened #427
  • Nov 18 01:36
    EduardoFarinati edited #426
  • Nov 17 16:06
    EduardoFarinati review_requested #426
  • Nov 17 16:06
    EduardoFarinati review_requested #426
  • Nov 17 16:06
    EduardoFarinati opened #426
Anshul
@AnshulMalik
and have one implementation of the traditional slow radix sort, so that it aligns with people’s assumptions
Siddharth Naithani
@sn99
It can be done, give me a few minutes
Anshul
@AnshulMalik
Awesome :)
Siddharth Naithani
@sn99
Should we make 2 funtions, one of faster_radix_sort and one of radix_sort ?
Anshul
@AnshulMalik
Yeah, we should do that :)
Siddharth Naithani
@sn99
okay
Jay Shah
@Jay9596
@AnshulMalik , so what do you suggest I do about the circular queue implementation ?
Anshul
@AnshulMalik
Hey
@Jay9596
So the function swap_remove
removes one element from a point
and it puts the current last element in the array in it’s place
so this way the queue property is violated
we should not move the last element’s position
Siddharth Naithani
@sn99
it's done @AnshulMalik , I got stuck on other things :p
Jay Shah
@Jay9596
But I don't know any method to remove the data in O(1).
What I can think of is just return the value and do nothing with it, after a cycle let enquque overwrite it naturally.
Anshul
@AnshulMalik
Yeah, that’s what can be done
We can just increment the front
and check the condition when we enqueue if front equals to back
Jay Shah
@Jay9596
There is no back as I thought the length might suffice. I'll have to add a member and keep track of it.
Anshul
@AnshulMalik
Yeah, you’ll probably need to add that
Jay Shah
@Jay9596
Returning the element will be a bit of problem, from &mut self and returning Option<T>. Should I change the return type to &T ? "cannot move out of borrowed index"
Anshul
@AnshulMalik
that makes sense
we can return copy of the element?
@sn99 In the simpler redix sort, can we reuse the counting sort from other module?
Siddharth Naithani
@sn99
Maybe .... let me see if it works
Jay Shah
@Jay9596
Yeah we can have a copy of the element.
Siddharth Naithani
@sn99
@AnshulMalik I think we can edit mine to not use get_max function but it will decrease the understandability if the person in case does does not know rust,,, and also in counting_sort.rs is noticed that we ourself have to give the max value when there should be a separate funtion for it
Anshul
@AnshulMalik
so you propose that we should calculate the max value inside the counting_sort function?
So the idea is to not duplicate code
Siddharth Naithani
@sn99
A seperate funtion for finding max value or the method max on slices will give us the max value, I can call the counting_sort.rs functions if you want
also counting_sort.rs will fail for negative integers as it uses usize for maxval
Anshul
@AnshulMalik
oops
we should fix our counting_sort then :P
and then reuse it maybe
that would be ideal
Siddharth Naithani
@sn99
yeah, that would be better, should I make changes in counting_sort and push them with radix_sort ?
Anshul
@AnshulMalik
it’d be ideal, if we have two PRs, one for counting and one for radix, so we don’t mix things up :)
if it’s a small change, then we can keep it in this PR only
Siddharth Naithani
@sn99
Okay, I just have to introduce a funtion to get max of an array in counting sort, rest will all be same in counting_sort.rs
Anshul
@AnshulMalik
ok, then let’s not create another pr
I think I’ll have to say good night now :)
@Jay9596 @sn99 Thanks for the awesome work :)
Jay Shah
@Jay9596
Thank you.
I have made the changes and the tests are all green, I'll make a PR soon.
Siddharth Naithani
@sn99
@efugier a sorting algo must be complete with one public function and all the other private funtions if needed
and even if we have a huge array of 0 and 1 at the same time we can have a huge array of random numbers which we know nothing about, we have to have a method to find the max of it anyhow
Anshul
@AnshulMalik
I agree with @sn99 at this point @efugier, I don’t know why there are some implementations which passes a max value to the count_sort function. Where this max value calculation should happen inside the sort function.
Anshul
@AnshulMalik
Sorry, I am not able to find time to review the PRs
I’d love to have some help in reviewing
João Dias Conde Azevedo
@joao-conde
Hello :wave: I am new to Rust but understand algorithms and would like to contribute. Can I implement the dynamic programming 0/1 knapsack and coin change problem?