Onur
/get cppbookguide
Pavel
/report scam
Liam
/ban for ad
Pavel
/report the same scam
Liam
/ban for ad
Aman
Can anyone tell me that where I am getting wrong .Source code to this problem is below
Aman
Aman
Aman
https://hastebin.com/vudeluroro.pl
NB᭄Navin
Hi
Anonymous
Welcome to the group
Aman
@lightness_races_in_orbit thank u for help
Cengizhan
Problem is actually your implementation way as well. Think much smarter than this solution :) How did you find middle element in linked list?
gjgjtuy
thanks a lot👍 you really save my day
Cengizhan
Sorry.
gjgjtuy
@lightness_races_in_orbit thank u for help
oh my gosh r u real Elon Musk?
Aman
John no my real name is something else
Cengizhan
I would do in that way, define two pointers. One of them traverses the next element one by one. Other one traverses next element two by two. Second pointer reaches to the end, first one should be on the middle one.
Cengizhan
Node *first = head; Node *second = head; first = first->next; second = second->next->next until second != Null.
gjgjtuy
John no my real name is something else
haha you really got me on that
Cengizhan
Why?
Cengizhan
No, if list size is even, first middle should be deleted? If size 5 and next->next will be null already. So no need to go further, still will be deleted first of 2 middle element.
Cengizhan
Then please read this, this is known problem already asked by many companies in different ways.. https://medium.com/@atworksunil/delete-middle-of-linked-list-42994cb5b10c
Anonymous
!report
King
This message is a mistake. There's a bot sending messages automatically
Anonymous
i have a solution similar to the one he is talking about that should work. increment first pointer once if first pointer is null -> list is even, delete middle element increment middle element pointer increment first pointer again if first pointer is null -> list is odd, delete middle element repeat
King
I just signed up on some random link & it sent messages to every platform & contact I have
Anonymous
This message is a mistake. There's a bot sending messages automatically
Settings > Privacy and Security > Show all sessions and log out of all other sessions
King
Thanks
Cengizhan
Please read this one, and it works! https://hastebin.com/gonimuvazi.cpp
Anonymous
1->2->3->4->5 1 and 2 2 and 4 increment -> 4 becomes 5, not null increment -> 2 becomes 3 increment -> 5 becomes 6, null. delete 3 1->2->3->4 1 and 2 2 and 4 increment -> 4 becomes 5, null. delete 2
Cengizhan
Of course, it was a just pseudocode to explain how to find middle element in the linked list with this trick.
Anonymous
i wasn't debating lol. just found a variation to his original pseudocode, so shared
Wojak
Hello I want someone to help me with my test on C/C++. I will pay him for the code. Ping me if someone is interested.
Shivansh
👍
Prasad
Can anyone slove this pseudo code ?
Artöm
Can anyone slove this pseudo code ?
It makes base 8 number from base 10 number
Artöm
I assume ^ is power here
Prasad
I don't know the process ??
Artöm
Do you know how to calculate binary representation of a number?
Artöm
Like 5 -> 101
Prasad
Yes
Artöm
Its same with 8 instead of 2
Prasad
Ok
inkfil
Can somebody explain me from line 44 through 48
Cengizhan
Can somebody explain me from line 44 through 48
It is just sugar syntax of “typedef” if you know it.
inkfil
It is just sugar syntax of “typedef” if you know it.
No i dont know i am new to c++ can you help me with some resource or perhaps an explanation 😅
Cengizhan
No i dont know i am new to c++ can you help me with some resource or perhaps an explanation 😅
Some declarations are too complex or too long to write each time.
Cengizhan
Or sometimes giving name is make them more understandable.
inkfil
I have seen using-declaration on cppreference but here it says that it works with inheritance
inkfil
But this class doesn't inherent
Cengizhan
For e.g; std::map<int, std::vector>>
Cengizhan
Each time writing this make you annoyed, so giving name as a context phonemap, studentmap for example.
SCIEN-TERRIFIC
For e.g; std::map<int, std::vector>>
where we can get good materials about these STL portions?
inkfil
Each time writing this make you annoyed, so giving name as a context phonemap, studentmap for example.
Thanks i understood some of what you were explaining and rest cppreferece helped
Cengizhan
where we can get good materials about these STL portions?
There is a great talk from Jonathan Boccara, he has real map about STL.
Okka
Can anyone here give me some advice on how to master DSA
Okka
Data structure and algorithm
Anonymous
It doesn't relate to C++
inkfil
Data structure and algorithm
Github repo awesome_courses will help you
inkfil
Thank you!
https://github.com/prakhar1989/awesome-courses
Anonymous
Hi
klimi
Hi
Hi?
Jaen
who knows how to balance a binary tree?
You can use a red and black tree
Alex
You can use a red and black tree
it is possible to balance ordinary binary tree, he should google for algorithm
Anonymous
Hellow world
Anonymous
/get ide
Anonymous
sorry :(
Ashish
Anyone doing hackerearth circuit july
Ashish
3rd problem anyone....
Pradip
OK I understand.... thank you 😊😊
Diego
Ok.
Pavel
I noted that MSVC generates different disassembly for these two cases: https://godbolt.org/z/bsn93G As far as I know conditional jumps are bad for branch predictor and unnecessary conditional jumps are better to be avoided. In this case I expected that the compiler will not do short-circuit evaluation because it's only float comparisons (shouldn't they be simple enough?). Can someone explain why the compiler didn't get rid of the jumps and didn't make it the same with the second variant? Does the second variant have some disadvantages?