basic data struct algorithm