Научная статья на тему 'REDUCED PROCESSING TIME WHEN WORKING WITH LONG ARITHMETIC'

REDUCED PROCESSING TIME WHEN WORKING WITH LONG ARITHMETIC Текст научной статьи по специальности «Компьютерные и информационные науки»

CC BY
45
8
i Надоели баннеры? Вы всегда можете отключить рекламу.
Ключевые слова
Visual Studio 2017 / Processing Time / Method / Long Arithmetic.

Аннотация научной статьи по компьютерным и информационным наукам, автор научной работы — Popova O., Bogatsky N

In this article suggested, considered and analyzed a new faster method for working with long arithmetic, compare to built in programming languages C#. Long arithmetic is the main part in that scopes such as cryptography and bank software. Scope of the presented method covers in built library Big Integer. The implemented class you can use as faster alternative to the built-in class. The solution considered is implemented using Microsoft Visual Studio 2017. Results conclude theoretical findings, based on practical research. As a result, this method shows itself as a possible alternative to the built-in class. Despite the faster processing of operations, the proposed method loses in terms of speed of initialization and memory. But it is worth saying that this method can be significantly accelerated by reworking the initialization and the operations themselves using shifts, while maintaining the idea of dividing a number into blocks, the proposed method can also be redone to store any values. Thus, both methods have their pros and cons, and the idea in the proposed method can be developed for a very long time to achieve better results

i Надоели баннеры? Вы всегда можете отключить рекламу.
iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.
i Надоели баннеры? Вы всегда можете отключить рекламу.

Текст научной работы на тему «REDUCED PROCESSING TIME WHEN WORKING WITH LONG ARITHMETIC»

Заключение

Эффективность разработанной системы обслуживания оценивается по минимуму ресурсов сети, требуемых для пропуска трафика в сетях ОТС и ОбТС, при заданном качестве обслуживания. Ресурс сети определяется как требуемое количество допустимых одновременных соединений. Расчеты показали, что в требования ресурсов для обслуживания абонентов не велики. В разработанной системе среднее время ожидания для всех вызовов в не превысит 2,2 с, а для ожидающих вызовов - 6,2 с. Если принять для абонентов сети ОбТС Р = 0,01, то среднее время ожидание для всех вызовов в составит в среднем 0,013 с.

Разработанная система обслуживания с объединением сетей ОТС и ОбТС наиболее эффективны с точки зрения минимума ресурсов сети при относительно небольшой ёмкости сети ОбТС.

Список литературы

1. Автоматическая телефонная связь на железнодорожном транспорте: Учебник для вузов ж-д

транспорта / Под редакцией А.К. Лебединского. -М.: ФГОУ «Учебно-методический центр по образованию на железнодорожном транспорте», 2008. -531 с.

2. Гольдштейн Б.С. , Саморезов В.В., Шур Ю.Б. Эволюционный путь развития сетей технологической связи. Ведомственные и корпаративные сети и системы. - 2006. - №3. - С. 77-82.

3. Лебединский А.К., Мирсагдиев О.А. Модели обслуживания вызовов в сетях оперативно-технологической и общетехнологической связи РЖД. Бюллетень результатов научных исследований. Выпуск 3(2), ФГБОУ ВПО ПГУПС, 2012.

4. Прокофьева В.А. Выбор системы обслуживания вызовов для интегральной сети связи участка дорог. -М.: МИИТ. 1997г.

5. Юркин Ю.В., Лебединский А.К., Прокофьев В.А., Блиндер И.Д; - Оперативно-технологическая телефонная связь на железнодорожном транспорте. -М.: 2007. - 264 c.

REDUCED PROCESSING TIME WHEN WORKING WITH LONG ARITHMETIC

Popova O.,

Associate professor - associate professor of the department of the information systems and programming of the institute of computer systems and information security of the Kuban state technological university

Bogatsky N.

Student of the department of the information systems and programming of the institute of computer systems and

information security of the Kuban state technological university

Abstract

In this article suggested, considered and analyzed a new faster method for working with long arithmetic, compare to built in programming languages C#. Long arithmetic is the main part in that scopes such as cryptography and bank software. Scope of the presented method covers in built library Big Integer. The implemented class you can use as faster alternative to the built-in class. The solution considered is implemented using Microsoft Visual Studio 2017. Results conclude theoretical findings, based on practical research. As a result, this method shows itself as a possible alternative to the built-in class. Despite the faster processing of operations, the proposed method loses in terms of speed of initialization and memory. But it is worth saying that this method can be significantly accelerated by reworking the initialization and the operations themselves using shifts, while maintaining the idea of dividing a number into blocks, the proposed method can also be redone to store any values. Thus, both methods have their pros and cons, and the idea in the proposed method can be developed for a very long time to achieve better results.

