Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pipes #1

Open
AhmedThahir opened this issue Mar 16, 2022 · 1 comment
Open

Pipes #1

AhmedThahir opened this issue Mar 16, 2022 · 1 comment

Comments

@AhmedThahir
Copy link

Input

|              | Separate Chaining                                            | Linear Probing             |
| ------------ | ------------------------------------------------------------ | -------------------------- |
| Working      | array with $n$ buckets pointing to linked lists for collisions |                            |
| Complexity   | $O(n)$                                                       | $O(1)$                     |
| Disadvantage | memory wastage                                               | possibility of full bucket |

Output

                  | Working                                                        | Complexity | Disadvantage
---               | ---                                                            | ---        | ---
Separate Chaining | array with $n$ buckets pointing to linked lists for collisions | $O(n)$     | memory wastage
Linear Probing    |                                                                | $O(1)$     | possibility of full bucket

Expected output

|                   | Working                                                        | Complexity | Disadvantage               |
| ---               | ---                                                            | ---        | ---                        |
| Separate Chaining | array with $n$ buckets pointing to linked lists for collisions | $O(n)$     | memory wastage             |
| Linear Probing    |                                                                | $O(1)$     | possibility of full bucket |

How can i edit the code to achieve this?

@harttle
Copy link
Owner

harttle commented Mar 16, 2022

Maybe we can detect whether it contains pipe before replace here:

var columns = line.replace(/^\s*\|/, '').replace(/\|\s*$/, '').split('|').map(trim);

The output pipes when output the reverted table.

Thank you for the first issue! Feel free to file a PR if you finally get it working.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants