Posts by Andre Luiz • 115 points
10 posts
-
0
votes0
answers30
viewsQ: Why does overwriting the elements of a vector take the same time as the first time?
My goal with this test would be to compare the speed performance between these two functions: static inline void VectAssign1(int *const g , const int x , int n ) { // g[ i ] = x for each i = 0 .. n…
c++asked Andre Luiz 115 -
-1
votes2
answers253
viewsQ: copy an entire txt file to a c++ string
Is there any function that copies a txt file to disk and transfers it whole to a string, without copying character by character in c++?
c++asked Andre Luiz 115 -
0
votes0
answers124
viewsQ: K-nearest neighbors with KD-TREE in c++
I need to implement an algorithm to find the nearest k-neighbors to a certain point in the plane. Most of the material found on the internet be in English, accurate algorithm and working description…
c++asked Andre Luiz 115 -
0
votes1
answer38
viewsQ: Excerpt execution time of a code with an accuracy greater than 0.001 seconds
I need to compute the execution time of sorting algorithms. I did the following: steady_clock::time_point t3 = steady_clock::now(); quickSort(v, 0, n - 1); steady_clock::time_point t4 =…
c++asked Andre Luiz 115 -
-1
votes1
answer654
viewsQ: Random numbers in c++ without repetition
I need to do a program that generates N numbers without repetition between a set of 1 to 600000 numbers. the values of N are 50000,10000,50000,100000 and 500000. These numbers will be stored in a…
c++asked Andre Luiz 115 -
1
votes1
answer1610
viewsQ: manipulate csv file in c++
I need to read a cvs file with the following fields: Id,OwnerUserId,CreationDate,Score,Title,Body Id inteiro OwerUserID inteiro Data vou armazerna como char Score inteiro Title texto Body texto…
c++asked Andre Luiz 115 -
2
votes1
answer320
viewsQ: parameters for function : const reference and constant data pointer
what is the difference in performance ( in the case of large object) the calls below: void funcao( const tipo &objeto ) and void funcao( const tipo *objeto ) I know that the first receives a…
c++asked Andre Luiz 115 -
2
votes2
answers896
viewsQ: Struct or Classes, huh?
I made the code using structure, I wanted to know if with classes it would be more efficient. I’m doing it in C++ Builder. The idea of the code and the following: create a list of problems, where…
-
3
votes1
answer400
viewsQ: How to convert Ansistring to Char in C++ Builder?
I need to pick a file txt through the OpenDialog, to open through fopen. The problem I’m found is in the conversion. The function fopen has as a parameter a const char, already opendialog returns…
-
1
votes1
answer390
viewsQ: Clone a struct without copying the memory address
I need to copy the struct problema1 to the struct problema2 , but to do the way it is in the program below , when I change the struct problema2 also be changing the struct problema1. The way I did…