UGC NET CS Preparation Notes: Key Concepts
UGC NET CS Preparation Notes: Key Concepts
The CAP Theorem states that in the presence of a network partition, a distributed system can only provide either consistency or availability, but not both simultaneously . This implies that system architects must prioritize between ensuring that all nodes have the same data (consistency) versus ensuring the system remains operational (availability), depending on the application requirements. For example, critical systems may prioritize consistency to prevent errors, while real-time applications may prefer availability to maintain a seamless user experience.
Open addressing stores all keys within the hash table itself and uses schemes like linear or quadratic probing to resolve collisions, which avoids extra memory but can lead to clustering and higher retrieval time as the load factor increases . Chaining, in contrast, uses linked lists or other structures at each hash table index to store multiple elements, leading to additional memory usage but typically offers better performance under high load factors due to separate chaining reducing collisions.
Using randomized pivot selection in quicksort averages out to a more consistent O(n log n) performance by minimizing the chances of encountering the worst-case O(n^2) performance that can occur with fixed pivot strategies in sorted or mostly sorted datasets . This makes quicksort more reliable and efficient for large and diverse input data. Fixed pivot strategies, such as always choosing the first or last element, may lead to poor performance on already ordered datasets due to their deterministic nature.
Bloom filters are particularly advantageous in scenarios requiring space-efficient approximate membership tests, such as caching and database indexing, where occasional false positives are acceptable . They are highly efficient due to their ability to provide constant-time query performance and minimal memory usage. However, they cannot store the actual elements themselves, and do not allow false negatives, nor can they be updated to remove existing elements without redesigning the filter, limiting their applicability in contexts requiring complete accuracy or element removal.
Context-free grammars are essential in defining the syntax of programming languages, which can be parsed using pushdown automata . They allow compilers to systematically check for correct syntax structure and derive a parse tree representing the program’s source code. This parse tree serves as an intermediary structure, enabling subsequent phases like semantic analysis and code generation to function effectively.
Static linking incorporates all library code directly into the executable, increasing its size and reducing dependency management at runtime, thus improving portability . Conversely, dynamic linking can significantly reduce the executable size by loading libraries at runtime, which saves memory and allows easy updates or patching. However, it introduces dependency management complexities and risks of runtime errors if shared libraries become incompatible or are missing. Developers must weigh these trade-offs based on factors like application deployment and maintenance strategy.
Dynamic programming involves storing the solutions to overlapping subproblems to avoid redundant computations and is useful when optimal substructure and overlapping subproblems exist . Divide-and-conquer, in contrast, divides a problem into independent subproblems, solves them independently, and combines their results, without necessarily storing intermediate results .
Implementing OAuth in web applications presents challenges such as ensuring secure management of tokens, dealing with refresh tokens, and understanding its flow which can be more complex compared to the straightforward process of basic authentication . However, OAuth significantly enhances security by allowing applications to access resources without exposing user credentials directly, using token-based authorization and enabling users to grant limited, revocable access to their data, reducing the risk of credential leaks and unauthorized access.
In theory, any language recognized by an NFA can also be recognized by a DFA, making them equivalent in terms of language recognition . However, in practice, NFAs can be easier to construct and understand for certain languages due to their flexibility in allowing multiple transitions for a single symbol, including epsilon transitions. This often results in simpler representations, whereas DFAs require more states to handle the same complexity due to their constraint of a single transition per input symbol.
Regular expressions facilitate efficient text processing by providing a concise and flexible syntax for specifying patterns for string matching tasks, which allows for powerful searching and replacing operations across text data . They are superior to basic string handling functions because they enable complex pattern recognition tasks (e.g., validating email formats) within single expressions, allowing more complex queries than simple string comparisons or splitting functions.