what? Sorry,My English isn't good.
Anonymous
Why do you send it here? Why should we know?
I want to learn
stranger
guys i wanna master data structure and algorithms with c++ any advice or resources please
You need to know basic c++. Then search for basic ds and implement them. And learn new things along the way. And before starting with stl learn a little bit about templates. It should make your understanding better.
Anonymous
https://www.youtube.com/watch?v=UdTzHmjMYBc
Samvel
hi, can anyone tell / show a code example a combined way to sort by insertion and merge?
Hi
#include<queue> #include<iostream> #include<cstdio> #include<cstring> #include<algorithm> #include<vector> using namespace std; typedef long long ll; const int maxn=300005; int cnt,head[maxn],n,m,now; int in[maxn],dp[maxn][26]; char s[maxn]; vector<int> ans; struct node{ int to,next; }e[maxn*2]; void add(int u,int v){ e[cnt].to=v; e[cnt].next=head[u],head[u]=cnt++; } void init(){ memset(head,-1,sizeof(head)); cnt=0; } int topo(){ queue<int> q; int now=0; for(int i=1;i<=n;i++){ if(!in[i]){ q.push(i); dp[i][s[i]-'a']++; } } while(!q.empty()){ int u=q.front(); q.pop(); now++; for(int i=head[u];~i;i=e[i].next){ int t=e[i].to,add=s[t]-'a'; for(int j=0;j<26;j++){ dp[t][j]=max(dp[t][j],dp[u][j]+(j==add?1:0)); } if(--in[t]==0){ q.push(t); } } } int ans=0; for(int i=1;i<=n;i++){ for(int j=0;j<26;j++) ans=max(ans,dp[i][j]); } if(now!=n) return -1; return ans; } int main(){ init(); int x,y; scanf("%d%d%s",&n,&m,s+1); for(int i=1;i<=m;i++){ scanf("%d%d",&x,&y); add(x,y); in[y]++; } printf("%d\n",topo()); return 0; } Can anyone convert this to python code
Rberto
Yes c++ Clr or cli something like this
A ok, that's great! thanks.
Ammar
It's a trivial question. The answer is very easy to be found on Google.
jcw
Yeah . I've already google.. but when i wanna use it in coding im a bit blur. .
jcw
Use books
Which book did u used?
Anonymous
Which book did u used?
I was able to learn without books
jcw
I was able to learn without books
U're so genius 👍
....
Ooh so here I've to ask question only regarding C and C++ and for them also there are some rules.
....
Ok so understood now👍
armandofsanchez
Do you use shmget and shmat in c or are there better libreries for segment memory programming in linux?
AKILA
🤓 today I started learning c and how to major that ? Plz DM me.. 💕💕
klimi
🤓 today I started learning c and how to major that ? Plz DM me.. 💕💕
You study a lot, then you study some more and you get a degree which is useless but you have it
AKILA
@K11M1 thnx
klimi
@K11M1 thnx
But if you needed something genuenly that is connected to c++ or c you can ask here, if it is something not c or c++ related you can try chatting the offtopic group :)
AKILA
What are the differents between c and c++
klimi
What are the differents between c and c++
I would say its like English and spanish
klimi
Do you speak spanish?
I do... But.... ?
OnePunchMan
What are the differents between c and c++
C is procedural language. C++ is object oriented languge.(ignoring multiple inheritance)
klimi
that's not right!
If you say so ¯\_ (ツ) _/¯ I would prefer this discussion to be in the offtopic group tho, thank you
Anonymous
What are the differents between c and c++
Everything Two totally different languages
AKILA
Thanx everyvody
AKILA
Talula
Everything Two totally different languages
Not totally... but different.
Larry
/get learn
Veronica
Best lol🤣🤣🤣
AKILA
😆😆
Sandeep
class Entity { public: int x, y; Entity (int x, int y) { Entity*& const e = this; x = x; }
Sandeep
In the tutorial he said..we can't assign this to something that is not comstanr
Sandeep
Here...after apemsand..there is const keyword
Sandeep
Then what's wrong with the line
Anonymous
Use books to learn C++ Not some silly tutorials
Sandeep
There is const keyword after ampersand ..that means it is a constant reference right
Anonymous
References are always constant
Sandeep
Everything
In the tutorial also he said it doesn't work..but I don't get why..
Sandeep
I googled it every where bruh..couldn't find anything
Anonymous
Sandeep
class Entity { public: int x, y; Entity (int x, int y) { /* But this line works...*/ Entity* const & e = this; } x = x;
Sandeep
How come this is a const reference and not the previous one🥺
Anonymous
Anonymous
There's no such thing as non const reference
Anonymous
There are references to constants and non-constants but every reference by itself is constant
сумбула
How come this is a const reference and not the previous one🥺
reference is not an object so it is always const
Sandeep
Or did I
сумбула
@Sandeep_ranweer pointers and reference can be very confusing first try to read more about them from books to understand them properly (personal advice)
Sandeep
Sure tq..
Anonymous
Yes
In section 20 of c++ programming language I saw something like this Class name:int or vector I thought class : base class What is this
Anonymous
And I prefer not to speak to Nazis
Anonymous
As you wish you are admin
Anonymous
And I prefer not to speak to Nazis
I'm femboy furry comn and I wanna be anime girl could you help me now
The Shadow Monarch
/tr eng
Ehsan
/tr