Linked List Flashcards

1
Q

A ______ is a fundamental data structure in computer science. It consists of nodes
where each node contains _______ and ______ to the next node in the
sequence.

A

linked list
data and a reference (link)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Linked Lists allows for ________ and efficient insertion and
deletion operations compared to arrays

A

dynamic memory allocation
insertion

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

A linked list is a _________ that stores a collection of data elements
_______.

A

linear data structure
dynamically.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

_______ represent those data elements, and ________ connect each node.

A

nodes
links or pointers

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

Each node consists of two fields, the ____________ and a pointer that
stores the address of its next node.

A

information stored in a linked list

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

The last node contains _____ in its second field because it will point to no node

A

null

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

A linked list can ______ and _____ its size, as per the requirement.

A

grow and shrink

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

In the linked list there is a ______, which points to the first element of the linked list,
and if the list is empty then it simply points to ______

A

head pointer
null or nothing.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Advantages of Linked Lists

A

Dynamic size
Efficient Insertion and Deletion
Memory Efficiency

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

Dynamic size
Linked lists do not have a _______, so you can add or remove elements as needed, without
having to worry about the size of the list. This makes linked lists a great choice when you
need to work with a collection of items whose size can change dynamically.

A

fixed size

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

Efficient Insertion and Deletion
Inserting or deleting elements in a linked list is _________, as you only need to modify
the reference of the next node.

A

fast and efficient

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

Disadvantages of Linked Lists

A

Slow Access Time
Pointers
Extra memory required

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

Slow Access Time: Accessing elements in a linked list can be ______, as you
need to traverse the linked list to find the element you are looking for.

A

slow

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

Pointers: Linked lists use _____ to reference the next node, which can make
them more ______ to understand and use compared to arrays. This
complexity can make linked lists more difficult to debug and maintain.

A

pointers
complex

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Extra memory required: Linked lists require an _____ for each node,
which takes up _______. This can be a problem when you are working
with large data sets, as the extra memory required for the pointers can
quickly add up

A

extra pointer
extra memory

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Traversal of items can be done in the forward direction only due to
the linking of every node to its next node.

A

Singly/Single Linked List

17
Q

Insert a Node at the Front/Beginning of Linked List

A

Make the first node of Linked List linked to the new node

Remove the head from the original first node of Linked List

Make the new node as the Head of the Linked List

18
Q

Insert a Node after a Given Node in Linked List

Check if the given node exists or not.
If it do not exists,
______________

If the given node exists,

_______

A

terminate the process.

Make the element to be inserted as a new node
Change the next pointer of given node to the new node
Now shift the original next pointer of given node to the next
pointer of new node

19
Q

Insert a Node at the end of the Linked List

A

Go to the last node of the Linked List

Change the next pointer of last node from NULL to the new node

Make the next pointer of new node as NULL to show the end
of Linked List

20
Q

you define a function that deletes a node from a linked list by calling
itself recursively until the node to be deleted is found.

A

recursive deletion,

21
Q

ARRAY

Arrays are stored in _________.
______ in size.
Memory is allocated at ________.
Uses ______ memory than linked lists.
Elements can be accessed ______.
Insertion and deletion operation _____.

A

contiguous location
Fixed
compile time
less
easily
takes time.

22
Q

Linked lists

are not stored in _________.
_____ in size.
_______ is allocated at run time.
Uses ______ memory because it stores both __________ of the next node.
Element accessing requires the ______ of the whole linked list.
Insertion and deletion operation is _______.

A

contiguous location
Dynamic
Memory
more
data and the address
traversal
faster

23
Q
A