Keywords: Visual Studio 2017, Processing Time, Method, Long Arithmetic.

1. Features of long arithmetic.

Firstly, what should know about long arithmetic -there are representations of numbers whose bit width exceeds the length of a machine word. In the general case, the formula used looks like [1]:

A = an_xrX + an_2r2 +■■■ + + a0,

Where P - the base system of estimate, in which the number is submitted.

Secondly, that the known implementations of arithmetic operations have a solid mathematical foundation.

2. Long arithmetic in C#.

In this language long arithmetic realized that the known implementations of arithmetic operations have a solid mathematical basis. through the Big Integer class and several auxiliary ones, which increases the

processing time of numbers [2]. The number is split into 32 bits, the split parts are written to the array, there is also an additional variable to store the number of the sign. To implement arithmetic operations, additional methods are used that call more methods from the auxiliary library. In general, operations on numbers for crops for a relatively long time, not only because of the multilevel method call, but also because of the implementation of built-in methods.

3. Method

Next method was realized in programming language C#, but it's based idea can be implemented in other languages.

This method is also based on the idea of dividing a number, but not as mathematical as physical. This method is to represent a long number, father-in-law, a

number that is longer than a machine word, as blocks of incoming digits.

Consider the fields of the implemented class and the constructor.

publicreadonlystructmyBigInt {

internalreadonlyintA, B, C, flag;// ABC- number blocks, flag - number sign

privateconstintoverSize = 100000000;//number commonly used for calculation

publicmyBigInt(int A, int B, int C, int flag)//con-

structor accepting blocks and a flag {

if (A == 0 && B == 0 && C == 0)//zero is always positive

flag = 0; this.flag = flag; this.A = A; this.B = B;

this.C = C;

}

}

This method has a limit on the length of the number, although it can be extended by way of the array, for simplicity, this implementation will be considered. We have four variables, A, B and C responsible for the number blocks and flag, which takes values depending on the sign of the long number. Block B and block C have a conventional length of 8 digits, which is controlled during operations and output of a number. Block A in this implementation basically stores a two-digit number.

It was an auxiliary constructor that receives ready-made blocks and a flag as input and "collects" the number. Now it's worth considering the basic constructors. A constructor that accepts long values as input.

PublicmyBigInt(long value)//constructor {

string buf = Convert.ToString(value); string A = ""; string B = "";

string C = "";//block initialization

for (int(C) = buf.Length - 1; (C)>= 0; i--) {

if (buf[i] == '-')

continue;//if minus, then skip it if (buf.Length - i <= 8) C = buf[i] + C; elseif (buf.Length - C<= 16) B = buf[i] + B; else

A = buf[i] + A;

}

if (value < 0)

this.flag = -1;//check sign

else

this.flag = 1; this.A = convert(A); this.B = convert(B);

this.C = convert(C);//writing blocks }

At the beginning, the number is converted to text, for easy extraction of each digit. Further, ignoring the

minus if there is one, fill block C and B with eight digits each, write the rest into the senior block. After that, the flag takes on the values of the input number, although it can be made that it took on values from whether a minus was encountered on the input value, but for this implementation it is not important.

From these sections of the code, the main idea of the method is visible, the essence of which is to represent a long number in the form of several small ones and, when operating with this number, use only the necessary blocks, and not the entire number, which should have a positive effect on the processing speed. Now you can look at the implementation of the operations themselves, but first, it's worth mentioning two helper methods.

static myBigInt revers(myBigInt x, int flag)//flag changes

{returnnew myBigInt(x.A, x.B, x.C, x.flag * flag);}

This method is needed to conveniently change the sign of a number. Implemented by multiplying the flag variable by a number. And the second method is needed to conveniently convert an empty string to 0, since we use strings to write a number, this operation will be performed more than once.

privatestaticint convert(string s)//auxiliary method for converting an empty string to 0{ if (s == "") return 0; else

return Convert.ToInt32(s); }

Let's move on to two main methods that implement addition and subtraction of positive numbers. It is important to note that only positive numbers can enter the input, and negative numbers can be obtained at the output. The first method called add.

static myBigInt add(myBigInt left, int right)//ad-dition of positive MyBigInt and int{

