Zeitkomplexitätsrechner online
for(i=1;i<=n;i++)
{
j=i;
while(j<=n)
{
j=j+i;
}
}
Kind Kudu
for(i=1;i<=n;i++)
{
j=i;
while(j<=n)
{
j=j+i;
}
}
int smallLengthSubarraySum(int arr[], int n, int S)
{
int i;
int wstart = 0, len = INT_MAX;
int subSum = 0;
for(i = 0; i < n; i++)
{
subSum += arr[i];
while(subSum >= S)
{
int currentWindowSize = i - wstart + 1;
if(currentWindowSize < len)
len = currentWindowSize;
subSum -= arr[wstart];
wstart++;
}
}
return len == INT_MAX ? 0 : len;
}
main()
{
i=n
while(i>=1)
{
i=i-10;
i=i+20;
i=i-30;
}
}
sum=0;
for (int i=n ; i >=1 ; i--)
for (j= i ; j <=n ; j++)
sum++;
func eatChips(int bowlOfChips) {
Println("Have some chips!")
for chips := 0; chips <= bowlOfChips; chips++ {
// dip chips
}
Println("No more chips.")
}
func pizzaDelivery(int boxesDelivered) {
Println("Pizza is here!")
for pizzaBox := 0; pizzaBox <= boxesDelivered; pizzaBox++ {
// open box
[1]
[2]
[2]
[2]
United International University (UIU)
Dept. of Computer Science & Engineering (CSE)
Mid Exam Year: 2021 Trimester: Summer
Course: CSE 2217/CSI 227 Data Structure and Algorithms II,
Total Marks: 20, Time: 1 hour, Upload & Download: 15 min
2
for pizza := 0; pizza <= pizzaBox; pizza++ {
// slice pizza
for slice := 0; slice <= pizza; slice++ {
// eat slice of pizza
}
}
}
Println("Pizza is gone.")
}
#include<stdio.h>
void swap(int arr[], int temp, int j){
arr[j]+=arr[temp];
arr[temp]=arr[j]-arr[temp];
arr[j]-=arr[temp];
}
void main(){
int n,i,j,temp;
printf("Enter number of elements: ");
scanf("%d",&n);
int arr[n];
for(i=0;i<n;i++){
printf("\nEnter element %d: ",i+1);
scanf("%d",&arr[i]);
}
for(i=0;i<n-1;i++){
if(arr[i]>arr[i+1]) temp=i;
for(j=n-1;j>i;j--){
if(arr[j]<arr[temp]) swap(arr,temp,j);
}
}
printf("\nSorted Array:");
for(i=0;i<n;i++){
printf(" %d",arr[i]);
}
}
Sum =0;
for ( i=0; i<n; i++)
for ( j=0; j<n*n; j++)
Sum += j;
#include<bits/stdc++.h>
using namespace std;
int main()
{
int a,b;
a = 1;
b = 1;
while(b < n)
{
a += 1;
b += a;
cout<<"Hi";
}
}
hello.py
void fun (int n)
{
if (n ≤ 0)
return;
printf (“*”);
fun(n-1);
fun(n/2);
}