DEV Community

Elvin Seyidov
Elvin Seyidov

Posted on • Edited on

Code Theory #1

Heap and Stack memory
Interpreted or compiled
Dynamic Typing vs. Static Typing
Search algorithms - Binary, Linear
Collection types - Array, Linked List
Hashing, Hashtable, Hashmap

📘 Code Theory Notes #1: Core Programming Concepts Every Developer Should Know
A high-level overview of fundamental concepts like memory models, typing systems, search algorithms, data structures, and hashing—essential for any serious developer.

1️⃣ Heap vs. Stack Memory
Stack: Stores function calls, local variables. Fast access, limited size.

Heap: Stores dynamic/long-lived data like objects. Slower access, but flexible size.

Stack is LIFO; heap is non-linear. Languages manage memory differently (e.g., Python uses heap for everything internally with managed stack frames).

2️⃣ Interpreted vs. Compiled Languages
Compiled: Translated to machine code before execution (e.g., C, Go).

Interpreted: Executed line-by-line by an interpreter (e.g., Python, JavaScript).

Some use a hybrid model (e.g., Python → bytecode → interpreted by virtual machine).

3️⃣ Dynamic Typing vs. Static Typing
Dynamic: Types checked at runtime (Python, JS).

Static: Types checked at compile time (Java, C++).

Static typing enables better tooling, early error detection.

Python supports optional static typing with type hints.

4️⃣ Search Algorithms
🔸 Linear Search
Time complexity: O(n)

Checks each item one-by-one

Use when data is unsorted

🔸 Binary Search
Time complexity: O(log n)

Requires sorted data

Divides list in half each step

5️⃣ Collection Types: Array vs Linked List
Feature Array Linked List
Memory Layout Contiguous Scattered (nodes)
Access Time O(1) (indexing) O(n)
Insertion/Deletion Costly (resize/shift) Cheap (relink nodes)
Use Case Fast access Dynamic insertion
6️⃣ Hashing & Hash Tables / Hashmaps
Hashing: Maps keys to indices using a hash function

Hash Table (or Hashmap): Stores key-value pairs

Time complexity:

Average: O(1) for insert/search/delete

Worst: O(n) if collisions occur

Python's dict, JavaScript's Object, and Java's HashMap are all hash-based

🧠 Next Up (Code Theory #2 ideas):
Sorting Algorithms (Quick, Merge, Bubble)

Big-O Notation & Complexity

Recursion & Iteration

Trees & Graphs

Pointers & References

Bit Manipulation Basics

Hostinger image

Get n8n VPS hosting 3x cheaper than a cloud solution

Get fast, easy, secure n8n VPS hosting from $4.99/mo at Hostinger. Automate any workflow using a pre-installed n8n application and no-code customization.

Start now

Top comments (0)

Sentry image

See why 4M developers consider Sentry, “not bad.”

Fixing code doesn’t have to be the worst part of your day. Learn how Sentry can help.

Learn more

👋 Kindness is contagious

If you found this post useful, consider leaving a ❤️ or a nice comment!

Got it