c++ sorting / min heap solutions
sorting:\nRuntime: 112 ms, faster than 87.50% of C++ online submissions\n\nclass Solution {\npublic:\n    vector<vector<int>> allCellsDistOrder(int R, int C, in
**sorting:**\nRuntime: 112 ms, faster than 87.50% of C++ online submissions\n```\nclass Solution {\npublic:\n    vector<vector<int>> allCellsDistOrder(int R, int C, int r0, int c0) {\n        auto comp = [r0, c0](vector<int> &a, vector<int> &b)\n        {\n            return abs(a[0]-r0) + abs(a[1]-c0) < abs(b[0]-r0) + abs(b[1]-c0);\n        };\n        \n        vector<vector<int>> resp;\n        for(int i=0 ; i<R ; i++)\n        {\n            for(int j=0; j<C ; j++)\n            {\n                resp.push_back({i, j});\n            }\n        }\n\n        sort(resp.begin(), resp.end(), comp);\n\n        return resp;\n    }\n};\n```\n\n**min heap:**\nRuntime: 168 ms, faster than 25.00% of C++ online submissions\n```\nclass Solution {\npublic:\n    vector<vector<int>> allCellsDistOrder(int R, int C, int r0, int c0) {\n        auto comp = [r0, c0](vector<int> &a, vector<int> &b)\n        {\n            return abs(a[0]-r0) + abs(a[1]-c0) > abs(b[0]-r0) + abs(b[1]-c0);\n        };\n        priority_queue<vector<int>, vector<vector<int>>, decltype(comp)> minHeap(comp);\n\n        for(int i=0 ; i<R ; i++)\n        {\n            for(int j=0; j<C ; j++)\n            {\n                minHeap.push({i, j});\n            }\n        }\n        \n        vector<vector<int>> resp;\n        while(!minHeap.empty())\n        {\n            resp.push_back(minHeap.top());\n            minHeap.pop();\n        }        \n                            \n        return resp;\n    }\n};    \n```
['C', 'Sorting', 'Heap (Priority Queue)']