Question 1. What is the time complexity for the following code/program? 1.1 for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ 1.2 int a = 0; for (int k = n; k >= 1; k--){ sum = i + j+k; cout << sum << endl;}}} for (i = 0; i < N; i++) { for (j=N; j>i; j--) { a = a +i+j;}} 1.3 for (int i = 1; i <= n; i++){ for (int j = 1; j <= 100; j++){ sum = i + j + k;}}
Question 1. What is the time complexity for the following code/program? 1.1 for (int i = 1; i <= n; i++){ for (int j = 1; j <= n; j++){ 1.2 int a = 0; for (int k = n; k >= 1; k--){ sum = i + j+k; cout << sum << endl;}}} for (i = 0; i < N; i++) { for (j=N; j>i; j--) { a = a +i+j;}} 1.3 for (int i = 1; i <= n; i++){ for (int j = 1; j <= 100; j++){ sum = i + j + k;}}
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
Expert Solution
This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 4 steps