Reader small image

You're reading from  C# 7 and .NET Core 2.0 High Performance

Product typeBook
Published inApr 2018
Reading LevelBeginner
Publisher
ISBN-139781788470049
Edition1st Edition
Languages
Right arrow
Author (1)
Ovais Mehboob Ahmed Khan
Ovais Mehboob Ahmed Khan
author image
Ovais Mehboob Ahmed Khan

Ovais Mehboob Ahmed Khan is a seasoned programmer and solution architect with nearly 20 years of experience in software development, consultancy, and solution architecture. He has worked with various clients across the world and is currently working as a senior customer engineer at Microsoft. He specializes mainly in application development using .NET and OSS technologies, Microsoft Azure, and DevOps. He is a prolific writer who has written several books and articles on various technologies. He really enjoys talking about technology and has given a number of technical sessions around the world.
Read more about Ovais Mehboob Ahmed Khan

Right arrow

Understanding the use of Big O notation to measure the performance and complexity of an algorithm

Big O notation is used to define the complexity and performance of an algorithm with respect to time or space consumed during execution. It is an essential technique to express the performance of an algorithm and determine the worst-case complexity of the program.

To understand it in detail, let's go through some code examples and use Big O notation to calculate their performance.

If we calculate the complexity of the following program, the Big O notation will be equal to O(1):

static int SumNumbers(int a, int b) 
{ 
  return a + b; 
} 

This is because, however the parameter is specified, it is just adding and returning it.

Let's consider another program that loops through the list. The Big O notation will be determined as O(N):

static bool FindItem(List<string> items...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
C# 7 and .NET Core 2.0 High Performance
Published in: Apr 2018Publisher: ISBN-13: 9781788470049

Author (1)

author image
Ovais Mehboob Ahmed Khan

Ovais Mehboob Ahmed Khan is a seasoned programmer and solution architect with nearly 20 years of experience in software development, consultancy, and solution architecture. He has worked with various clients across the world and is currently working as a senior customer engineer at Microsoft. He specializes mainly in application development using .NET and OSS technologies, Microsoft Azure, and DevOps. He is a prolific writer who has written several books and articles on various technologies. He really enjoys talking about technology and has given a number of technical sessions around the world.
Read more about Ovais Mehboob Ahmed Khan