Reader small image

You're reading from  Swift Data Structure and Algorithms

Product typeBook
Published inNov 2016
Reading LevelIntermediate
PublisherPackt
ISBN-139781785884504
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Mario Eguiluz Alebicto
Mario Eguiluz Alebicto
author image
Mario Eguiluz Alebicto

Mario Eguiluz Alebicto is a software engineer with over 15 years of experience in development. He started developing software with Java, later switched to Objective-C when the first iPhone delighted the world, and now, he is working with Swift and involved in backend technologies. He loves to code, build exciting projects, and learn new languages and frameworks. Apart from software development, Mario loves to travel, learn new hobbies, practice sports, and considers himself a hardcore gamer, which he has been since he was a child.
Read more about Mario Eguiluz Alebicto

Right arrow

Evaluating runtime complexity


Now that you have the big picture in mind, let's look at some real data for the time performance of common Big-O functions so you will definitely understand the magnitude of the different orders. These running times are done in a faster computer where a simple instruction takes just one nanosecond. Take a look at the following table:

Big-O types and performance – running times for different inputs

The grayed section is colored because the times are not practical in real-world applications. Any algorithm with a running time of more than 1 second is going to have an impact in your application. So by looking at the data provided by this table, some conclusions arise:

  • For a very tiny n (n < 10), almost any order function works quick

  • Algorithms that run on log(n) can have a huge amount of data without becoming slow at all

  • Linear and n*log(n) algorithms have a great performance for huge inputs

  • Quadratic functions (n2) start to have bad performance for n>10,000

  • Algorithms...

lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Swift Data Structure and Algorithms
Published in: Nov 2016Publisher: PacktISBN-13: 9781785884504

Author (1)

author image
Mario Eguiluz Alebicto

Mario Eguiluz Alebicto is a software engineer with over 15 years of experience in development. He started developing software with Java, later switched to Objective-C when the first iPhone delighted the world, and now, he is working with Swift and involved in backend technologies. He loves to code, build exciting projects, and learn new languages and frameworks. Apart from software development, Mario loves to travel, learn new hobbies, practice sports, and considers himself a hardcore gamer, which he has been since he was a child.
Read more about Mario Eguiluz Alebicto