Nhập môn CNTT CNTT1116
- Biểu diễn dữ liệu: Binary (0,1) • Octal (0-7) • Hex (0-F) • 2's complement • IEEE 754 • ASCII/Unicode
- Tổ chức máy tính: CPU (ALU, CU, Register) • Memory hierarchy • Bus system • Von Neumann
- Thuật toán: Đúng đắn • Dừng • Xác định • Phổ dụng • Độ phức tạp O(n)
# Python cơ bản - Tính giai thừa đệ quy
def factorial(n):
return 1 if n <= 1 else n * factorial(n-1)
Cơ sở lập trình C CNTT1128
- Kiểu dữ liệu: int (2-4B) • float (4B) • double (8B) • char (1B) • array • string
- Điều khiển: if-else • switch • for • while • do-while • break/continue
- Con trỏ & Bộ nhớ: Khai báo (*ptr) • Địa chỉ (&var) • malloc/free • Pointer arithmetic
typedef struct Node {
int data; struct Node* next;
} Node;
Node* head = (Node*)malloc(sizeof(Node));
Lỗi thường gặp: Buffer overflow • Memory leak • Dangling pointer
Cấu trúc dữ liệu & Giải thuật TIHT1101
CTDL | Insert | Delete | Search | Space |
---|---|---|---|---|
Array | O(n) | O(n) | O(n)/O(logn) | O(n) |
Linked List | O(1) | O(1) | O(n) | O(n) |
BST | O(logn) | O(logn) | O(logn) | O(n) |
Hash Table | O(1) | O(1) | O(1) | O(n) |
- Linear: Stack (LIFO) • Queue (FIFO) • Deque • Circular Queue
- Tree: Binary • BST • AVL • Red-Black • B-Tree • Heap
- Sort: Bubble/Selection O(n²) • Quick/Merge/Heap O(nlogn)
Lập trình hướng đối tượng CNTT1131
- 4 tính chất OOP: Encapsulation • Inheritance • Polymorphism • Abstraction
- Class components: Constructor/Destructor • Static members • Virtual function
class Shape { public: virtual double area() = 0; };
class Circle : public Shape {
double area() override { return 3.14 * r * r; }
};
Design Principles: SOLID • DRY • KISS • YAGNI