fix(guide): restructure curriculum guide articles (#36501)
* fix: restructure certifications guide articles * fix: added 3 dashes line before prob expl * fix: added 3 dashes line before hints * fix: added 3 dashes line before solutions
This commit is contained in:
@@ -1,50 +1,44 @@
|
||||
---
|
||||
title: Adjacency List
|
||||
---
|
||||
## Adjacency List
|
||||
 Remember to use <a>**`Read-Search-Ask`**</a> if you get stuck. Try to pair program  and write your own code 
|
||||
# Adjacency List
|
||||
|
||||
###  Problem Explanation:
|
||||
---
|
||||
## Problem Explanation
|
||||
|
||||
To solve this problem, you have to create a Javascript Object to emulate an undirected graph in the form of an adjacency list.
|
||||
|
||||
|
||||
##  Hint: 1
|
||||
---
|
||||
## Hints
|
||||
|
||||
### Hint 1
|
||||
|
||||
Create keys with the names James, Jill, Jenny and Jeff.
|
||||
|
||||
> _try to solve the problem now_
|
||||
|
||||
##  Hint: 2
|
||||
### Hint 2
|
||||
|
||||
Read the presentation and try to understand what it means to be an undirected graph.
|
||||
|
||||
> _try to solve the problem now_
|
||||
|
||||
---
|
||||
## Solutions
|
||||
|
||||
<details><summary>Solution 1 (Click to Show/Hide)</summary>
|
||||
|
||||
```js
|
||||
var undirectedAdjList = {
|
||||
James: ["Jeff"],
|
||||
Jill: ["Jenny"],
|
||||
Jenny: ["Jill", "Jeff"],
|
||||
Jeff: ["Jenny", "James"]
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
|
||||
## Spoiler Alert!
|
||||
|
||||

|
||||
|
||||
**Solution ahead!**
|
||||
|
||||
##  Basic Code Solution:
|
||||
|
||||
var undirectedAdjList = {
|
||||
James: ["Jeff"],
|
||||
Jill: ["Jenny"],
|
||||
Jenny: ["Jill", "Jeff"],
|
||||
Jeff: ["Jenny", "James"]
|
||||
};
|
||||
|
||||
|
||||
### Code Explanation:
|
||||
#### Code Explanation
|
||||
|
||||
* The undirected graph is created using a Javascript Object. Each unique name is a key and the each person who has a relationship with the name is in the unique name's array value. e.g. if James and Jeff have a relationship, Jeff will be in James's array value and James will be in Jeff's array value.
|
||||
|
||||
##  NOTES FOR CONTRIBUTIONS:
|
||||
|
||||
*  **DO NOT** add solutions that are similar to any existing solutions. If you think it is **_similar but better_**, then try to merge (or replace) the existing similar solution.
|
||||
* Add an explanation of your solution.
|
||||
* Categorize the solution in one of the following categories — **Basic**, **Intermediate** and **Advanced**. 
|
||||
</details>
|
Reference in New Issue
Block a user