Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help. Thank you. CS310: Data Structures Week 3: Linked Lists Page 1 Your Name: Section: Participation Ouestions 1. Given the Node class definition on

Please help. Thank you.
image text in transcribed
image text in transcribed
CS310: Data Structures Week 3: Linked Lists Page 1 Your Name: Section: Participation Ouestions 1. Given the Node class definition on the right which of the following are ints i the variable head is a reference to a Node at the start of a linked list 1-2-3? class Node tint value: Node next: b. head.value c. head.next.value d. head, next e head. next next 2. For the same linked list as Question 1 (a->b->c), what is the value of head.next.value? Answer: 3. Given the Node class definition and code snippet on the right, which of the following are null? a. head class Node( T value Node next; } b. head.value c. head.next.value Node head - new Node (); d. head. next head.next = new Node>() e. head.next next 4. Given the Node constructor definition on the right, which statement inserts an item x after node e? a. c.next = new Node (x, c); b. c.next - new Node (x, c.next); C. C new Nodex, C); d. = new Node (x, c.next); e. none of the above public Node Tv, Node n) this.value - V this.next n 5. Suppose we define a static method renovevalt that removes the first half of a List (or slightly less than one-half of the list if odd length) as shown on the right. What can be used to fill the blank? a. only Ist.size() b. only size either ist.size) or size d. neither ist.size() nor size public static void remove aleList Ist) int size - lat.size() for(int 101 121 1++) 1st.remove(0); c 6. Suppose we define a static method totalEventoc() that returns the total of even-index items of an integer List as shown on the right. What is the Big-O running time of the method if ist is a Linkedlist of size N? ist) a. 1) b. O'lg N) & CN. 4 CNN) e ON) public static int totalEventoc (List Integer int sum = 0; for (int i=0; i

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Advanced MySQL 8 Discover The Full Potential Of MySQL And Ensure High Performance Of Your Database

Authors: Eric Vanier ,Birju Shah ,Tejaswi Malepati

1st Edition

1788834445, 978-1788834445

More Books

Students also viewed these Databases questions

Question

Compare and contrast primary and secondary groups.

Answered: 1 week ago