Anonymous
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from ./a.out...
(gdb) r
Starting program: /data/data/com.termux/files/home/a.out
At the beginning there are 0 objects constructed.
And there are 0 elements in the linkedlist container.
Inserting 20 objects with insert_increasing member function
***********************************************************
Inserting
Square Orange Area = 25.00 Per. = 20.00 Side = 5.00
Inserting
Square Yellow Area = 1.00 Per. = 4.00 Side = 1.00
Program received signal SIGSEGV, Segmentation fault.
0x000000555555890c in Node::setLink (this=0x0, p=@0x7ffffff148: 0x7ffffff170)
at codebeautify.cpp:316
316 void Node::setLink(const NodePtr& p) { link = p; }
(gdb) quit
Anonymous
Also, error's in tail_insert for whoever can try to help, because segmentation fault shows up without the use of insert_increasing too
Mar!o
why do you pass pointers by reference?
If NodePtr is Node*
you are doing:
const NodePtr*&
which is not needed. Pointers are cheap to copy they are 32-bits on 86 and 64 bits on 86_64.
Passing them by reference only makes sence with smart pointers or with a mutable reference if you want to return a pointer and
in C++ you should use a ref 2 ptr instead of a double pointer **
Anonymous
olli
Anonymous
Anonymous
Anonymous
Anonymous
void LinkedList::tail_insert(const ShapePtr& p){
NodePtr newnode = new Node();
newnode->setData(p);
NodePtr lst = head;
if(head == nullptr){
head = newnode;
} else {
while(lst != nullptr){
lst = lst->getLink();
}
lst->setLink(newnode);
}
}
Anonymous
olli
Anonymous
Anonymous
damn you're good
Anonymous
thank you very much
ברני
Hey, can someone give me a hint how I merge 2 arrays in the third but the third needs to organize the numbers from small to big?..
ברני
I need help with the right order on the third array..
Alex
ברני
merge then sort
After the merge I do the logic calculation for the smallest to the biggest in the third?
Alex
use STL algorithm. just call sort
Anonymous
ברני
ברני
Question 3 - to run Write a function that receives two sorted arrays [arrays 1 and 2] and their size, and another array [array 3] that is not initialized and sized As a sum of 2 + 1 array sizes. The function will insert into array 3 the values from arrays 1 and 2 in a sorted manner. The insertion of the values into array 3 must be performed in one pass on each of arrays 1 and 2 (a solution that does not meet this requirement is not Will receive a score. For example: the function will get: 6 size, 1,3,5,9,20,257: 1 array 8 Size, 3,4,7,56,82,103,863,999: 2 arrays Array 3: The array contains 14 organs whose value is garbage After running the function: .1,3,3,4,5,7,9,20,56,82,103,257,863,999: 3 Array Exercise notes: There is no need to check that the arrays are sorted. Write a main that tests the function.
ברני
Im not asking for answers just hints if can it will help me better then answers 🙏
Alex
Question 3 - to run Write a function that receives two sorted arrays [arrays 1 and 2] and their size, and another array [array 3] that is not initialized and sized As a sum of 2 + 1 array sizes. The function will insert into array 3 the values from arrays 1 and 2 in a sorted manner. The insertion of the values into array 3 must be performed in one pass on each of arrays 1 and 2 (a solution that does not meet this requirement is not Will receive a score. For example: the function will get: 6 size, 1,3,5,9,20,257: 1 array 8 Size, 3,4,7,56,82,103,863,999: 2 arrays Array 3: The array contains 14 organs whose value is garbage After running the function: .1,3,3,4,5,7,9,20,56,82,103,257,863,999: 3 Array Exercise notes: There is no need to check that the arrays are sorted. Write a main that tests the function.
traverse two arrays from 0 to len, and insert min from both values on each step
Alex
can`t understand your issue
Apk
he probably can't get the sorted array at the end
ברני
if(a[i] >= '0' && '9' >= a[i] )
With this I can read the elements from left to right?
Apk
Apk
ברני
i don't understand this
int countDigits(char a[], int size)
{
int countDigits = 0;
for(int i = 0; i < size; i++)
{
if(a[i] >= '0' && '9' >= a[i] )
{
printf("%c", a[i]);
countDigits++;
}
}
return countDigits;
}
I used this to find a digit before
olli
Apk
ברני
Apk
ברני
NBC
Hello people. Has anyone worked with C project? I am looking for a tutor which can teach me modify a lines of a C code of my project. Inbox
Anonymous
NBC
Good question.
NBC
In fact it just is a little part of my final project in Java
NBC
Ok. Thanks
Anonymous
Gulshan
how to reduce time to execute this code?
Gulshan
Gulshan
I haven't shared the code, just asked what shall be done to reduce the time
Gulshan
Since I can't modify the int main() in hackkerrank
olli
Gulshan
Anonymous
Bro I want learn c programming can u say
Gulshan
okay... srry
Gulshan
Anonymous
Gulshan
https://del.dog/reckovuxap.txt
Please check and give me some tips so that I can reduce time for compiling this code, by only changing class add
Elements
Anonymous
Where I want to search in this group
Anonymous
Or YouTube or Google
Gulshan
Anonymous
Anonymous
Ha kk bro
Gulshan
Anonymous
Thank you
olli
https://del.dog/reckovuxap.txt
seems to be horribly designed test by hackerrank, try adding this before int main()
int start_up() {
std::ios_base::sync_with_stdio(false);
std::cin.tie(NULL);
return 0;
}
static int r = start_up();
#define endl '\n';
Gulshan
Gulshan
But what do this snippet does ?
Gulshan
And can you please remove the warning, this will not happen again...
ברני
hey guys.. I still have troubles with the function of array number 3.. how can I calculate the lowest to the highest from the 2 arrays to the third?.. https://onlinegdb.com/HygcPuSWcP
ברני
i don't know what to do..and I didn't find the answer I was looking for in google..
Raru
I want to change this code with functions but i don’t know how , can you explain me if you know ?
olli
ברני
ברני