분류 전체보기
-
[Java] Immutable ObjectProgramming/Java 2024. 4. 1. 22:09
Immutable Object : An object whose state cannot be modified after it is created - Once an immutable object is instantiated, its internal state(the values of its fields) cannot be altered through any means. 1. Thread Safety - In a multi-threaded envrionment, multiple threads can access an immutable object simultaneously without worrying about synchronization issues 2. Simplified Concurrency - Sin..
-
[DB] DB Lock & 2PL ProtocolDB/DB Basic 2024. 3. 31. 21:37
DB Lock : Machanisms used in database management systems to control concurrent access to shared resources such as database tables, rows, or even specific data items. - Ensure data consistency and integrity by preventing conflicts between concurrent transactions Types 1. Shared Lock (S-Lock) - Allows multiple transactions to read a resource simultaneously - Prevents write operations by other tran..
-
[LeetCode] Reverse Nodes In K Group(Java)IT/Problem Solving 2024. 3. 12. 21:57
Problem Solution /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } * ListNode(int val, ListNode next) { this.val = val; this.next = next; } * } */ class Solution { public ListNode reverseKGroup(ListNode head, int k) { if (head == null || k == 1) { return head; } ListNode dummy = new ListNode(-1);..
-
[LeetCode] Merge k Sorted Lists (Java)IT/Problem Solving 2024. 3. 11. 23:13
Problem Solution 1. -T he number range of constraints is not large, so simply converting ListNode to List, sorting it, and returning it again. - - It exhibits poor time and space complexity results. /** * Definition for singly-linked list. * public class ListNode { * int val; * ListNode next; * ListNode() {} * ListNode(int val) { this.val = val; } * ListNode(int val, ListNode next) { this.val = ..
-
[LeetCode] 3Sum (Java)IT/Problem Solving 2024. 3. 3. 22:10
Problem Solution Two-Pointer (st, ed) 1. First, sort the array in ascending order. - In order for the sum of three numbers to be zero, at least one of the numbers must be negative. (excluding the case where all three are zero) - To simplify calculations, sort the array in ascending order first. 2. Set the pivot point (i) and two pointers (st, ed) in the sorted array. - The pivot point (i) can ra..
-
[DB] Concurrency Control (2) Concurrency Problem and Isolation LevelDB/DB Basic 2024. 2. 27. 00:11
Concurrency Problem and Isolation Level Concurrency Problem Concurrency problems occur when multiple transactions are being executed on the same database in unrestricted problems. Concurrency Problem Description Lost Update Occurs when two transactions try to update the same data concurrently, pontentially resulting in one transaction's changes being overwritten by the other Dirty Read Happens w..
-
[DB] Concurrency Control (1) Schedule, Serializability, RecoverabilityDB/DB Basic 2024. 2. 25. 22:56
Concurrency Control When multiple transactions are processed simultaneously in a single DBMS, the utilization of processors and disks increases, leading to an increase in throughput (the number of transactions processed per unit time), and there is a benefit of reduced response time as shorter transactions do not need to wait for other transactions. However, because multiple transactions are exe..
-
[DB] TransactionDB/DB Basic 2024. 2. 24. 16:53
Transaction : A logical unit of work in a database that consists of one or more operations performed on the database ACID 1. Atomicity - Transactions are all-or-nothing - Ensures that all operations within a transaction are completed successfully, or none of them are - If any part fails, the entire transaction is rolled back 2. Consistency - Maintains the database in a valid state before and aft..