Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 44644bf

Browse files
author
Amogh Singhal
authored
Update Interview_Questions.md
1 parent be51eb3 commit 44644bf

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

‎Interview_Questions.md‎

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,33 @@
1-
## 1. How to find the `middle element` of a linked list in one pass
1+
## 1. How to find the `middle element` of a linked list in one pass ?
22
Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. When `p` reaches the end of the linked list. `q` will be in the middle of the list.
33

4-
## 2. How to find the `loop` or `cycle` in a linked list in one pass
4+
## 2. How to find the `loop` or `cycle` in a linked list in one pass ?
55
Solution: Start with two pointer `p` and `q`. For every second iteration of `p`, iterate `q`. If `p` and `q` are pointing to the same node, there is a loop or cycle present.
66

7-
## 3. How to find the `k th` element from the end of a linked list in one pass
7+
## 3. How to find the `k th` element from the end of a linked list in one pass ?
88
Solution: Start with two pointer `p` and `q`. When the `p` pointer reahces upto the `k th` element, increment `q`.When `p` reaches the end of the list. `q` is ponting to the element 'k th' from the end.
99

10-
## 4. List some real world applications of linked list
10+
## 4. List some real world applications of linked list ?
1111
Solution:
1212

1313
*Image viewer* – Previous and next images are linked, hence can be accessed by next and previous button.
1414

1515
*Previous and next page in web browser* – We can access previous and next url searched in web browser by pressing back and next button since, they are linked as linked list.
1616

1717
*Music Player* – Songs in music player are linked to previous and next song. you can play songs either from starting or ending of the list.
18+
19+
## 5. What is a data structure ?
20+
21+
Solution: Data structure refers to the way data is organized and manipulated. It seeks to find ways to make data access more efficient. When dealing with the data structure, we not only focus on one piece of data but the different set of data and how they can relate to one another in an organized manner.
22+
23+
## 6. Explain the `LIFO` scheme.
24+
25+
Solution: LIFO is a short form of Last In First Out. It refers how data is accessed, stored and retrieved. Using this scheme, data that was stored last should be the one to be extracted first. This also means that in order to gain access to the first data, all the other data that was stored before this first data must first be retrieved and extracted.
26+
27+
## 7. What is merge sort ?
28+
29+
Solution: Merge sort, is a divide-and-conquer approach for sorting the data. In a sequence of data, adjacent ones are merged and sorted to create bigger sorted lists. These sorted lists are then merged again to form an even bigger sorted list, which continues until you have one single sorted list.
30+
31+
## 8. What are the minimum number of queues to implement a prioriy queue ?
32+
33+
Solution: The minimum number of queues needed in this case is two. One queue is intended for sorting priorities while the other queue is used for actual storage of data.

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /