# Data Structure And Algorithms Using Java Assignment 4 Answers 2023

NPTEL Data Structure And Algorithms Using Java Assignment 4 Answers 2023:- In this post we have provided answers of NPTEL Data Structure And Algorithms Using Java Assignment 4. We provided answers here only for reference. Plz, do your assignment at your own knowledge.

## About Data Structure And Algorithms Using Java

With the growth of Information and Communication Technology, there is a need to develop large and complex software. For developing large software, software developers should have enough proficiency in data structures and algorithms. Further, that software should be platform independent, Internet-enabled, easy to modify, secure, and robust. To meet this requirement object-oriented paradigm has been developed and based on this paradigm the Java programming language emerges as the best programming environment.

Now, Java programming language is being used for mobile programming, Internet programming, and many other applications compatible with distributed systems. This course aims to cover the essential topics of data structures and algorithms and how the same can be implemented using Java programming language. The participants of the proposed course will be able to improve their skills, cope with the current demand of IT industries and solve many problems in their own field of studies.

CRITERIA TO GET A CERTIFICATE

Average assignment score = 25% of the average of the best 8 assignments out of the total 12 assignments given in the course.
Exam score = 75% of the proctored certification exam score out of 100

Final score = Average assignment score + Exam score

YOU WILL BE ELIGIBLE FOR A CERTIFICATE ONLY IF THE AVERAGE ASSIGNMENT SCORE >=10/25 AND EXAM SCORE >= 30/75. If one of the 2 criteria is not met, you will not get the certificate even if the Final score >= 40/100.

## NPTEL Data Structure And Algorithms Using Java Week 4 Assignment Answers 2023

Q1. In the worst case, the number of comparisons needed to search an item stored in a single linked list structure of length 100 is
а. 98
b. 101
c. 99
d. 100

`Answer:- d`

Q2. What does the following function do given a linked list with the first node as head?

`Answer:- For Answer Click Here`

Q3. Consider the given Java code snippet that implements a singly linked list:

`Answer:- `

4. Which of the following operations is performed more efficiently by a doubly linked list than by linear linked list?
a. Deletion after a node
b. Insertion after a node
c. Searching
d. Traversal

`Answer:- Answer:- For Answer Click Here`

5. What is the time complexity of deletion from the end in a circular doubly linked list?
a. O(1)
b. O(n)
c. O(log n)
d. O(log log n)

`Answer:- `

a. Java LinkedList class cannot contain duplicate elements.
b. Java LinkedList class maintains insertion order.
C. Java LinkedList class is non synchronized.
d. Java LinkedList class cannot be used as a list, stack or queue.

`Answer:- Answer:- For Answer Click Here`

7. For which of the following applications, Linkedlist may not be the good choice?
a. Sparse matrix manipulation
b. Random Access Requirements
C. Polynomial manipulation
d. memory management

`Answer:- `

8. Which of the following statements is true about arrays and linked lists in Java?
a. Arrays are always faster than linked lists.
b. Linked lists are always faster than arrays.
c. Arrays are better for random access, while linked lists are better for sequential access.
d. Arrays and linked lists have the same performance for both random and sequential access.

`Answer:- Answer:- For Answer Click Here`

9. Suppose you have a linked list of integers and you want to delete the first node in the list. Which of
the following statements is true?
a. The time complexity of the deletion operation is O(1).
b. The time complexity of the deletion operation is O(n).
c. The time complexity of the deletion operation depends on the size of the integer to be deleted.
d. The time complexity of the deletion operation depends on the location of the deletion point.

`Answer:- `

10. Which of the following is not a valid declaration of a collection of type List?
c = new LinkedList<Integer> d = new LinkedList<>(1, 2, 3, 4, 5);

`Answer:- Answer:- For Answer Click Here`

## NPTEL Data Structure And Algorithms Using Java Assignment 4 Answers 2022

1. What would be the asymptotic time complexity to insert a node at the end of a singly linked list, if the pointer is initially pointing to the head of the list?

a. O(n)
b. O(1)
c. O(nlogn)
d. O(logn)

`Answer:- a`

2. Which of the following is not a type of linked list?

a. Singly
b. Hybrid
c. Doubly
d. Circular

`Answer:- b`

3. Which of the followving operations are dependent on the length of the singly linked list (given pointers to first and last nodes)?

a. Deletion at the beginning
b. Deletion at the end
c. Insertion at the beginning
d. Insertion at the end

`Answer:- b`

4. What does the following function do for a given linked list with the first node as head?

a. Prints all nodes of linked lists.
b. Prints all nodes of linked list in reverse order
C. Prints altermate nodes of Linked List
d. Prints altermate nodes in reverse order

`Answer:- b`

5. Which of the following algorithms cannot be used on a linked list?

a. Linear search
b. Binary search
c. Reversal operation
d. Sorting

`Answer:- b`

6. Worst case time complexity to search an element in a linked list is?

a. O(n)
b. O(1)
C. O(nlogn)
d. Oflogn)

`Answer:- a`

7. What is the time complexity of deletion of the first node in a single linked list?

a. O(n)
b. O(1)
c. O(n*n)
d. O(logn) .

`Answer:- b`

8. If a stack is implemented using a linked list, what will be the time complexity of pop and push operations, respectively?

a. O(1). O(n)
b. O(n). (O)
C. O(l). O(1)
d. O(n). On)

`Answer:- c`

a. Random access is not allowed
b. Dynamic Size
C. Extra memory space for a pointer for each node.
d. Easy Insertion and Deletion.

`Answer:- b, d`

10. Which of the following is an application where a linked list structure can be used?

a. To implement a stack.
b. To mplement a queue.
C. To store a sparse matrix.
d. To store a polymomial of any degree.

`Answer:- a ,b, c, d`