Skip to content

Commit

Permalink
Add day 48
Browse files Browse the repository at this point in the history
  • Loading branch information
MadhavBahl committed Feb 25, 2019
1 parent 6a3c06b commit e99ac31
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -75,6 +75,7 @@ Motivate yourself to code daily till 60 days, and see the magic! Coding will bec
| [Day 45](./day45) | [Priority Queue](./day45) | [http://codetoexpress.tech/dc/day45/](http://codetoexpress.tech/dc/day45/) | **Advanced** |
| [Day 46](./day46) | [Double Ended Queue](./day46) | [http://codetoexpress.tech/dc/day46/](http://codetoexpress.tech/dc/day46/) | **Advanced** |
| [Day 47](./day47) | [Singly Linked List](./day47) | [http://codetoexpress.tech/dc/day47/](http://codetoexpress.tech/dc/day47/) | **Intermediate** |
| [Day 48](./day48) | [Doubly Linked List](./day48) | [http://codetoexpress.tech/dc/day48/](http://codetoexpress.tech/dc/day48/) | **Intermediate** |

## [More Problems](./BONUS/README.md)

Expand Down
Binary file added day46/carbon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion day47/README.md
Expand Up @@ -22,7 +22,7 @@ A linked list is a linear data structure, in which the elements are not stored a

[Read More (Geeks4Geeks)](https://www.geeksforgeeks.org/linked-list-set-1-introduction/)

Try to implement a singly linked list
Try to implement a singly linked list.

## Solution

Expand Down
Binary file added day47/carbon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions day48/JavaScript/dll.js
@@ -0,0 +1 @@
// To Be Added
40 changes: 40 additions & 0 deletions day48/README.md
@@ -0,0 +1,40 @@
![cover](./cover.png)

# Day 47 - Implement a doubly doubly linked list

Write a program to implement a doubly linked list

### Doubly Linked Lists

A doubly Linked List is a variation to a normal Linked List where, instead of one pointer pointing to the next node, there are 2 pointers, one pointing to the next node and the other one to the previous node.

![image](https://user-images.githubusercontent.com/26179770/53316858-6f783980-38ef-11e9-82f5-996aeb8bf08f.png)

Source: [Geeks4Geeks](https://www.geeksforgeeks.org/doubly-linked-list/)

### Advantages of Doubly Linked Lists

1. A DLL can be traversed in both forward and backward direction.
2. The delete operation in DLL is more efficient if pointer to the node to be deleted is given.
3. We can quickly insert a new node before a given node.

In singly linked list, to delete a node, pointer to the previous node is needed. To get this previous node, sometimes the list is traversed. In DLL, we can get the previous node using previous pointer.

### Disadvantages of Linked Lists

1. Every node of DLL Require extra space for an previous pointer. It is possible to implement DLL with single pointer though (See this and this).
2. All operations require an extra pointer previous to be maintained. For example, in insertion, we need to modify previous pointers together with next pointers. For example in following functions for insertions at different positions, we need 1 or 2 extra steps to set previous pointer.

[Read More (Geeks4Geeks)](https://www.geeksforgeeks.org/doubly-linked-list/)

Try to implement a doubly linked list.

## Solution

## JavaScript Implementation

### [Solution](./JavaScript/dll.js)

```js
// To Be Added
```
Binary file added day48/cover.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit e99ac31

Please sign in to comment.