<filename>Task 1/K_largest_Elements/Method-1_BubbleK.cpp<gh_stars>10-100
#include <bits/stdc++.h>
using namespace std;

void kLargest(int arr[], int n, int k) {
    sort(arr, arr + n, greater<int>());
    for (int i = 0; i < k; i++)
        cout << arr[i] << " ";
}

int main() {
    int arr[] = { 1, 23, 12, 9, 30, 2, 50 };
    int n = sizeof(arr) / sizeof(arr[0]);
    int k = 3;
    kLargest(arr, n, k);
}
