Cerinta completa Of the following data structures, which has a Last in First Out ordering? In other words, the one that came in last will be the first to be popped. Limbajul de programare folosit: N/A (quiz / MCQ) Raspuns
Data Structures MCQ 2
Cerinta completa Which of the following data structures can handle updates and queries in log(n) time on an array? Limbajul de programare folosit: N/A (quiz / MCQ) Raspuns corect: Segment Tree Explicatie: Correct answer is Segment Tree. Please refer to
Data Structures MCQ 1
Cerinta completa If we have a tree of n nodes, how many edges will it have? Limbajul de programare folosit: N/A (quiz / MCQ) Raspuns corect: n-1 Explicatie: Correct answer is n-1. An undirected tree with n nodes must have
Waiter
Cerinta completa You are a waiter at a party. There is a pile of numbered plates. Create an empty array. At each iteration, , remove each plate from the top of the stack in order. Determine if the number on
Queries with Fixed Length
Cerinta completa Consider an -integer sequence, . We perform a query on by using an integer, , to calculate the result of the following expression: In other words, if we let , then you need to calculate . Given and
Palindromic Subsets
Cerinta completa Consider a lowercase English alphabetic letter character denoted by . A shift operation on some turns it into the next letter in the alphabet. For example, and , , . Given a zero-indexed string, , of lowercase letters,
Number Game on a Tree
Cerinta completa Andy and Lily love playing games with numbers and trees. Today they have a tree consisting of nodes and edges. Each edge has an integer weight, . Before the game starts, Andy chooses an unordered pair of distinct
Kitty’s Calculations on a Tree
Cerinta completa Kitty has a tree, , consisting of nodes where each node is uniquely labeled from to . Her friend Alex gave her sets, where each set contains distinct nodes. Kitty needs to calculate the following expression on each
Functional Palindromes
Cerinta completa Let’s define a function, , on a string, , of length as follows: where denotes the ASCII value of the character in string , , and . Nikita has a string, , consisting of lowercase letters that she
Find the permutation
Cerinta completa Consider a permutation, , of integers from to . Let’s determine the of to be the minimum absolute difference between any consecutive integers in : Generate a lexicographically sorted list of all permutations of length having a maximal