int C = left.C + right;//add with the junior block int flag = C / overSize;//if the block went beyond 8 digits

if (flag != 0)

C -= flag * overSize;//subtract excess intB = left.B + flag;//add extra from the last block flag = B / overSize;//check for exit for 8 digits if (flag != 0)

B -= flag * overSize;//subtract excess intA = left.A + flag;//add possible carryover returnnew myBigInt(A, B, C, left.flag);//return the

finished number

}

static myBigInt add(myBigInt left, myBigInt

right)//addition of two positive myBigInt

{

int C = left.C + right.C;//add lower blocks int flag = C / overSize;//check for block size if (flag != 0)

C -= flag * overSize;//subtraction of excess intB = left.B + right.B + flag;//middle block addition and carryover

flag = B / overSize;//test if (flag != 0)

B -= flag * overSize;

intA = left.A + right.A + flag;//adding the last blocks

returnnew myBigInt(A, B, C, left.flag);//gathering

numbers }

This method is implemented for adding a long number with a variable of the int type and for adding with the same long number. When adding to a variable of type int, first the lowest block is added to the number. It may turn out that the block size goes beyond the conditional limit of 8 digits. By dividing by a constant, we check if there are overflows in our block, if so, then we get rid of the block of it, and add the remainder to the follower block. In an implementation where two long numbers are added, all the blocks are first impregnated, and then the size of each is looked at and the transfer is performed. Thus, we do not use unnecessary blocks, only those that are needed to perform the operation.

The second main method is the method of subtracting positive numbers, the output can be negative.

static myBigInt subtract(myBigInt left, int right)//subtracts an int from myBigInt with a positive sign{

int x1 = right / overSize;//divide int into two blocks

int x2 = right % overSize;

if (x1 != 0 && x2 == 0)//if int = overSize {

x1 = 0;

x2 = overSize; }

intB = left.B - x1;//subtraction of the second block int C = left.C - x2;//low block subtraction int A = left.A;//senior block definitions if (C < 0 && (A != 0 || B != 0))//take a rank, if necessary and if there is where { C += overSize;

B -= 1;

}

if (B < 0 && A != 0)//we borrow according to the

same rules for the middle block

{

B += overSize;

A -= 1; }

elseif (B < 0)//if the number is negative {

B *= -1;

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

returnnew myBigInt(A, B, C, -1);

}

returnnewmyBigInt(A, B, C, left.flag);//returns

the resulting number

}

static myBigInt subtract(myBigInt left, myBigInt

right)//subtracting two positive myBigInt

{

int C = left.C - right.C; int B = left.B - right.B; int A = left.A - right.A;//subtract blocks

if (C > 0 && B < 0)//if negative should come out

{

C = right.C - left.C;

B = right.B - left.B;

}

if (A <= 0 && B <= 0 && C <= 0)//if not where

to borrow

{

returnnew myBigInt(A * -1, B * -1, C * -1, -1);

}

if (C < 0 && (A != 0 || B != 0))//if there is where

to borrow

{

C += overSize;

B -= 1;

}

if (B < 0 && A != 0)//we borrow for the middle

block

{

B += overSize;

A -= 1;

}

elseif (B < 0)

{

B *= -1;

returnnew myBigInt(A, B, C, -1);

}

returnnew myBigInt(A, B, C, left.flag);

}

Subtraction has a more complex implementation relative to the addition algorithm. This is due to the possibility of obtaining a negative result. The first fundamental difference is that we divide the input number into blocks, also if we handle the case if a variable of type int is equal to the variable overSize. After that comes the usual initialization and initial processing of blocks. After that, immediately there is a check for a negative result. If the result is positive, it must be remembered that if during addition we did a transfer, then during subtraction we must take care of borrowing an extra digit, but even during borrowing for the least significant digit, the number may be negative. When subtracting two long numbers, the implementation is approximately the same as when subtracting an int variable from a long number. Only we already have ready-made blocks, and all other checks for a negative result and borrowing an extra bit remain the same. Thus, in subtracting blocks separately, although checks for a negative result have a bad effect on the processing time of the operation, this method remains faster than the built-in.

As I said earlier, these methods cannot handle negative numbers as input. For such cases, these methods are called via overloaded operators with the required parameters. One operator can be considered in detail, the rest are made in the image and likeness.

publicstatic myBigInt operator +(myBigInt left,

int right)//adding myBigInt and int with any sign

{

bool rightFlag = false;

if (right < 0)

{

rightFlag = true;

right *= -1;

}

bool leftFlag = false;

if (left.flag < 0) leftFlag = true; if (leftFlag && rightFlag) {return add(left, right);} if (leftFlag)

{return revers(subtract(revers(left,

1);}

-1), right),

if (rightFlag)

{return subtract(left, right);}

return add(left, right); }

First, we check the signs of the input values. Further, if something is negative in the method, it will come with a positive sign. The correct result is obtained by getting rid of the minuses in the input values and adding it to the result. At the end it is also worth mentioning how this number is represented when displayed on the screen.

publicoverridestring ToString()

{

string A = Convert.ToString(this.A); string B = Convert.ToString(this.B); string C = Convert.ToString(this.C);//translate the block into text if (A == "0")

A = "";//if zero, then do not output if (B == "0"&& A == "")//if A and B are empty, then do not display them B = "";

elseif (A != "")//if A is not empty and B is empty

{

int bLeng = 8 - B.Length;//fill in the block up to 8 digits

for (int i = 0; i < bLeng; i++) B = '0' + B;

_Comparison of the speed of the

}

if (B != "")//if B is not empty, fill C up to 8 digits

{

int cLeng = 8 - C.Length; for (int i = 0; i < cLeng; i++)

C = '0' + C; }

string res = ""; if (this.flag == -1) res += '-';//add a sign res += A; res += B; res += C;

return res; }

This is an important method. If methods implementing addition and subtraction control the block size during processing, then this method is displayed on the screen.The basic idea is that if we have another block in front of the left block, but we output the left block, filling it with zeros to a size of eight digits. We also take into account the sign at the end. 4. Result

Immediately it is worth noting the significant advantage of the built-in class in terms of initialization time. This is due to the fact that Big Integer uses a 32bit system in its constructors, which has faster processing times. In the proposed method, the digit is divided into blocks, but it is also possible to implement the division using shifts, which will significantly speed up the overall work of the method. From the rest of the table, you can see that the gap between the classes is decreasing, which confirms the idea of the proposed method, which consists in processing part of the number.

Table 1

proposed and built-in method._

data type

number of elements

1000000

10000000

100000000

Initialization BigIngere Initialization myBigInt BigInteger + i myBigInt + i BigInteger - i myBigInt - i BigInteger + BigInteger myBigInt + myBigInt BigInteger - BigInteger myBigInt - myBigInti

0:00:02 0:00:59 0:00:08 0:00:05 0:00:08 0:00:05 0:00:08 0:00:06 0:00:09 0:00:06

0:00:14 0:09:18 0:01:18 0:00:40 0:01:18 0:00:44 0:01:16 0:00:37 0:01:38 0:00:57

0:01:40 1:27:50 0:07:39 0:06:30 0:07:26 0:06:07 0:08:10 0:07:23 0:09:01 0:06:47

5. Program code (C#):

public readonly struct myBigInt

{

internal readonly int A, B, C, flag;// A B C - number blocks, flag - number sign

private const int overSize = 100000000;//a number often used for calculations publicmyBigInt(intA, intB, intC, intflag)//constructor accepting blocks and a flag{

if (A == 0 &&B == 0 &&C == 0)//so that zero is always positiveflag = 0; this.flag = flag; this.A = A;

this.B = B;

this.C = C;

}

public myBigInt(ulong value)//constructor {

stringbuf = Convert.ToString(value);//translate into text to fill blocksstring A = ""; string B = "";

string C = "";//block initialization

for (int i = buf.Length - 1; i >= 0; i--)//filling

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

blocks of 8 digits

{

if (buf.Length - i <= 8)

C = buf[i] + C;

else if (buf.Length - i <= 16)

B = buf[i] + B;

else

A = buf[i] + A;

}

flag = 1;//ulong is always positive this.A = convert(A); this.B = convert(B);

this.C = convert(C);//writing blocks }

public myBigInt(long value)//constructor {

string buf = Convert.ToString(value); string A = ""; string B = "";

string C = "";//block initialization

for (int i = buf.Length - 1; i >= 0; i--)

{

if (buf[i] == '-')

continue;//if minus, then skip it if (buf.Length - i <= 8) C = buf[i] + C; else if (buf.Length - i <= 16) B = buf[i] + B; else

A = buf[i] + A;

}

if (value < 0)

this.flag = -1;//check sign

else

this.flag = 1; this.A = convert(A); this.B = convert(B);

this.C = convert(C);//writing blocks }

privatestaticintconvert (strings)//helper method to convert empty string to 0{ if (s == "") return 0; else

return Convert.ToInt32(s); }

public override string ToString()

{

string A = Convert.ToString(this.A); string B = Convert.ToString(this.B); string C = Convert.ToString(this.C);//translate the block into text if (A == "0")

A = "";//if zero, then do not output if (B == "0" &&A == "")//if A and B are empty, then we do not display them B = "";

elseif (A != "")//if A is not empty and B is empty

{

intbLeng = 8 - B.Length;//fill in the block up to 8 digits

for (int i = 0; i < bLeng; i++)

B = '0' + B;

}

if (B != "")//if B is not empty, fill C up to 8 digits

{

int cLeng = 8 - C.Length; for (int i = 0; i < cLeng; i++)

C = '0' + C; }

string res = ""; if (this.flag == -1) res += '-';//add a sign res += A; res += B; res += C;

return res; }

static myBigInt add(myBigInt left, int right)//add-ing positive myBigInt and int{

intC = left.C + right;//add with the junior block intflag = C / overSize;//if the block went beyond 8 digits

if (flag != 0)

C -= flag * overSize;//subtract excess intB = left.B + flag;//add extra from the last block flag = B / overSize;//check for exit for 8 digits if (flag != 0)

B -= flag * overSize;//subtract excess

intA = left.A + flag;//add possible carryover

return new myBigInt(A, B, C, left.flag);//return

the finished number

}

static myBigInt add(myBigInt left, myBigInt right)//addition of two positive myBigInt {

int C = left.C + right.C;//add lower blocks intflag = C / overSize;//check for block size if (flag != 0)

C -= flag * overSize;//subtraction of excess intB = left.B + right.B + flag;//middle block addition and carryover

flag = B / overSize;//test if (flag != 0) B -= flag * overSize;

intA = left.A + right.A + flag;//adding the last blocks

return new myBigInt(A, B, C, left.flag);//gather-

ing numbers

}

public static myBigInt operator +(myBigInt left, myBigInt right)//adds two myBigInt with any sign { bool rightFlag = false; if (right.flag < 0) rightFlag = true; bool leftFlag = false; if (left.flag < 0)

leftFlag = true;//check for signs

if (leftFlag && rightFlag)

{

return add(left, right); }

if (leftFlag)

{

return revers(subtract(revers(left, -1), right), -1); }

if (rightFlag)

{

return subtract(left, right); }

return add(left, right); }

public static myBigInt operator +(myBigInt left, int right)//adding myBigInt and int with any sign { bool rightFlag = false;

if (right < 0)

{

rightFlag = true;

right *= -1;

}

bool leftFlag = false; if (left.flag < 0) leftFlag = true;

if (leftFlag && rightFlag)

{

return add(left, right); }

if (leftFlag) {

return revers(subtract(revers(left, -1), right), -1); }

if (rightFlag)

{

return subtract(left, right); }

return add(left, right); }

public static myBigInt operator -(myBigInt left,

int right)//subtraction of myBigInt and int with any sign {

bool rightFlag = false;

if (right < 0)

{

rightFlag = true;

right *= -1;

}

bool leftFlag = false; if (left.flag < 0) leftFlag = true;

if (leftFlag && rightFlag)

{

return revers(subtract(revers(left, -1), right), -1); }

iНе можете найти то, что вам нужно? Попробуйте сервис подбора литературы.

if (leftFlag) {

return revers(add(revers(left, -1), right), -1); }

if (rightFlag)

{

return add(left, right); }

return subtract(left, right); }

public static myBigInt operator -(myBigInt left, myBigInt right)//subtraction of two myBigInt with any sign {

bool rightFlag = false; if (right.flag < 0) rightFlag = true; bool leftFlag = false; if (left.flag < 0) leftFlag = true; if (leftFlag && rightFlag)

{

return revers(subtract(revers(left, -1), re-

vers(right, -1)), -1); }

if (leftFlag)

{

return revers(add(revers(left, -1), right), -1); }

if (rightFlag)

{

return add(left, revers(right, -1)); }

return subtract(left, right); }

static myBigInt subtract(myBigInt left, int right)//subtracts an int from myBigInt with a positive sign {

int x1 = right / overSize;//divide int into two blocks

int x2 = right % overSize;

if (x1 != 0 && x2 == 0)//if int = overSize {

x1 = 0;

x2 = overSize; }

intB = left.B - x1;//subtraction of the second block intC = left.C - x2;//low block subtraction intA = left.A;//senior block definitions if (C< 0 && (A != 0 || B != 0))//take a rank, if necessary and if there is where { C += overSize;

