Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
imransilvake committed Sep 5, 2020
1 parent c7a7c0d commit 0c061a4
Show file tree
Hide file tree
Showing 15 changed files with 415 additions and 8,614 deletions.
16 changes: 16 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
# Editor configuration, see https://editorconfig.org
root = true

[*]
charset = utf-8
indent_style = tab
indent_size = 4
insert_final_newline = true
trim_trailing_whitespace = true

[*.ts]
quote_type = single

[*.md]
max_line_length = off
trim_trailing_whitespace = false
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
node_modules
/dist


# local env files
.env.local
.env.*.local
Expand Down
66 changes: 49 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,24 +1,56 @@
# my-app
# Data Structures
A data structure is a data organization, management, and storage format that enables efficient access and modification.

## Project setup
```
yarn install
## Linked List
```
// An instance of Linked List class
const linkedList = new LinkedList();
### Compiles and hot-reloads for development
```
yarn serve
```
// append at the end of the Linked List
linkedList.appendNodeToEnd("Apple");
linkedList.appendNodeToEnd("Banana");
linkedList.appendNodeToEnd("Banana");
linkedList.appendNodeToEnd("Banana");
linkedList.appendNodeToEnd("Orange");
linkedList.appendNodeToEnd("Potato");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Cherries");
### Compiles and minifies for production
```
yarn build
```
// prepend at the start of the Linked List
linkedList.prependNodeToStart("Fruit");
### Lints and fixes files
```
yarn lint
// delete node from the Linked List
linkedList.deleteNodeFromList("Fruit");
linkedList.deleteNodeFromList("Potato");
linkedList.deleteNodeFromList("Cherries");
// insert newNode after givenNode
linkedList.insertNodeAfter("Insert: Eggs", "Grapes");
// output Linked List
const allNodes = linkedList.toArray();
// find matching node or nodes in Linked List
const singleMatchingNode = linkedList.findSingleMatchingNode("Grapes");
const allMatchingNodes = linkedList.findAllMatchingNodes("Grapes");
// find total count of all matching nodes
const countAllMatchingNodes = linkedList.countOfAllMatchingNodes("Grapes");
// output
console.log({
allNodes,
singleMatchingNode,
allMatchingNodes,
countAllMatchingNodes,
});
```

### Customize configuration
See [Configuration Reference](https://cli.vuejs.org/config/).
## Binary Search
todo

## Linked List
todo
6 changes: 3 additions & 3 deletions babel.config.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module.exports = {
presets: [
'@vue/cli-plugin-babel/preset'
]
presets: [
'@vue/cli-plugin-babel/preset'
]
}
83 changes: 43 additions & 40 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,42 +1,45 @@
{
"name": "my-app",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
"name": "data-structures",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"node-sass": "^4.14.1",
"vue": "^2.6.11"
},
"devDependencies": {
"@vue/cli-plugin-babel": "~4.5.0",
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^6.2.2",
"sass": "^1.26.10",
"sass-loader": "^9.0.3",
"vue-template-compiler": "^2.6.11"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
24 changes: 10 additions & 14 deletions public/index.html
Original file line number Diff line number Diff line change
@@ -1,17 +1,13 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<noscript>
<strong>We're sorry but <%= htmlWebpackPlugin.options.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.</strong>
</noscript>
<div id="app"></div>
<!-- built files will be auto injected -->
</body>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width,initial-scale=1.0">
<link rel="icon" href="<%= BASE_URL %>favicon.ico">
<title><%= htmlWebpackPlugin.options.title %></title>
</head>
<body>
<div id="app"></div>
</body>
</html>
31 changes: 10 additions & 21 deletions src/App.vue
Original file line number Diff line number Diff line change
@@ -1,28 +1,17 @@
<template>
<div id="app">
<img alt="Vue logo" src="./assets/logo.png">
<HelloWorld msg="Welcome to Your Vue.js App"/>
</div>
<div class="ds-data-structures">
<!-- Linked List -->
<LinkedList />
</div>
</template>

<script>
import HelloWorld from './components/HelloWorld.vue'
import LinkedList from "./components/linked-list/LinkedList.vue";
export default {
name: 'App',
components: {
HelloWorld
}
}
name: "App",
components: {
LinkedList
}
};
</script>

<style>
#app {
font-family: Avenir, Helvetica, Arial, sans-serif;
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
text-align: center;
color: #2c3e50;
margin-top: 60px;
}
</style>
Binary file removed src/assets/logo.png
Binary file not shown.
58 changes: 0 additions & 58 deletions src/components/HelloWorld.vue

This file was deleted.

Empty file.
57 changes: 57 additions & 0 deletions src/components/linked-list/LinkedList.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<template>
<div class="ds-linked-list"></div>
</template>

<script>
import { LinkedList } from './../../implementation/LinkedList';
export default {
name: "LinkedList",
mounted: function () {
// An instance of Linked List class
const linkedList = new LinkedList();
// append at the end of the Linked List
linkedList.appendNodeToEnd("Apple");
linkedList.appendNodeToEnd("Banana");
linkedList.appendNodeToEnd("Banana");
linkedList.appendNodeToEnd("Banana");
linkedList.appendNodeToEnd("Orange");
linkedList.appendNodeToEnd("Potato");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Grapes");
linkedList.appendNodeToEnd("Cherries");
// prepend at the start of the Linked List
linkedList.prependNodeToStart("Fruit");
// delete node from the Linked List
linkedList.deleteNodeFromList("Fruit");
linkedList.deleteNodeFromList("Potato");
linkedList.deleteNodeFromList("Cherries");
// insert newNode after givenNode
linkedList.insertNodeAfter("Insert: Eggs", "Grapes");
// output Linked List
const allNodes = linkedList.toArray();
// find matching node or nodes in Linked List
const singleMatchingNode = linkedList.findSingleMatchingNode("Grapes");
const allMatchingNodes = linkedList.findAllMatchingNodes("Grapes");
// find total count of all matching nodes
const countAllMatchingNodes = linkedList.countOfAllMatchingNodes("Grapes");
// output
console.log({
allNodes,
singleMatchingNode,
allMatchingNodes,
countAllMatchingNodes,
});
},
};
</script>
Empty file.
Loading

0 comments on commit 0c061a4

Please sign in to comment.