Given a set of n numbers, your task is to create a doubly linked list for...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Given a set of n numbers, your task is to create a doubly linked list for the given input data. Now you need to print the m number of nodes which are right to the given node value. The node value and m is given as inputs. For example, given input data is 10,20,30,50,40 and m=2 and node value is 20, then your program returns 30, 50. if there are less than m nodes from the node value's position towards right direction then your program should return -1. Sample Input and Output Sample Input: Enter input data: 10 20 30 40 50 Enter m value: 2 Enter node: 20 Sample output: 30 40 D Given a set of n numbers, your task is to create a doubly linked list for the given input data. Now you need to print the m number of nodes which are right to the given node value. The node value and m is given as inputs. For example, given input data is 10,20,30,50,40 and m=2 and node value is 20, then your program returns 30, 50. if there are less than m nodes from the node value's position towards right direction then your program should return -1. Sample Input and Output Sample Input: Enter input data: 10 20 30 40 50 Enter m value: 2 Enter node: 20 Sample output: 30 40 D
Expert Answer:
Answer rating: 100% (QA)
Python class Node def initself data selfdata data selfprev None selfnext None de... View the full answer
Related Book For
Introduction to Algorithms
ISBN: 978-0262033848
3rd edition
Authors: Thomas H. Cormen, Charles E. Leiserson, Ronald L. Rivest
Posted Date:
Students also viewed these programming questions
-
Your task is to create a game where the users can play with words and numbers. The game has three consecutive levels (Level 1, Level 2, and Level 3). Users can proceed to the next level after...
-
Ann Carter, Chief Financial Officer of Consolidated Electric Company (Con El), must make a recommendation to Con Els board of directors regarding the firms dividend policy. Con El owns two...
-
c++. error: array must be initialized with a brace enclosed initializer main.cpp X 10 11 ii 12 13 14 4567 15 16 17 18 19 287288285 20 21 23 24 25 26 27 28 25285922223288 30 31 33 34 36 37 40 41 42 43...
-
A regression model Y = B0 + B1x1 +B2x2 + B3x3 + has been fit to a sample of n = 25 observations. The calculated t-ratios are as follows: for B1, t0 = 4.82, for B2, t0 = 8.21 and for B3, t0 = 0.98....
-
Suppose the population is women at least 35 years of age who are pregnant with a fetus affected by Down syndrome. We are interested in testing positive on a noninvasive screening test for fetuses...
-
How many forms of main() are there?
-
The list below indicates various audit, attestation, and assurance engagements involving auditors. 1. A report on the effectiveness of internal control over financial reporting as required by Section...
-
Who is Tesla's auditor? Did Tesla's receive a "clean" (unmodified) audit opinion? How many critical audit matters were discussed in Tesla's audit report?
-
On August 31, Sunland Marine had an inventory of 21 boats at a cost of $2,100 each. Sunland does not expect any returns from sales of boats. The company uses a perpetual inventory system. During...
-
Novak, Ltd., manufactures boats and personal watercraft. The company operates three separate divisions: yachts, sailboats, and jet skis. The company's latest income statement is presented by product...
-
Suppose you warm up 460 grams of water (about half a liter, or about a pint) on a stove, and while this is happening, you also stir the water with a beater, doing 5 10 4 J of work on the water....
-
Carla Vista Bakeries recently purchased equipment at a cost of $780,500. Management expects the equipment to generate cash flows of $233,250 in each of the next four years. The cost of capital is 13...
-
Levine Company is a manufacturer of very inexpensive cell phones and television sets. The company uses recycled parts and a highly structured manufacturing process to keep costs low so that it can...
-
Kayla took a 4-year auto-loan of $20,000. Assume the interest rate is 8 percent per year and the loan agreement calls for fixed principal payment per year. What is the interest payment in year 2?
-
Michael's, Inc. just paid this morning an annual dividend of $2.60. Simultaneously, the company announced that future dividends will be increasing by 5.60 percent per year. If you require an annual...
-
Explain how, in a creditor/debtor transaction, the exposure of a guarantor is limited and his rights protected
-
H Corporation has a bond outstanding. It has a coupon rate of 8 percent and a $1000 par value. The bond has 6 years left to maturity but could be called after three years for $1000 plus a call...
-
Another way to evaluate a polynomial A(x) of degree-bound n at a given point x 0 is to divide A(x) by the polynomial (x x 0 ), obtaining a quotient polynomial q(x) of degree-bound n 1 and a...
-
Show that after all edges are processed by CONNECTED-COMPONENTS, two vertices are in the same connected component if and only if they are in the same set.
-
Give a non recursive algorithm that performs an in order tree walk. An easy solution uses a stack as an auxiliary data structure. A more complicated, but elegant, solution uses no stack but assumes...
-
What is a key function of credit-rating agencies? Do credit-rating agencies always provide reliable information? What was the role of credit-rating agencies in the sub-prime crisis of 2008?
-
Professor Pacioli was recently asked the following five questions by his aspiring accounting students. Prepare a summary of the professor's reply to each question. (a) Professor, I cannot quite put...
-
Goudar Bloodcare is a blood donation center where eligible donors give a pint of blood about once every other month. Assess each of the following to decide if Goudar should record the item as an...
Study smarter with the SolutionInn App