GATE CS Algorithm Design: Greedy Techniques questions
Practise Algorithm Design: Greedy Techniques questions for GATE CS. Explore official PYQs and original topic-wise quizzes, check answers and view available solutions. Free, no sign-in.
Subject, topic, year and type filter the full library. Match any choice within a filter, and all selected filter categories. Search, source and sort apply to this page.
18 on this page
Consider an array that contains positive integers. A subarray of is defined to be a sequence of array locations with consecutive indices. The code snippet given below has been written to compute the length of the longest subarray of that contains at most two distinct integers. The …
Define to be the maximum amount earned by cutting a rod of length meters into one or more pieces of integer length and selling them. For , let denote the selling price of a rod whose length is meters. Consider the array of prices: …
Consider the string . Each letter in the string must be assigned a binary code satisfying the following properties: For any two letters, the code assigned to one letter must not be a prefix of the code assigned to the other letter. For any two letters of the same frequency, the letter which occurs earlier in the dictionary order is …
Consider a sequence of elements: . The sequence sum . Determine the maximum of , where . (Divide and conquer approach may be used.) Answer: ___________
Consider the weights and values of items listed below. Note that there is only one unit of each item. …
Consider the following table: …
A message is made up entirely of characters from the set . The table of probabilities for each of the characters is shown below: …
Match the following: …
Given below are some algorithms, and some algorithm design paradigms. …
There are bags labeled to . All the coins in a given bag have the same weight. Some bags have coins of weight gm, others have coins of weight gm. I pick coins respectively from bags to Their total weight comes out to gm. Then the product of the labels of the bags having gm coins is …
Suppose the letters have probabilities , respectively. What is the average length of the Huffman code for the letters ?
Suppose the letters have probabilities , respectively. Which of the following is the Huffman code for the letter ?
An element in an array is called a leader if it is greater than all elements to the right of it in . The best algorithm to find all leaders in an array
We are given tasks . The execution of each task requires one unit of time. We can execute one task at a time. Each task has a profit and a deadline . Profit is earned if the task is completed before the end of the unit of time. …
We are given tasks . The execution of each task requires one unit of time. We can execute one task at a time. Each task has a profit and a deadline . Profit is earned if the task is completed before the end of the unit of time. …
The following are the starting and ending times of activities and respectively in chronological order: . Here, denotes the starting time and denotes the ending time of activity X. We need to schedule …
The minimum number of record movements required to merge five files A (with records), B (with records), C (with records), D (with records) and E (with records) is:
A language uses an alphabet of six letters, . The relative frequency of use of each letter of the alphabet in the language is as given below: …
