+ 9
@Farhan: Effectively Kinshuk was your google on this one :) but IF you google the methods he has provided and figure out how and why they work for yourself I see no harm in being provided with code like this. Personally I wouldn't have answered this question until I had seen what you have tried yourself first, but that's just me (sounds a bit like homework, that's why) :)
11th Mar 2018, 8:25 AM
jay
jay - avatar
11th Mar 2018, 8:44 AM
jay
jay - avatar
+ 11
If you post the code here or save it as a code in code playground :) I will be able to see
11th Mar 2018, 9:10 AM
jay
jay - avatar
+ 10
Wooooo nice! Can I see?
11th Mar 2018, 9:07 AM
jay
jay - avatar
+ 9
p.s It doesn't matter if your attempt is wrong :) as long as it shows you tried, people will be very, very happy to help Also, Kinshuk is more deserving of best answer than me
11th Mar 2018, 8:37 AM
jay
jay - avatar
+ 6
The logic is very much the same with @Kinshuk solution, I see you try to swap values using your own implementation rather than the algorithm library support, it's nice to see you try and play with it, it helps in learning, it's good for you : ) I would suggest you though, to create your own swap function and call it as necessary, rather than repetitively writing like these: swap = x x = y y = swap Good job! : )
11th Mar 2018, 9:39 AM
Ipang
+ 4
I don't know if it's helpful to give him the full code. He maybe just copies it and doesn't learn anything. This code is a bit more advanced than a hello world program and a cs student should be able to figure it out without getting a whole solution. Hints & corrections should be enough. Learning by doing and learning by errors are far better than learning by copy&paste. At least for beginners. For advanced techniques it's often helpful to look at decent open source codes though.
11th Mar 2018, 8:15 AM
Alex
Alex - avatar
+ 3
plz elaborate the question.
11th Mar 2018, 4:46 AM
shobhit
shobhit - avatar
+ 3
What did you already try?
11th Mar 2018, 8:09 AM
Alex
Alex - avatar
+ 3
Good job!
11th Mar 2018, 9:23 AM
Alex
Alex - avatar
+ 2
how would you sort something in ascending or descending without using array or something like array like vector. One way could be to find max & min. if ot doesn't solve your problem plz clarifyn
11th Mar 2018, 4:42 AM
shobhit
shobhit - avatar
+ 2
What do you want to sort? That will clear things...
11th Mar 2018, 4:53 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 2
I meant, what is the data that you need to sort? And how are you storing it without an array?
11th Mar 2018, 5:13 AM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar
+ 1
That's why I asked if you tried anything yourself yet.
11th Mar 2018, 8:18 AM
Alex
Alex - avatar
0
Wanted 6854 (An integer 6854 input NOT SEPARATE INTEGERS) Output should be: 4568
5th Nov 2024, 8:13 PM
Riya Mukherjee
Riya Mukherjee - avatar