📚 Seth MB

Search

Search IconIcon to open search

General Concepts

Last updated Sep 14, 2023 Edit

# Static and dynamic data structures

# The heap

# Pointer

# Passing by value or by reference

# Data Structures

# Arrays

# Linked Lists

# Stacks and Queues

# The Stack Frame

# Recursion

1
2
3
4
5
6
7
8
9
# Example of recursion

def recursion(n):
	print(n)
	if n > 1:
		recursion(n//2) # On calling this line, we suspend the subroutine and add it to the stack frame
	print(n) # Once n !> 1, we process the stack frame, causing the program to spit out the inverse of what it previously printed.

recursion(1024)

Expected output:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
1024
512
256
128
64
32
16
8
4
2
1
1
2
4
8
16
32
64
128
256
512
1024
>>>

# Graphs

# Edges and Vertices

# Representing a graph

# Edges

# Trees

# Binary Trees

# Representing trees

General Concepts