B -= 1;

}

if (B< 0 &&A != 0)//we borrow according to the

same rules for the middle block

{

B += overSize;

A -= 1; }

elseif (B< 0)//if the number is negative {

B *= -1;

return new myBigInt(A, B, C, -1);

}

return new myBigInt(A, B, C, left.flag);//returns

the received number }

static myBigInt subtract(myBigInt left, myBigInt right)//subtracting two positive myBigInt { int C = left.C - right.C; int B = left.B - right.B; int A = left.A - right.A;//subtract blocks

if (C> 0 &&B< 0)//if negative should come out

{

C = right.C - left.C;

B = right.B - left.B;

}

if (A<= 0 &&B<= 0 &&C<= 0)//if not where to

borrow

{

return new myBigInt(A * -1, B * -1, C * -1, -1);

}

if (C< 0 && (A != 0 || B != 0))//if there is where

to borrow

{

C += overSize;

B -= 1;

}

if (B< 0 &&A != 0)//we borrow for the middle

block

{

B += overSize;

A -= 1; }

else if (B < 0)

{

B *= -1;

return new myBigInt(A, B, C, -1);

}

return new myBigInt(A, B, C, left.flag); }

static myBigInt revers(myBigInt x, int flag)//flag

changes {

return new myBigInt(x.A, x.B, x.C, x.flag * flag); }

}

6. Conclusion

As a result, this method shows itself as a possible alternative to the built-in class. Despite the faster processing of operations, the proposed method loses in terms of speed of initialization and memory. But it is worth saying that this method can be significantly accelerated by reworking the initialization and the operations themselves using shifts, while maintaining the idea of dividing a number into blocks, the proposed method can also be redone to store any values. Thus, both methods have their pros and cons, and the idea in the proposed method can be developed for a very long time to achieve better results.

The reported study was funded by RFBR [Project title: The development of the theory of quality assessment of the information, taking into account its structural component, № 19-47-230004, from 19.04.2019]. All the work on compiling the paper and obtaining calculated and experimental data was evenly distributed among its authors.

References

1. Brent RP, Zimmermann P. Modern Computer Arithmetic. Cambridge: Cambridge University Press; 2011.

2. Microsoft MSDN open resource.

A WAY TO IMPLEMENT A BINARY SEARCH TREE IN PROGRAMMING LANGUAGE C#

Popova O.,

Associate professor - associate professor of the department of the information systems and programming of the institute of computer systems and information security of the Kuban state technological university

Bogatsky N.

Student of the department of the information systems and programming of the institute of computer systems and

information security of the Kuban state technological university

Abstract

In this article, is considered, implemented and tested one of the options for organizing binary trees, as well as its improved version. The test results were checked against one of the common implementations of a binary tree in the C# programming language. Mainly these binary trees are used to implement sets and associative arrays, and there are other uses as well. The scope of the method covers any implementation of a binary tree. The implemented class can be used as a more productive alternative to the built-in or any other implementation of the binary tree. The solution considered was implemented using Microsoft Visual Studio 2017. The results include theoretical conclusions drawn from practical research.

Keywords: Visual Studio 2017, Processing Time, Binary Tree, Time Initialization, Search in Binary Tree, Organization Method.

1. Introduction

1.1. Binary tree feature

A binary tree is a binary tree for which the properties of the search tree are executed. Each parent can have two children. Usually, when initializing a tree, try to make it as balanced as possible. This will reduce the depth of the tree, but the cell values will be relatively chaotic [1, 2].

1.2. Common Binary Tree Implementation.

Often, an implementation consists of a tree class

that concatenates multiple instances of a cell class. The cell class contains a reference to the parent, left and right child, and cell values. The tree class contains the root - the cell from which the tree starts. It is worth noting that a binary tree can only be implemented through

a cell class. Adding an element to the tree is to find free space and take it. The search consists in the fact that we look at the current element, if it is equal to the desired value, we return true, otherwise we look at the tracking cell, and so on until the tree ends. If it ended and the element was not found, then false is returned. It is the implementation described above that will be taken as the usual one, you can implement the tree in a different way, but the principles will remain the same [1, 2].

1.3. Binary search tree.

Binary search tree is a binary tree for which the properties of the search tree are executed [1, 2]. The essence of this organization is that the right child will be larger than the parent cell, and the left one will be smaller. In this tree, the search will be faster, since we

i Надоели баннеры? Вы всегда можете отключить рекламу.