Notes on Software Development

General Problem Solving Tips

An ever growing list of general problem solving tips. A quick read to absorb some nugget size insights. Best consumed prior to beginning your seasonal coding regiment.

General

For example, don't do this:

if condition1(A) or condition2(B):
    return false

Instead, do this

if condition1(A):
    return false
if condition2(B):
    return false

Don't do this

if condition1(A) and condition2(B):
    return true

Instead, do this

if condition1(A):
    if condition2(B):
        return true

Arrays

    for j=0; j=len(rows); j++ {
        for i=0; i=len(cols); i++ {
            workwith(grid[j][i])  // you have to reverse the order
        }
    }

Tree problems

Linked List