Complexity in Array by R4R Team

Time Complexity:

Construct one dimension array of size n : O(n)
Traversing one dimension array of size n: O(n)

Construct two dimension array of size n : O(n^2)
Traversing two dimension array of size n: O(n^2)

Insertion in Array : O(1)
Deletion in Array : O(n) or O(1)

Searching in unsorted Array of size n : O(n)
Searching in sorted Array of size n : O(n) or O(log(n))

Reverse Array of size n : O(n)

Sort the Array of size n : O(n^2) or O(nlogn)

Space complexity:

storing an Array of size n : O(n)




Leave a Comment:
Search
Categories
R4R Team
R4Rin Top Tutorials are Core Java,Hibernate ,Spring,Sturts.The content on R4R.in website is done by expert team not only with the help of books but along with the strong professional knowledge in all context like coding,designing, marketing,etc!