MCPcopy Create free account
hub / github.com/codemistic/Data-Structures-and-Algorithms / main

Function main

CPP/arrays/KthSmallest.cpp:73–97  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

71}
72
73int main() {
74 int size, k;
75 cout << "Enter size of array: ";
76 cin >> size;
77
78 int arr[size];
79 cout << "Enter into the array:\n";
80 for (int i = 0; i < size; i++)
81 cin >> arr[i];
82
83 cout << "Enter value of k: ";
84 cin >> k;
85 cout << endl;
86
87 if (k % 10 == 1)
88 cout << k << "st smallest element is: " << kthSmallest(arr, 0, size - 1, k);
89 else if (k % 10 == 2)
90 cout << k << "nd smallest element is: " << kthSmallest(arr, 0, size - 1, k);
91 else if (k % 10 == 3)
92 cout << k << "rd smallest element is: " << kthSmallest(arr, 0, size - 1, k);
93 else
94 cout << k << "th smallest element is: " << kthSmallest(arr, 0, size - 1, k);
95
96 return 0;
97}

Callers

nothing calls this directly

Calls 1

kthSmallestFunction · 0.85

Tested by

no test coverage detected