Gulshan
So should I first learn dsa... Or should i go with questions solving given on hackerearth ??
Gulshan
Easy
Yeah.... It was having a easy tag....
Mary
hi , can anyone help me
Mary
#include <iostream> using namespace std; double celsius(); int fahrenheit(); int main () { cout << celsius() << endl; } double celsius() { int f, c; cin >> f; c = (f - 32) * (5 / 9); cout << c << endl ; return c; }
Ranmuni Imesha Udayanga
Ranmuni Imesha Udayanga
Can you send the C++ source codes within .h, .cpp, .pro and .ui file formats extensions for the weather calender updating system?
Ranmuni Imesha Udayanga
okey
Pest Control Service
Hi, I need some opinion on design pattern. For an object with only few types (let's say 8) and only one instance of each type will exist, will you use a list[enum of each type as index], or static variable for each of them in the manager class
Dima
Yes, everything is possible in C
Anonymous
Everything is possible with any Turing complete language, but it easier to use some libraries with it
Rasputin
Guys; I have a question. We are currently studying linked lists and we are doing singly linked lists at college rn. Yesterday I realized I did my homework wrong. The task was to rotate a singly linked list with n-Elements wich would look like this. 3,2,1,20,10 and then when its rotated by example "2" it would look like this 20,10,3,2,1 i did it the "other way arround" which is wrong Meaning it would look like 1,20,10,3,2 . Can someone help me with the implementation. What I tried was one pointer that runs to the end. and dragging Pointer that is n Elements behind the other pointer. Then I wanted to set the pointer on the end as the starting one and the dragging pointer as the nullptr. But, it doesn't work I have done something wrong.
Rasputin
void Rotate(TList& pList, size_t const n) { TNode* pStart = pList; TNode* pHead = pList; TNode* pDrag = pList; int i = 0; int j = 0; while (pHead != nullptr) { i++; pHead = pHead->pNext; } while (i > n && j < n) { pDrag = pDrag->pNext; j++; } pHead->pNext = pStart; pList = pHead; pDrag->pNext = nullptr; }
Rasputin
my code looks like this now, I know there is something really wrong. I have been debugging and I know the issue must be with nullpointers i guess. But I yet havent fully grasped the concept of pointers and linked lists 100 percent so its hard for me to find out whats wrong
Igor🇺🇦
Everything is possible with any Turing complete language, but it easier to use some libraries with it
If something is Turing complete it doesn't mean that you can write everything. You can perform the same computation. Good luck writing OS in pure Java or Web page in pure C.
Anonymous
If something is Turing complete it doesn't mean that you can write everything. You can perform the same computation. Good luck writing OS in pure Java or Web page in pure C.
Yeah, you right. I should’ve mention this also. I understand that to write os in pure Java I should at first write something that will compile java into machine code.
Anonymous
Sorry for misleading
christian
Thankssss😍
You're welcome
Name
Hello everyone I have made a question on StackOverflow. Would be cool if someone could help me resolve my questions about debugging on Windows with Cygwin https://stackoverflow.com/questions/65358253/debugging-multi-module-application-on-windows-with-cygwin
Anonymous
Yes
christian
Yes
Oh I thought it was C
Anonymous
Oh I thought it was C
In C headers have .h extension in them, also there is no namespaces in C
F
if someone knows uml diagrams and software engineer please help
Makgato
Guys please i need example on how to create sockets for clients and server on Windows thanks in advance
Rifat
Hi, Can anyone help me?
Rifat
I was trying to solve a problem
Rifat
but didn't get expected answer
Igor🇺🇦
but didn't get expected answer
Do you think there are mind readers here?
klimi
Do you think there are mind readers here?
I am one of them, i think the code is wrong
Sommy
Where can i get any professional C++ project with source code and documentation?
klimi
github
Anonymous
Finish him
Ludovic 'Archivist'
Where can i get any professional C++ project with source code and documentation?
pocoproject.org for a "java-style" C++ project. mariadb for a style closer to C (mariadb.org), scylladb.com for something more modern in term of style
Anonymous
/notes
Anonymous
/cbook
Anonymous
#best-book
Anonymous
#cbook
Sneha
Is there a better method to check if string has unique characters?...hash table, unordered set would provide linear time...and set would be nlogn,
Sneha
kmp is used to search if a substring is present in a string right
Anonymous
Yess
Anonymous
That's what u're tryin to do
Anonymous
Right?
Alex
Is there a better method to check if string has unique characters?...hash table, unordered set would provide linear time...and set would be nlogn,
you should access every char in string to find out its uniqueness. so its can`t be better than linear
Sneha
No...to check if a string is unique like no letter has a duplicate
Sneha
Every character appears once if they appear
Alex
to make it faster you can use array[256] and treat is as hash
Sneha
to make it faster you can use array[256] and treat is as hash
Yeah that is also linear ..even if I consider 128 characters
Alex
Yeah that is also linear ..even if I consider 128 characters
if two algorithms have O(N) its does not mean they are equal by performance
Igor🇺🇦
Is there a better method to check if string has unique characters?...hash table, unordered set would provide linear time...and set would be nlogn,
In theory it's not O(N), it's O(1).You need to access up to 256 characters at most. If the string is ASCII string and is longer than 256 you know it certainly has duplicates. If it's shorter just use array bool[256] and set it to true if you encounter a character. If it's already true return false from method isUniqueChar
Sneha
Okay, thanks guys
Sneha
Since unordered set theoretically is O(1)
Igor🇺🇦
true for one byte char
If string is wide string it still O(1). Just that constant is pretty large. All this O(N) notation works when we're talking about infinite large numbers. In reality it doesn't always works
Alex
Since unordered set theoretically is O(1)
this is look operation in hash. you should traverse all chars in your string to put them to hash if its shorter than 256
Igor🇺🇦
This was what I was referring when I said hash method..I thought we could make it O(logn) somehow
It's not O(log n). It's O(1). You need to check less than 256 characters regardless of string size.
Sneha
So it would make it linear in the worst case
Sneha
Eventhough insertion might be constant
Igor🇺🇦
That means the entire length of the string
But you only of string is shorter than 256 characters. It means O(1).
Igor🇺🇦
Unordered_map of char will be significantly slower
rvp
hello everyone i need to write a c program like : For integers X and Y received from the user (assuming X < Y), write the program that adds all Germain prime numbers in the range of X to Y to an array and prints the elements in this array on the screen. Germain prime numbers are primes such that the number 2p + 1 is also prime. An additional string will not be used in this question. Otherwise, it will be evaluated as 0. also usage of user defined functions, continue and break is illegal. I've been this for 2 days but still i couldn't reach the right output. Here is my code, can someone check it and tell me where my mistake is https://codeshare.io/5v38mn
ברני
But does it effect the output
I think it dose, because you printing j with no columns, but maybe I'm wrong, And it suppose to return 0?