Answered step by step
Verified Expert Solution
Question
1 Approved Answer
question 1 Given a singly linked and sorted list L of any numbers. 1 , what is the worst - case running time for searching
question Given a singly linked and sorted list L of any numbers. what is the worstcase running time for searching for an element in L A proposal was made to improve the search time: we will save another list so that there will be approximately members only the first to the last in jumps of approximatelyThat is if for example there are members in the original list, then the second one will have about members: the first, the tenth, the twentieth, the ninetieth and the last Given the two lists the original L is strongly linked and sorted as described explain how a search can be performed and what the running time is in the worst case. There is no need to refer to the creation and maintenance of the lists, but only to the search Clarification: In list L there are votes for the members of the original list ie it is possible to reach from each member in L its counterpart in L See an example Suggest a way to optimize the search given an additional level L Tutorial: Calculate how you would do this for members and for a million members. In order to find the worst case, try to check an element that exists in the list, an element that does not exist, an element that exists relatively at the beginning, relatively at the end and try to generalize your answer. There is no need to write routines, but only to explain what each level will contain, how the search will be carried out, and what the complications will be in the worst case. Question : Given an array A of size n of any numbers not necessarily integers It can be assumed that the numbers are different from each other. We would like to build an array S of size so that each index and array S will have the number of elements that are to the left of n and are smaller than or equal to Ai in the original array. For example, for S A A Show that any algorithm for performing the task will perform at least operations. Hint: first show that if the task in question can be performed in some time T then it is possible to determine for each member the value of its position in time OT B Describe an algorithm to perform the task that runs in optimal time for the problem. Question Propose a data structure S which is maintained by unique integers and supports the following routines at the runtimes indicated next to each routine: InsertS: inserting the integer k into the structure S running time: lg DeleteSx: deleting the member to which x points from the structure S runtime: Olgn ChangeSx: changing the sign of the key of the member x that belongs to S Running time: Olgn that is greater than or equal to S returns the minimal nonnegative key in : SearchNonnegativeSk For the integer k k is not necessarily a value of a key in S Running time: Olgn MedNegativeS: Returns the lower median of the negative key values in S Running time: Olgn Note: In the Changex routine, the intention is to change the sign of the member's key from negative to positive or from positive to negative, for example if keyx then after calling ChangeSx there will be keyx The algorithms should be described briefly and precisely. Briefly analyze readiness and complications.
question
Given a singly linked and sorted list L of any numbers.
what is the worstcase running time for searching for an element in L
A proposal was made to improve the search time: we will save another list so that there will be approximately members only the first to the last in jumps of approximatelyThat is if for example there are members in the original list, then the second one will have about members: the first, the tenth, the twentieth, the ninetieth and the last
Given the two lists the original L is strongly linked and sorted as described explain how a search can be performed and what the running time is in the worst case. There is no need to refer to the creation and maintenance of the lists, but only to the search
Clarification: In list L there are votes for the members of the original list ie it is possible to reach from each member in L its counterpart in L See an example
Suggest a way to optimize the search given an additional level L
Tutorial: Calculate how you would do this for members and for a million members. In order to find the worst case, try to check an element that exists in the list, an element that does not exist, an element that exists relatively at the beginning, relatively at the end and try to generalize your answer.
There is no need to write routines, but only to explain what each level will contain, how the search will be carried out, and what the complications will be in the worst case.
Question :
Given an array A of size n of any numbers not necessarily integers It can be assumed that the numbers are different from each other. We would like to build an array S of size so that each index and array S will have the number of elements that are to the left of n and are smaller than or equal to Ai in the original array. For example, for S A
A Show that any algorithm for performing the task will perform at least operations.
Hint: first show that if the task in question can be performed in some time T then it is possible to determine for each member the value of its position in time OT
B Describe an algorithm to perform the task that runs in optimal time for the problem.
Question
Propose a data structure S which is maintained by unique integers and supports the following routines at the runtimes indicated next to each routine:
InsertS: inserting the integer k into the structure S running time: lg
DeleteSx: deleting the member to which x points from the structure S runtime: Olgn
ChangeSx: changing the sign of the key of the member x that belongs to S Running time: Olgn
that is greater than or equal to S returns the minimal nonnegative key in : SearchNonnegativeSk
For the integer k k is not necessarily a value of a key in S Running time: Olgn
MedNegativeS: Returns the lower median of the negative key values in S Running time: Olgn
Note: In the Changex routine, the intention is to change the sign of the member's key from negative to positive or from positive to negative, for example if keyx then after calling ChangeSx there will be keyx
The algorithms should be described briefly and precisely. Briefly analyze readiness and complications.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started