Anonymous
when using auto but works correctly if i actually specify size_t
Official hooligan of Pius XII
what's the point of using auto tbh
Anonymous
avoid type duplication according to clang-tidy
Iante
Hello Guys...If I want to use a Linked list in C to come up with a system that stores data eg names,date,ID, what is the best way to implement it?
klimi
like one linked list for "name + date + ID" ?
Iante
like one linked list for "name + date + ID" ?
Instead of using arrays, you use linked list instead
Anonymous
a linked list with a struct
Anonymous
eg struct L { char * name; char * date; int ID; }; linkedList<L> x;
Anonymous
Wanna find out the longest common SUBSTRING (not subsequence) Did a memoization approach But, how to recur when the characters don't match? I am doing memo[m][n]=0; but I need to recur for the rest of the characters too res =max(res, max(lcsubstr(s1, s2, m-1,n),lcsubstr(s1, s2, m,n-1) won't work int lcsubstr(string s1, string s2, int m, int n) { if (memo[m][n] != -1) return res = memo[m][n]; if (m == 0 or n == 0) memo[m][n] = 0; else { if (s1[m - 1] == s2[n - 1]) { memo[m][n] = 1 + lcsubstr(s1, s2, m - 1, n - 1); res = max(res, memo[m][n]); } else { memo[m][n] = 0; } } return res; }
Anonymous
Just that how should I recur when the characters don't match?
Anonymous
I did it with bottom up approach, it worked, but I wanna do it with recursion (using memoization)
This is not conducive for recursion. If you must use recursion, then since you know that the last characters dont match, find the longest common substring amongst these cases: 1. string1[0,m-1] and string2[0,n] 2. string1[0,m] and string2[0,n-1] Set res to the maximum of these 2 values.
Anonymous
Let me check that later. Will get back to you on this unless someone beats me to it.
Haha, sure. I already spent 2-3 hours, trying to fix it. xD
Anonymous
Haha, sure. I already spent 2-3 hours, trying to fix it. xD
I just tried a python solution and it worked. Am sure you would have made a mistake somewhere. Here is a Stackoverflow thread which also discusses it https://stackoverflow.com/questions/24546740/longest-common-substring-recursive-solution#58668148
Yehudi S. Sanabria
Hi 🥳
Yehudi S. Sanabria
I'm beginner on this, how should start in C++?
Prince
I'm beginner on this, how should start in C++?
Do practice problems reading basics.
Anonymous
Hii
Talula
I'm beginner on this, how should start in C++?
You're a beginner in C++ or programming?
Anonymous
I'm beginner on this, how should start in C++?
Start generating ur own ideas and develop code fr ur own ideas initially with fundas ! It will boost ur confidence! Later learn advanced concepts likes oops, STL, datastructures, containers, algorithms and libraries! Even more advanced u can go by reading documentation of libraries!
Kishore
Are you student?
Yes pursuing mechanical
Anonymous
So good
As a beginner where should I practice c++ language
Anonymous
As a beginner where should I practice c++ language
Where? At home or at school? Not started working I presume.
Anonymous
In college
Then practice in class
Anonymous
I do know basics
If u know the basics then start some projects :)
Anonymous
If u know the basics then start some projects :)
From Where should I get the projects
Anonymous
From Where should I get the projects
Github... your lecturer ...
Talula
Programming!
Well... Are you doing programming for academics, fun or as a profession?
Anonymous
If u know the basics then start some projects :)
U said you are first year graduate! So u can start writing programs fr newton raphson method, numerical methods u learn in mathematics! There are lot of sources available online on C++ and its application to numerical methods!
Anonymous
Can we add different(2 or more) data types or strings in a single strcat functions?
Anonymous
Hi,learned a bit python,a beginner in C++ any advices please.
Anonymous
I do not understand a small code can you help me with it?
Anonymous
QUESTION: Create a function that tweaks letters by one forward (+1) or backwards (-1) according to an array.
Anonymous
Sample: tweakLetters("apple", {0, 1, -1, 0, -1}) ➞ "aqold" // "p" + 1 => "q"; "p" - 1 => "o"; "e" - 1 => "d" tweakLetters("many", {0, 0, 0, -1}) ➞ "manx" tweakLetters("rhino", {1, 1, 1, 1, 1}) ➞ "sijop"
Anonymous
ANSWER OF THE QUESTION: std::string tweakLetters(std::string s, std::vector<int> arr) { for(int i=0;i<s.size();++i) s[i]='a'+(s[i]+arr[i]-'a'+26)%26; return s; }
Anonymous
I did not understand the answer code. Can you explain it to me please anyone?
Anonymous
Hi,learned a bit python,a beginner in C++ any advices please.
For a beginner , pls focus on 1 language till intermediate...
Anonymous
Ya true still Some advices on c++
They are all languages.. for beginners , I dont see much benefits
Anonymous
Ok cool
When u want to do AI/ML or Embedded ... then they will shine respectively...learning for loops in both language is a waste really...
Kishore
Well... Are you doing programming for academics, fun or as a profession?
I didn't start to learn in depth .. I started c language in my first year.
Anonymous
Anonymous
I mean either would do...
Anonymous
I mean either would do...
Oh sorry ok cool!
Anonymous
offtop
Anonymous
Anonymous
One world?
Anonymous
Which one would you prefer for embedded?
Anonymous
Thanks, but right now people opting for Python in embedded too!!!
Talula
I didn't start to learn in depth .. I started c language in my first year.
Well okay, but that wasn't my question, are going planning to learn C++ for academics, fun or professional work?
Talula
Thanks, but right now people opting for Python in embedded too!!!
Yeah which SUCKS... limited libraries, no RTOS, much slower than C++, stops if you press ctrl+c...
Talula
Thanks, but right now people opting for Python in embedded too!!!
Which is good for programming for "fun" but horrible for professional programming.
Anonymous
С++ can be used to write a proprietary code, because other scripting languages are easy for programming, but source code of software is not protected
Anonymous
Which is good for programming for "fun" but horrible for professional programming.
Yea absolutely right Tazz, thanks for sharing those valuable experiences even I wonder why embedded is on the python track https://content.techgig.com/python-programming-language-may-take-over-java-and-c-in-popularity/articleshow/84206760.cms
Talula
С++ can be used to write a proprietary code, because other scripting languages are easy for programming, but source code of software is not protected
For @K_P_Shetty it is protected and he can load AI on 32KB RAM of microcontroller... (In case people don't know the top level languages are normally determined by number of questions asked on sites like Stackoverflow... C being there shows that it is normally asked by people who are new to programming).