UGC NET Paper 2 (Computer Science)Hard
The Floyd cycle-detection (tortoise and hare) method finds a cycle in a linked list using:
- A. O(n) time and O(1) extra space
- B. O(n) time and O(n) extra space
- C. O(n^2) time and O(1) extra space
- D. O(log n) time
Correct answer: A. O(n) time and O(1) extra space
Two pointers move at speeds 1 and 2; they meet iff a cycle exists, without a visited set.
Practise more UGC NET Computer Science and Applications questionsUGC NET Computer Science and Applications: notes and key points
More UGC NET Computer Science and Applications questions
- For the reference string 7,0,1,2,0,3,0,4,2,3,0,3,2,1,2,0,1,7,0,1 and 3 frames, the number of page faults under LRU is:
- A TLB lookup takes 20 ns, a memory access 100 ns and the TLB hit ratio is 90%. The effective access time (single-level paging) is:
- A system has a 32-bit virtual address, 4 KB pages and 4-byte page table entries with a single-level page table. The page table size is:
- In the bounded-buffer producer-consumer solution with n slots, the semaphores empty, full and mutex are initialised respectively to:
- A Unix-style inode has 12 direct pointers and one single indirect pointer. With 4 KB blocks and 4-byte block pointers, the maximum file…
- For three tasks, the Liu-Layland utilization bound for Rate Monotonic scheduling, n(2^(1/n) - 1), is approximately: