数学の恋人
Thanks! Your tips was very helpful.. 😊
Dude are you for real? I was teasing you and you say I was helpful, I'm dying laughing now
Anonymous
Actually, that was my friend laptop 😅
Anonymous
He change the password so that his wifr doesn't know the password
数学の恋人
played nicely
Anonymous
Then he himself forget the password
数学の恋人
hahaha
Anonymous
He asked me either I can help since I know a lot about computer
Anonymous
Until now the laptop cant be open
Dima
#ot
I_Interface
Admins, could i push a CppCon promo here ? :)
I_Interface
https://cppcon.org/cppcon-2019-program/
🇰 🇷 🇦 🇹 🇴 🇸😜
The best book for C / c++ network
Dima
Yes.
Badugar
Yes.
🇰 🇷 🇦 🇹 🇴 🇸😜
Yes what
Anonymous
No
Prajwal
Hello everyone
Prajwal
Can any one tell me best algorithm for rotate a array??
Anonymous
Can any one tell me best algorithm for rotate a array??
"Array rotating" algorithm is the best, probably
C.
Can any one tell me best algorithm for rotate a array??
Could you please describe your problem better?
Dima
Yes
Prajwal
Let say a name "danya" and I want to rotate it like "adany"
C.
Well... There is std::rotate...
Nassrullah
Let say a name "danya" and I want to rotate it like "adany"
Are u sure if you use array rotating algorithm you will be able to go from "danya" to "adany" ? I think you will have "aynad" if you rotate completly.
C.
Rotating through right gets the last element and put as the first of the array, and everything else is shifted right.
Nassrullah
Rotating through right gets the last element and put as the first of the array, and everything else is shifted right.
Yeah ! I think we are saying the same thing but i was thinking about a complete rotation.
Nassrullah
Nassrullah
From danya to aynad is permutation i think.
C.
well, lets see: this will br just a pseudocode because i am lazy. char arr[4] = "caio"; int shift = 1; for (i=0; i < size) { if ( i < shift ) { temp[i] = arr[size+i-shift]; } else { temp[i] = arr [i+shift] } } return temp I think that would work. Not sure tho
Nassrullah
#include <stdio> int main () { char test[6] = "danya"; char tmp; int size = 0; int i = 0; // finding the size of the array while(test[size] != '\0') size++; // rotation i = size - 2; tmp = test[size-1]; while (i != 0) { test[i+1] = test[i]; i--; } test[i+1] = test[i]; test[0] = tmp; printf("%s", test); }
C.
Nice
Anonymous
There are better ways but in C++
Nassrullah
There are better ways but in C++
Maybe but I understand the C strings more than the C++ strings. That's why i use C here.
Anonymous
Anonymous
And you know the array size in compile time, why did you calculated the size at runtime???
Nassrullah
Nassrullah
And you know the array size in compile time, why did you calculated the size at runtime???
It's a general algorithm. Now if he wants he can use scanf to take the array from the user and there will no need to change anything else.
Nassrullah
And yeah — for the C strings, there is the strlen function
This is a powerful way to get the size. strlen is a function which means there can be a longer execution time if i use it.
Anonymous
Using built-in functions in 95% is faster and safer
Nassrullah
Using built-in functions in 95% is faster and safer
🤦‍♂ safer maybe but not compulsory faster.
C.
There are better ways but in C++
Do it then, instead of just pointing out everything.
Anonymous
There's no possible way that your algorithm is faster than the same one from stdlib
C.
There is
C.
Just like STD::sort
Nassrullah
Again, who said to you?!
My books, my courses Dude. And who said to you too that built-in functions are faster ?
Nassrullah
There's no possible way that your algorithm is faster than the same one from stdlib
Those who wrote stdlib are human beings just like us and we can beat them.
C.
There's no possible way that your algorithm is faster than the same one from stdlib
That is basically why performance-wise, the more low level the language the better, because the programmer has total control of his software
Anonymous
My books, my courses Dude. And who said to you too that built-in functions are faster ?
General sense and some really smart people from c++ standard committee
Anonymous
Just like STD::sort
Are you saying that you sort is faster than std::sort?😂
C.
Heap sort
Anonymous
Merge sort
So? IntroSort that used in some implementation is faster than Merge Sort
Nassrullah
C.
Yes it is.
Amit
Any have knowledge java
C.
If your committee was as good as you make them sound, Python would have the best performance on software
Anonymous
Yes it is.
Dude, learn to google before saying please. No one uses Quick Sort for std::sort right now, because by the standart std::sort is O(NlogN) in the worst case
Nassrullah
They are smarter than you, admit that
You don't know me guy. 😊 They may be greater programmers than me but using the word "smarter" like that is a mistake.