Data structure

0.0(0)
Studied by 0 people
call kaiCall Kai
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/7

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 2:03 AM on 10/7/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

8 Terms

1
New cards

Tree insert function

def insert(root, val):
	if not root: 
		return TreeNode(val) // create a node

	if val > root.val:
		root.right = insert(root.right, val)
	elif val < root.val:
		root.left = insert(root.left, val)
	return root


2
New cards

BST - remove

def minValueNode(root


3
New cards




4
New cards

Recursion

writing functions that call themselves with smaller subproblems

5
New cards

depth first search (DFS)

traversing trees by exploring as deep as possible before backtracking

6
New cards

breadth first search

traversing trees level by level using a queue

7
New cards

deque()

  1. double-ended queue


<ol><li><p>double-ended queue</p></li></ol><p></p>
8
New cards

how to add / remove elements in deque

q = deque()
q.append(5) # [5]
q.append(10) # [5, 10]
q.appendleft(1) # [1, 5,10]

q.popleft() # remove from left [5,10]
q.pop() # remove from right [5]