Algorithms, solution methods, comparison of their performance - page 19

 
Alexandr Andreev:

I know it wasn't about a ticket.

No. It was about the transaction number.
 
Реter Konow:
No. It was about the sequence number of the transaction.

in your code the zero zero index is empty - not good

 
Alexandr Andreev:


But I still advise you to start complicating the code with all sorts of things like template functions

In this task, I don't see the need for this. It would inevitably reduce the effectiveness of the particular solution.

In other tasks it may be necessary.

I won't deny it.

 
Реter Konow:

You can make a parallel array next to each other to record tickets.

Or several parallel arrays to write the rest of data of each order.


"Because you can't be that beautiful in the world..."

Genius.

 
Alexandr Andreev:

in your code a null null index is empty - not good

Why zero?

 for(int a1 =  0; a1 < Random_orders_of_strategy; a1++)
   {
    int this_magic = MathRand();
    //----------------------------
    order_number++;
    //---------------------------------
    //Записываем магик в массив после прибавлениея ячейки.
    //---------------------------------
    ArrayResize(All_magics,order_number);
    All_magics[order_number - 1] = this_magic;//  <- Вот здесь.
    //---------------------------------
   }
 
Реter Konow:

Why zero?

It's your own code.
int    All_magics[];
int    Random_orders_of_strategy;
//+------------------------------------------------------------------+ 

template<typename T> 
   void ArrayAdd(T &m[], T& a)    {m[ArrayResize(m,ArraySize(m)+1,100)-1)=a;}
   
void Trading()
{
 Random_orders_of_strategy = MathRand();
 //----------------------------------------
 //Имитируем открытие неопределенного количества ордеров стратегии.
 //----------------------------------------
 for(int a1 =  0; a1 < Random_orders_of_strategy; a1++)
   {
    int this_magic = MathRand();
    ArrayAdd(All_magics,this_magic);
   }
 //----------------------------------------
}
//+------------------------------------------------------------------+
int Get_magic(int deal_number)
{
 return(All_magics[deal_number]);  // ут была ошибка тоже
}
//+------------------------------------------------------------------+


//+------------------------------------------------------------------+
//| Script program start function                                    |
//+------------------------------------------------------------------+
void OnStart()
  {
   Trading(); 
   ulong t1 = GetMicrosecondCount();
   Get_magic(1000);
   ulong t2 = GetMicrosecondCount();
 
  
  
  
 
Alexandr Andreev:
It's your own code.

No. That's not my code. Someone has rewritten it.

I never used the entry.

template<typename T> 
   void ArrayAdd(T &m[], T& a)    {m[ArrayResize(m,ArraySize(m)+1,100)-1)=a;}
   


 
Реter Konow:

No. That's not my code. Someone has rewritten it.

I never used the entry



This is an example and what came out of it.

Has the code become more complex or simpler?

ZS: yes null you write it normally, I missed the rubbish)

 
Alexandr Andreev:

This is an example and what happened with its implementation

Has the code become more complicated or simpler?

I don't know why you would add entities to an ideal solution. I don't see the point.

You don't wear two hats at the same time. And why?

Explain it first. ))

 
Реter Konow:

I don't know why you would add entities to an ideal solution. I don't see the point.

You don't wear two hats at the same time. And why is that?

Explain that first. ))


It's not about putting on a hat.... you're just sewing that hat every time, and it's not very good quality.

Reason: