Anonymous
When do you start learning data structures and algorithms?
Amit
Thanks
Anonymous
Ok
Anonymous
Can i ask? I understand this question but how write source code.
Anonymous
Can i show question?
Anonymous
this method makes sure that newly entered element is always at the front of 'q1' so that pop operation just dequeues from 'q1','q2' is used to put every new element at front of 'q1' push(s,x) // x is the element to be pushed and s is stack 1) Enqueue x to q2 2)One by one dequeue everything from q1 and enqueue to q2 3)swap the naes of q1 and q2 //swapping of naes is done to avoid one more movement of all elements //from q2 to q1 pop(s) 1) Dequeue an item from q1 and return it
Was removed
Did you save it as cpp file ?
Yeah...all rules are clearly followed...but CODEBLOCKS i dentifies the preprocessors directives as errors
klimi
Welcome
Sun
yes Hello
Mat
- Welcome - Yes 🤔
بوصَعبْ
Dima
Hmmm so funny
بوصَعبْ
Anonymous
😂
Tanaka
Hello world
Aiman
hi. im wanna asking , can we put a passing by reference parameter with an array ??
Anonymous
Anonymous
Anonymous
I m not getting any help??!!!
Francisco
I m not getting any help??!!!
It's your homework, not ours
Anonymous
I m not getting any help??!!!
Why not use the compiler and figure it out by yourself? It's not that difficult at all
klimi
I think this is easy without any advanced knowledge
Anonymous
It's your homework, not ours
No it's not homework just I m solving this type of question
Francisco
No it's not homework just I m solving this type of question
But if we answer them for you, there's no point on solving them
Vikram
How the "this" keyword works?
BinaryByter
How the "this" keyword works?
the member function gets a "this" pointer as the first argument, after compilation
BinaryByter
Or the nth argument, really
BinaryByter
Can be implemented in many ways
Vikram
Can be implemented in many ways
In this way"This->"?
Anonymous
Can be implemented in many ways
When is a good time to dive into data structures and Algos
BinaryByter
Anonymous
when you need them specifically
I heard you need them for interviews lol
Silvestr
Hello guys I have a problem -static assertion failed: std::atomic requires a trivially copyable type
Silvestr
What I should to do that my type can be trivially copyable?
Silvestr
so if I have custom constructor that means my type isn't trivially copyable?
Silvestr
remove the constructor
also copy and move constructor?
BinaryByter
Probably not
Silvestr
Probably not
#include <iostream> #include <atomic> #include <string> struct Copy { std::string name; std::string surname; }; int main() { std::atomic<Copy> copy; return 0; }
Silvestr
even for this I receive assert
Silvestr
from my investigation result is next -> if you have custom constructor or move or copy constructor, also if types that you include in your class also have constructor - this is not trivially copyable type
BinaryByter
even for this I receive assert
is string trivially copyable?
Silvestr
is string trivially copyable?
I think no because it have another constructors
BinaryByter
yes
Silvestr
yes
std::cout << std::is_trivially_copyable<std::string>::value;
Silvestr
this is print 0
BinaryByter
yes
Silvestr
thank you all for help.
Silvestr
Dima
Anonymous
😂
Anonymous
Cute
Elnee
#no_endl
Elnee
!notes
Elnee
#noendl
Mihail
#noendl
TL DR does an unnecessary flush
Elnee
I have some trouble, I will try to describe
Elnee
I'll be very grateful if somebody could explain this
Mihail
Result: ~~~~~~~~INITIAL MAP~~~~~~~~ Size: 6 AE 8181 EX --- 783552659244 BE 8180 BB --- 785367261758 BH 6040 EE --- 768354617263 BX 6036 BH --- 748672948178 CA 8226 BH --- 784659284713 CE 1786 BA --- 748376829134 ~~~~~~REMOVE ELEMENT~~~~~~~ Size: 5 AE 8181 EX --- 783552659244 BE 8180 BB --- 785367261758 BH 6040 EE --- 768354617263 CA 8226 BH --- 784659284713 CE 1786 BA --- 748376829134 ~~~~~~~FIND ELEMENT~~~~~~~~ ID of (AE 8181 EX): 783552659244 ~DOES (AB 8181 BB) EXISTS?~ Registration mark (AB 8181 BB) doesn't exist
Mihail
Result: ~~~~~~~~INITIAL MAP~~~~~~~~ Size: 6 AE 8181 EX --- 783552659244 BE 8180 BB --- 785367261758 BH 6040 EE --- 768354617263 BX 6036 BH --- 748672948178 CA 8226 BH --- 784659284713 CE 1786 BA --- 748376829134 ~~~~~~REMOVE ELEMENT~~~~~~~ Size: 5 AE 8181 EX --- 783552659244 BE 8180 BB --- 785367261758 BH 6040 EE --- 768354617263 CA 8226 BH --- 784659284713 CE 1786 BA --- 748376829134 ~~~~~~~FIND ELEMENT~~~~~~~~ ID of (AE 8181 EX): 783552659244 ~DOES (AB 8181 BB) EXISTS?~ Registration mark (AB 8181 BB) doesn't exist
Mihail
It does write a newline
Mihail
It's just that you're expecting to have an empty line
Mihail
And for that you need one to end the current line and one to skip a line
Mihail
Or is your output different?
Mihail
Result: ~~~~~~~~INITIAL MAP~~~~~~~~ Size: 6 AE 8181 EX --- 783552659244 BE 8180 BB --- 785367261758 BH 6040 EE --- 768354617263 BX 6036 BH --- 748672948178 CA 8226 BH --- 784659284713 CE 1786 BA --- 748376829134 ~~~~~~REMOVE ELEMENT~~~~~~~ Size: 5 AE 8181 EX --- 783552659244 BE 8180 BB --- 785367261758 BH 6040 EE --- 768354617263 CA 8226 BH --- 784659284713 CE 1786 BA --- 748376829134 ~~~~~~~FIND ELEMENT~~~~~~~~ ID of (AE 8181 EX): 783552659244~DOES (AB 8181 BB) EXISTS?~ Registration mark (AB 8181 BB) doesn't exist Tip: Wrap your code in triple backticks to display it in monospace.
Mihail
This is without an endl
Mihail
Is your output different from mine?
Elnee
Thanks for answer. But why in other cases one endl is enough to break a line?