Non-orthogonal multiple access (NOMA) has received significant attention for future wireless networks. NOMA outperforms orthogonal schemes, such as OFDMA, in terms of spectral efficiency and massive connectivity. The joint subcarrier and power allocation problem in NOMA is NP-hard to solve in general, due to complex impacts of signal superposition on each user's achievable data rates, as well as combinatorial constraints on the number of multiplexed users per sub-carrier to mitigate error propagation. In this family of problems, weighted sum-rate (WSR) is an important objective function as it can achieve different tradeoffs between sum-rate performance and user fairness. We propose a novel approach to solve the WSR maximization problem in multi-carrier NOMA with cellular power constraint. The problem is divided into two polynomial time solvable sub-problems. First, the multi-carrier power control (given a fixed subcarrier allocation) is non-convex. By taking advantage of its separability property, we design an optimal and low complexity algorithm (MCPC) based on projected gradient descent. Secondly, the single-carrier user selection is a non-convex mixed-integer problem that we solve using dynamic programming (SCUS). This work also aims to give an understanding on how each sub-problem's particular structure can facilitate the algorithm design. In that respect, the above MCPC and SCUS are basic building blocks that can be applied in a wide range of resource allocation problems. Furthermore, we propose an efficient heuristic to solve the general WSR maximization problem by combining MCPC and SCUS. Numerical results show that it achieves near-optimal sum-rate with user fairness, as well as significant performance improvement over OMA.