Anonymous
Sachin
ok
Shahar
https://github.com/klee/klee/blob/master/runtime/Intrinsic/klee_range.c Isn't it a mistake in line 23, giving the address of a local variable (x) to another function call (klee_make_symbolic)?
Prem
Given end points of n lines, design an algorithm and write a C++ code to find all the possible combination of lines which trick each other. A pt on a line is said to be an T_T point if that pt divides the lines in the ratio 2:1starting from the "start point" of the line.
Prem
You know how to do this?
Anonymous
https://github.com/klee/klee/blob/master/runtime/Intrinsic/klee_range.c Isn't it a mistake in line 23, giving the address of a local variable (x) to another function call (klee_make_symbolic)?
Depends on how the function klee_make_symbolic is defined even if it runs on the same thread. Unless we see the definition of klee_make_symbolic and any other functions that it calls with the pointer to x, we cant say anything.
Morgan
Hi
Anonymous
Yeah, I tried finding its definition but did not find. Thank you
https://github.com/klee/klee/blob/df04aeadefb4e1c34c7ef8b9123947ff045a34d9/tools/klee-replay/klee-replay.c#L459
Anonymous
this is always O(n^2), right?
Not necessarily. It can be done in O(n lg n). But the OP has just shared the question without attempting it. Not sure if we can even offer suggestions.
Shahar
https://github.com/klee/klee/blob/df04aeadefb4e1c34c7ef8b9123947ff045a34d9/tools/klee-replay/klee-replay.c#L459
Oh, thanks. So it looks fine. We only assign a value into the memory address pointed by the local var x, eventually returning it by value
Ludovic 'Archivist'
this is always O(n^2), right?
O((n**2)/2) to be accurate
Anonymous
O((n**2)/2) to be accurate
no. M is right, https://www.geeksforgeeks.org/given-a-set-of-line-segments-find-if-any-two-segments-intersect/ just need to calculate the 2:1 part after determining the intersection point. also O(n^2) is the same as O(n^2 / 2)
Talula
It is not allowed and you should have read the rules.
Olena
sorry, guys, should I remove my message above?
Dima
Admin approval is required
Olena
not sure how I can get it approved
Ludovic 'Archivist'
no. M is right, https://www.geeksforgeeks.org/given-a-set-of-line-segments-find-if-any-two-segments-intersect/ just need to calculate the 2:1 part after determining the intersection point. also O(n^2) is the same as O(n^2 / 2)
I was thinking about that kind of n ln n but was too lazy to push deeper (also I specify the obvious dividers because when doing scientific work, stuff taking 2 weeks is more expensive than stuff taking 1 week, force of habit basically)
Anonymous
Who is admin of this group?
Ludovic 'Archivist'
not sure how I can get it approved
Remove it for now, ask, then post if approved
Olena
Who is admin of this group?
have the same question
Ludovic 'Archivist'
have the same question
Click on the icon atop to bring the list of members, the ones where its written admins are... erm... admins
Anonymous
have the same question
admins can change the "Admin" text on telegram. example - Dima's "Amogus enjoyer" and Rose's "UwU"
Ludovic 'Archivist'
Anonymous
;-;
Fortune Nuh Ramp
Thanks
Anonymous
some one help me to tech c++
artemetra 🇺🇦
Anonymous
Hi
klimi
Hi
nohello.com
Big Boss
Could anyone here recommend a SVG generator/builder library?
Big Boss
I’ve searched and couldn’t get a good one. simple-svg is…well, too simple
Cris
Could anyone here recommend a SVG generator/builder library?
I am not sure if it suits your case, but maybe you can try to use Qt: https://doc.qt.io/qt-5/qsvggenerator.html
Cris
I am not sure if it suits your case, but maybe you can try to use Qt: https://doc.qt.io/qt-5/qsvggenerator.html
it comes with a couple of examples: https://doc.qt.io/qt-5/qtsvg-svggenerator-example.html
أسامة
Could anyone here recommend a SVG generator/builder library?
nanosvg could be apropriate it is used in tk ui toolkit
Sandeep
// CPP program to find length of the // longest prefix which is also suffix #include <bits/stdc++.h> using namespace std; // Function to find largest prefix // which is also a suffix int largest_prefix_suffix(const std::string &str) { int n = str.length(); // if n is less than 2 if(n < 2) { return 0; } int len = 0; int i = 1; // Iterate i till n while(i < n) { // If str[i] is equal to // str[len] if(str[i] == str[len]) { ++len; ++i; } else { i = i - len + 1;👈👈👈👈👈👈👈 len = 0; } } // Return len return len>n/2? len/2:len; } // Driver code int main() { string s = "blablabla"; // Function Call cout << largest_prefix_suffix(s); return 0; }
Sandeep
Is anyone else in this group solving the 291 must do interview prep questions from Geeks for geeks..plz pm me
Anonymous
Is C language used in hacking
shuzuya
Is C language used in hacking
Yes but no as direct as you may think check source codes of commonly used hack tools they mostly will be written in c
Anonymous
Guys some one tell me what is the significance of i=i-len+1 when the character s don't match
The matching is done this way: The first substring is assumed to start from 0 always (which should be obvious given that it is the prefix string) and the second substring from 1. The first characters are matched. If they are the same then the next characters are matched and so on. At some point when they are not the same then, the first substring starts from 0 again which explains the len = 0 in the else part and the second substring should start at the position next to the previously started second substring which is i-len+1.
Sandeep
How will i-len +1 lead to that
Anonymous
How will i-len +1 lead to that
Because when you are comparing two substring in this algorithm, at any point the invariant is that you would have compared len characters. The second substring previously started from position i which after len comparisons would now have the value <current value of i>-len. Now you want to restart the comparison again with suffix string starting position from the position next to this which is why you add 1.
Anonymous
After Len comparison won't I be I +len
No. I said the previous value of i I.e. the value at which i was when the comparsions restarted would be i-len Suppose say I is 3 and len is 0. Here you are assuming the suffix starts at position 3. Now suppose you compared 3 characters and all of them are equal. After this I would be 6 and len would be 3. Now suppose the next character doesnt match, then you should start with the suffix at position 4 which is current value of I I.e. 6 - 3 + 1
Sandeep
Wait I have an example
Sandeep
Sandsansand
Sandeep
At the third s...the characters won't match...
Sandeep
So shouldn't I just sent Len to 0 and let I stay there itself
Anonymous
So shouldn't I just sent Len to 0 and let I stay there itself
No. Read my previous message. I have edited it now to explain with an example
Anonymous
And learn to use a debugger instead of asking questions like these. You would learn better and faster
Anonymous
At the third s...the characters won't match...
Here the suffix is then moved to 'a' at position 6 and the comparison is restarted. It wont match in the first character itself. Then the suffix moves to 'n' in position 7. It wont match. Then suffix is moved to character 's' at position 8. Here 4 characters in the prefix and suffix will match and this will be the value returned
Ambrose
Got a question. Why is indentation important? And how carefully does that complier pay attention to it?
Anonymous
Got a question. Why is indentation important? And how carefully does that complier pay attention to it?
C++ Compiler doesnt care about it. A python interpreter does on the other hand. And it is very important because other people should be able to read your code.
artemetra 🇺🇦
Got a question. Why is indentation important? And how carefully does that complier pay attention to it?
the compiler doesn't care about indentation. it's just made to improve readability
Ambrose
Thank you so much.
Anonymous
Why should the second substring not start at the character that didn't match( after matching for some len...you said you'd get some mismatch then second substring should take position next to the previous starting point of second substring)
Ideally this is not the best way to do largest prefix suffix comparison. I was just explaining the algorithm that you provided. There are other much better algorithms which advance the suffix string to a much better position rather than to the next position as shown in the algorithm you provided. These algorithms are used for a large string like the entire text of a book for example or say a genome sequence.
Anonymous
Yeah but why go back..I don't get the intuition..how could someone think of that
Ideally for this example the suffix should advance to the next occurrence of the first character in the string. This is also however not suitable for large strings that I mentioned in my previous post. So if the string provided is sandsansand then the suffix should start with s at position 4 and then advance to s at position 7. That is it. The algorithm provided in GFG does the same but it does this through a circuitous route in the else part of your program.
°Moohaamed°
If i have an array and i want to fill this array by default value = 5 I made it like that.. ____________ array < int , 6 > arr ; arr.fill(5); —————————— Can i made it by another way !?
°Moohaamed°
Ok thanks
Pavel
Do you know a good vector implementation that uses configurable "small buffer optimization"? E.g. if I know that in 99.5% cases my vector won't be larger than some value so I want to allocate a buffer of this size on the stack and only do heap allocations if it grows larger than this value.